aboutsummaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeLines
* t0001: ignore ".dirty" suffix on Git versionGravatar John Keeping2013-04-15-1/+1
| | | | | | | | | | | | | | When testing modifications in Git that affect CGit, it is annoying to have t0001 failing simply because the Git version has a ".dirty" suffix when the version of Git there does indeed match that specified in the CGit makefile. Stop this by stripping the ".dirty" suffix from the GIT_VERSION variable. Note that this brings the "Git version" behaviour in line with the "submodule version" case which does not check if the working tree in git/ is modified. Signed-off-by: John Keeping <john@keeping.me.uk>
* tests: set TEST_OUTPUT_DIRECTORY to the CGit test directoryGravatar John Keeping2013-04-15-0/+1
| | | | | | | | | | | | | | | By default, Git's test suite puts the trash directories and test-results directory into its own directory, not that containing the tests being run. This is less convenient for inspecting test failures, so set the output directory to CGit's tests/ directory instead. Note that there is currently a bug in Git whereby it will create the trash directories in our tests/ directory regardless of the value of TEST_OUTPUT_DIRECTORY, and then fail to remove them once the tests are done. This change does currently affect the location of the test-results/ directory though. Signed-off-by: John Keeping <john@keeping.me.uk>
* t0109: test more URLsGravatar John Keeping2013-04-15-4/+20
| | | | | | | | | | | In order to ensure that we don't access $HOME at some point after initial startup when rendering a specific view, run the strace test on a range of different pages. This ensures that we don't end up reading a configuration later for some specific view. Signed-off-by: John Keeping <john@keeping.me.uk>
* t0107: Skip ZIP tests if unzip(1) isn't availableGravatar Lukas Fleischer2013-04-10-4/+10
| | | | | | | | Note that we cannot use skip_all here since some tests have already been executed when ZIP tests are reached. Use test prerequisites to skip everything using unzip(1) if the binary is not available instead. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* tests/: Do not use `sed -i`Gravatar Lukas Fleischer2013-04-10-5/+8
| | | | | | | "-i" isn't part of the POSIX standard and doesn't work on several platforms such as OpenBSD. Use a temporary file instead. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* t0109: chain operations with &&Gravatar John Keeping2013-04-10-1/+1
| | | | | | | | Without '&&' between operations, we will not detect if strace or cgit exit with an error status, which would cause a false positive test status in this case. Signed-off-by: John Keeping <john@keeping.me.uk>
* t0107: Use `tar -z` for gzip'ed archivesGravatar Lukas Fleischer2013-04-09-1/+1
| | | | | | | Some tar(1) versions do not support auto detection of the compression type. Explicitly specify "-z" to decompress a ".tar.gz" archive. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* tests: Make sure that git does not access $HOMEGravatar Jason A. Donenfeld2013-04-09-0/+25
| | | | | | | | | | | With the latest changes to prevent git from accessing configuration files that it should not, it's important to be sure that we won't have further breakage in the future. Use strace to implement a test to make sure cgit does not access() anything built from $HOME. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tests/.gitignore: update for using Git's test infrastructureGravatar John Keeping2013-04-09-2/+2
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* tests: use Git's test frameworkGravatar John Keeping2013-04-09-289/+234
| | | | | | | | | | | | This allows tests to run in parallel as well as letting us use "prove" or another TAP harness to run the tests. Git's test framework requires Git to be fully built before letting any tests run, so add a new target to the top-level Makefile which builds all of Git instead of just libgit.a and make the "test" target depend on that. Signed-off-by: John Keeping <john@keeping.me.uk>
* tests: check that Git version are in syncGravatar John Keeping2013-03-21-0/+36
| | | | | | | | This ensures that the Git version pointed at by the submodule is the same as the one that will be fetched using "make get-git". Suggested-by: Ferry Huberts <ferry.huberts@pelagic.nl> Signed-off-by: John Keeping <john@keeping.me.uk>
* t0107-snapshot: add tests for ZIP archivesGravatar John Keeping2013-03-05-2/+37
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* tests: make whitespace consistentGravatar John Keeping2013-03-05-14/+17
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* tests: "grep -e" is not portable to all platformsGravatar John Keeping2013-03-05-55/+55
| | | | | | | | The "-e" option to grep is not needed unless specifying more than one pattern, which we don't do. Remove it to avoid restricting the tests on platforms that do not have a grep that recognises "-e". Signed-off-by: John Keeping <john@keeping.me.uk>
* tests: check for proper html entityGravatar Jason A. Donenfeld2012-10-18-1/+1
| | | | | | | Since we're now properly writing ampersand literals as &amp; instead of as a plain &, we need to update the test accordingly. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Merge branch 'stable'Gravatar Lars Hjemli2012-03-19-3/+3
|\
| * tests: properly quote arguments to printfGravatar Ferry Huberts2012-03-18-1/+1
| | | | | | | | | | | | v2: incorporate remarks of Lukas Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
| * tests: handle paths with whitespaceGravatar Ferry Huberts2012-03-18-2/+2
| | | | | | | | | | | | v2: incorporate remarks of Lukas Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
* | Merge branch 'stable'Gravatar Lars Hjemli2011-07-21-0/+1
|\ \ | |/
| * tests: fix failures when CDPATH is setGravatar Ferry Huberts2011-07-21-0/+1
| | | | | | | | | | | | | | | | | | | | Some tests would otherwise fail because commands such as cd trash/repos/foo && git rev-list --reverse HEAD | head -1 would return 2 lines instead of 1: the 'cd' command also prints the path when CDPATH is set. Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* | cgit.c: add 'clone-url' setting with support for macro expansionGravatar Lars Hjemli2011-06-14-0/+7
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current 'clone-prefix' setting has some known issues: * All repos get the same 'clone-prefix' value since the setting is not adopted during repo registration (in cgitrc, or during scan-path traversal), but only when the setting is used. * The generated clone-urls for a repo is a combination of 'clone-prefix', a slash and the repo url. This doesn't work well with e.g. ssh-style urls like 'git@example.org:repo.git', since the inserted slash will make the repo relative to the filesystem root. * If 'remove-suffix' is enabled, the generated clone-urls will not work for cloning (except for http-urls to cgit itself) since they miss the '.git' suffix. The new 'clone-url' setting is designed to avoid the mentioned issues: * Each repo adopts the default 'clone-url' when the repo is defined. This allows different groups of repos to adopt different values. * The clone-urls for a repo is generated by expanding environment variables in a string template without inserting arbitrary characters, hence any kind of clone-url can be generated. * Macro expansion also eases the 'remove-suffix' pain since it's now possible to define e.g. 'clone-url=git://foo.org/$CGIT_REPO_URL.git' for a set of repos. A furter improvement would be to define e.g. $CGIT_REPO_SUFFIX to '.git' for all repos which had their url prettified, or to store the original $CGIT_REPO_URL in e.g. $CGIT_REPO_REAL_URL before suffix removal. Reviewed-by: Ferry Huberts <mailings@hupie.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui-log.c: do not link from age columnGravatar Lars Hjemli2011-06-02-1/+1
| | | | | | | The link url wasn't properly escaped, and since the link was identical to the one used on the commit message it didn't serve any special purpose. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* tests: add tests for links with space in path and/or argsGravatar Lars Hjemli2011-05-24-3/+19
| | | | | | | | | These tests tries to detect bad links in various pages. On the log page, there currently exists links which are not properly escaped due to the use of cgit_fileurl() when building the link. For now, this bug is simply tagged as such. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* tests/setup.sh: add support for known bugsGravatar Lars Hjemli2011-05-24-1/+13
| | | | | | | This patch makes it possible to add tests for known bugs without aborting the testrun. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* t0108-patch: add 'tests_done' to endGravatar Mark Lodato2010-08-30-0/+2
| | | | Signed-off-by: Mark Lodato <lodatom@gmail.com>
* Merge branch 'jw/commit-decorations'Gravatar Lars Hjemli2009-01-28-1/+1
|\ | | | | | | | | | | | | Conflicts: cgit.css Signed-off-by: Lars Hjemli <hjemli@gmail.com>
| * tests/t0105-commit.sh: expect commit decorationsGravatar Lars Hjemli2009-01-28-1/+1
| | | | | | | | | | | | | | | | When a commit is referenced by a branch or tag the commit subject- line will be suffixed with the proper decorations, hence the test for this line needs to be updated. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* | Merge branch 'og/tree-view-selection'Gravatar Lars Hjemli2009-01-28-2/+2
|\ \ | |/ |/| | | Signed-off-by: Lars Hjemli <hjemli@gmail.com>
| * changed objects are outputted, allowing for selections of code onlyGravatar Onne Gorter2009-01-10-2/+2
| |
* | Merge branch 'snapshot-fixes'Gravatar Lars Hjemli2009-01-11-10/+10
|\ \
| * | tests/t0107-snapshot.sh: make testscript match updated snapshot behaviorGravatar Lars Hjemli2008-12-28-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since cgit now returns a 404 error when the snapshot filename cannot be resolved to a commit object, the testscript needs to request a valid snapshot name. Also, the script assumed that the toplevel directory in the snapshot would get the name of the repository but it's now named similar to the requested snapshot. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* | | Merge branch 'lh/mimetypes'Gravatar Lars Hjemli2009-01-11-1/+1
|\ \ \ | |_|/ |/| |
| * | ui-snapshot.c: change mime-type for tar.gz and tar.bz2Gravatar Lars Hjemli2008-12-26-1/+1
| |/ | | | | | | | | | | | | The updated mime-types seems to work better than the old ones with both safari and firefox. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* | ui-tree.c: do not add blank line when displaying blobsGravatar Lars Hjemli2009-01-07-1/+1
|/ | | | | | | Also, fix a related bug in the test-suite. Noticed-by: Jim Meyering <jim@meyering.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* tests/setup.sh: allow testsuite to fail properly with POSIX standard shellsGravatar Lars Hjemli2008-12-06-1/+1
| | | | | | | The "((expr))" construct is not implemented by e.g. dash, so this commit replaces the construct with a more portable one. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* tests/t0010-validate-html.sh: skip tests if 'tidy' is not availableGravatar Lars Hjemli2008-12-06-1/+8
| | | | | Noticed-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Fix tests to work on Ubuntu (dash)Gravatar Ramsay Jones2008-11-07-2/+4
| | | | | | | | | | | | | The system shell (/bin/sh) on Ubuntu is dash, which aims to be a POSIX standard shell. In particular, dash does not implement any of the common extensions to the standard that, say, bash and ksh do. Replace some non-POSIX constructs in setup.sh with more portable and mundane code. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Merge branch 'lh/escape-urls'Gravatar Lars Hjemli2008-10-05-1/+26
|\ | | | | | | | | | | * lh/escape-urls: ui-shared.c: use html_url_arg() html.c: add html_url_arg
| * ui-shared.c: use html_url_arg()Gravatar Lars Hjemli2008-10-05-1/+26
| | | | | | | | | | | | | | | | | | The link-generating functions are updated to use the new html_url_arg function, thereby fixing links to strange repos, branches and files. Also, the test-suite is updated to verify some cases of strange urls. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* | ui-snapshot.c: specify archiver_args.baselenGravatar Lars Hjemli2008-10-05-1/+4
|/ | | | | | | | | | The struct member was introduces in git commit d53fe8187c38, but the cgit testsuite failed to detect that cgit always generated archives without prefixes, i.e. the result from cgit_repobasename was ignored. This fixes the bug and the testsuite. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* tests/Makefile: not everyone has `.` in $PATHGravatar Lars Hjemli2008-07-23-1/+1
| | | | Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Include commit-id in link from diff-statGravatar Lars Hjemli2008-05-19-1/+1
| | | | | | | This fixes a regression created by fe1230dece81450004d02fa8a470f8dab8f7fdd9, and modifies a test to avoid future regressions. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* ui-commit: handle root commitsGravatar Lars Hjemli2008-05-19-0/+15
| | | | | | | | | Both cgit_print_diff() and cgit_diff_tree() handles root commits nicely, but cgit_print_commit() forgot to check the case of 0 parents. This fixes it, and adds tests to avoid future regressions. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Redesign the caching layerGravatar Lars Hjemli2008-04-28-1/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original caching layer in cgit has no upper bound on the number of concurrent cache entries, so when cgit is traversed by a spider (like the googlebot), the cache might end up filling your disk. Also, if any error occurs in the cache layer, no content is returned to the client. This patch redesigns the caching layer to avoid these flaws by * giving the cache a bound number of slots * disabling the cache for the current request when errors occur The cache size limit is implemented by hashing the querystring (the cache lookup key) and generating a cache filename based on this hash modulo the cache size. In order to detect hash collisions, the full lookup key (i.e. the querystring) is stored in the cache file (separated from its associated content by ascii 0). The cache filename is the reversed 8-digit hexadecimal representation of hash(key) % cache_size which should make the filesystem lookup pretty fast (if directory content is indexed/sorted); reversing the representation avoids the problem where all keys have equal prefix. There is a new config option, cache-size, which sets the upper bound for the cache. Default value for this option is 0, which has the same effect as setting nocache=1 (hence nocache is now deprecated). Included in this patch is also a new testfile which verifies that the new option works as intended. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Fix segfault in patch view for root commitGravatar Lars Hjemli2008-03-18-0/+37
| | | | | | | | | | The code for patch view assumed the current commit would always have a parent, which made cgit segfault when that wasn't the case. This fixes the bug and adds a test-script for patch view which includes a test for the inital commit. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* tests/setup.sh: cleanup test script output and loggingGravatar Lars Hjemli2008-02-25-2/+8
| | | | | | | Log the complete output from each test-script in test-output.log and tell the user about the logfile when a test-script fails. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* t0010-validate.sh: return on cgit errorsGravatar Lars Hjemli2008-02-25-1/+4
| | | | | | | | | | The earlier segfault in cgit passed by unnoticed by this test-script due to the pipe between cgit and sed. There might be a more elegant solution to this problem, but my shellscript- foo is weak. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Make output from `make test` more readableGravatar Lars Hjemli2008-02-25-2/+2
| | | | Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Brown paper bag: don't use `grep -v`Gravatar Lars Hjemli2008-02-24-5/+5
| | | | | | | | | | | For some inexplicable reason I'd gotten the semantics of `grep -v` totally backwards, thinking it somehow would make the exitcode from grep indicate the non-match of the specified pattern. This fixes the broken tests and gives me a valuable lession about shell programming at the same time. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
* Add regression-test for description-less reposGravatar Lars Hjemli2008-02-24-1/+5
| | | | | | | | | | | | | | | | The segfault fixed in commit eacde43d7184452e1fdc90b982b531f1f5239923 was triggered when the html-functions manipulated string literals. One callpatch which could trigger the bug is in ui-repolist.c when repo descriptions are passed to html_ntxt(): if a repo is lacking a description, the literal string "[no description]" is used. This patch changes test/setup.sh such that the first repo has no description, and adds tests for both "[no description]" and "the bar repo" (description of the other repo) to tests/t0101-index.sh, which should be enought to catch regressions in these functions. Noticed-by: Hiroki Hattori <seagull.kamome@gmail.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>