summaryrefslogtreecommitdiffstatshomepage
path: root/tests (follow)
Commit message (Collapse)AuthorAgeLines
* tests: add tests for xz compressed snapshotsChristian Hesse2020-03-12-1/+43
| | | | Signed-off-by: Christian Hesse <mail@eworm.de>
* ui-snapshot: add support for lzip compressionHanspeter Portner2020-02-26-1/+43
| | | | | | | | | This patch adds support for lzip [1] compressed snapshots (*.tar.lz) [1] https://www.nongnu.org/lzip/ Signed-off-by: Hanspeter Portner <dev@open-music-kontrollers.ch> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tests: allow to skip git version testsChristian Hesse2020-01-13-0/+4
| | | | | | This allows to run tests non-tagged git checkout or when bisecting. Signed-off-by: Christian Hesse <mail@eworm.de>
* tests: skip tests if strace is not functionalChristian Hesse2019-12-11-0/+6
| | | | | | | | | | | | | Chances are that strace is available but not functional due to restricted permissions: strace: test_ptrace_get_syscall_info: PTRACE_TRACEME: Operation not permitted strace: ptrace(PTRACE_TRACEME, ...): Operation not permitted +++ exited with 1 +++ Just skip the tests then. Signed-off-by: Christian Hesse <mail@eworm.de>
* tests: successfully validate rc versionsChristian Hesse2019-06-05-1/+1
| | | | | | | | For testing versions the version string differs for git tag (v2.22.0-rc3) and tarball file name (2.22.0.rc3). Let's fix validation for testing versions. Signed-off-by: Christian Hesse <mail@eworm.de>
* global: spelling fixesVille Skyttä2017-10-15-5/+5
| | | | Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
* tests: allow shell to be overriddenJohn Keeping2015-08-13-1/+5
| | | | | | | | | | | On some systems (e.g. Solaris), /bin/sh is not a POSIX shell. Git already provides suitable overrides in its config.mak.uname file and we provide cgit.conf to allow the user to further change this. The code for this is taken from Git's t/Makefile, meaning that we now invoke the tests in the same way that Git does. Signed-off-by: John Keeping <john@keeping.me.uk>
* t0110: Chain together using &&Jason A. Donenfeld2015-08-12-8/+8
|
* ui-patch: match git-format-patch(1) outputJohn Keeping2014-12-28-2/+2
| | | | | | | | | | | | | Using (DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH) causes Git to emit a "---" line between the commit message and the body of the patch, which fixes a regression introduced in commit 455b598 (ui-patch.c: Use log_tree_commit() to generate diffs, 2013-08-20), prior to which we inserted the "---" line ourselves. DIFF_FORMAT_SUMMARY is added so that we match the output of git-format-patch(1) without the "-p" option. Signed-off-by: John Keeping <john@keeping.me.uk>
* t0108: modernize styleJohn Keeping2014-12-28-10/+10
| | | | | | | | * &&-chaining * use test_cmp instead of cmp * use strip_headers instead of knowing how many lines there will be Signed-off-by: John Keeping <john@keeping.me.uk>
* tests: only do lua tests if lua is compiled-inJason A. Donenfeld2014-01-20-2/+17
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* t0111: Additions and fixesLukas Fleischer2014-01-16-10/+10
| | | | | | | | | * Rename the capitalize-* filters to dump.* since they also dump the arguments. * Add full argument validation to the email filters. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* t0111: Add basic tests for Lua filtersLukas Fleischer2014-01-15-36/+63
| | | | | | | | | | | | | | | * Validate the email filter by manipulating stdin. Additional checks for all the arguments can be added in a later patch. * Add the exec prefix to all informational messages. * Rename the filter repository to filter-exec. The Git repository itself is not renamed since it can be shared amongst all filter types. * In the filter checks, check whether all arguments are passed properly instead of validating the buffer/stdin only. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* tests/: Add t0111-filter.shLukas Fleischer2014-01-14-0/+57
| | | | | | This adds basic tests for all types of exec filters. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* tests: add CGIT_TEST_OPTS variable to MakefileJohn Keeping2014-01-12-1/+1
| | | | | | | | | This allows running the entire test suite with a set of command-line options. For example: make test CGIT_TEST_OPTS=--valgrind Signed-off-by: John Keeping <john@keeping.me.uk>
* tests: add Valgrind supportJohn Keeping2014-01-12-1/+48
| | | | | | | Now running tests with the "--valgrind" option will run cgit under Valgrind instead of all Git commands. Signed-off-by: John Keeping <john@keeping.me.uk>
* Reduce line number bloat, fix hover effectPeter Wu2014-01-08-2/+2
| | | | | | | | | | | | | | | | | | | | | Currently line numbers look like (for blob view and sdiff respectively): <a class='no' id='n68' name='n68' href='#n68'>68</a> <td class='lineno'><a class='no' href='...#n1' id='n1' name='n1'>1</a></td> name=".." is unnecessary if the id attribute is set (this even applies to IE6), so drop it. (aside, in HTML5, the name attribute is gone.) The line number links can be selected through their parent classes, no need for another class "no", so drop it too. For a file with 2000 lines, this yields a saving of 40% (29% gzipped). While at it, fix the hover effect of line numbers: now the line number get a black background as was intended. Signed-off-by: Peter Wu <lekensteyn@gmail.com> Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* tests/: Add t0110-rawdiff.shLukas Fleischer2013-08-26-0/+42
| | | | | | This adds some basic tests for the /rawdiff/ command. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* t0108: Add tests for revision rangesLukas Fleischer2013-08-26-0/+17
| | | | | | Add tests to check whether generating multiple patches at once works. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* t0108: Compare output with git-format-patch(1)Lukas Fleischer2013-08-26-0/+7
| | | | Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* ui-patch.c: Add additional newline after each patchLukas Fleischer2013-08-26-2/+2
| | | | | | For consistency with git-format-patch(1). Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* t0108: Avoid unnecessary fork()Lukas Fleischer2013-08-26-1/+1
| | | | | | | Use `git rev-list --max-parents=0 HEAD` instead of `git rev-list HEAD | tail -1` to get the root commit. This works since Git 1.7.4.2. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
* cache.c: cache ls_cache output properlyJohn Keeping2013-05-22-1/+7
| | | | | | | | | By using the standard library's printf, cache_ls does not redirect its output to the cache when we change the process' stdout file descriptor to point to the cache file. Fix this by using "htmlf" in the same way that we do for writing HTTP headers. Signed-off-by: John Keeping <john@keeping.me.uk>
* tests: introduce strip_header() helper functionJohn Keeping2013-05-22-2/+10
| | | | | | | | This means that we can avoid hardcoding the number of headers we expect CGit to generate in test cases and simply remove whatever headers happen to by there when we are checking body content. Signed-off-by: John Keeping <john@keeping.me.uk>
* t0109: "function" is a bash-ismJohn Keeping2013-05-13-1/+1
| | | | | | | | | We try to stick to POSIX shell in the tests but a "function" keyword has found its way into t0109. Remove it. This makes the tests work with dash again. Signed-off-by: John Keeping <john@keeping.me.uk>
* ui-snapshot: do not access $HOMEJason A. Donenfeld2013-04-30-0/+1
| | | | | | | | | | | | It's a bit tedious to have to do this here too. If we encounter other issues with $HOME down the line, I'll look into adding some nice utility functions to handle this, or perhaps giving up on the hope that we could keep $HOME defined for scripts. This commit additionally adds a test case, should the issue surface again. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* t0001: validate Git -rcN version numbers correctlyJohn Keeping2013-04-27-1/+6
| | | | | | | | | | | | | | | When creating the GIT-VERSION-FILE that we use to test that the version of Git in git/ is the same as in the CGit Makefile, Git applies the transform "s/-/./g" to the version string. This doesn't affect released versions but does change RC version numbers such as 1.8.3-rc0. While CGit should only refer to a released Git version in general, it is useful to developers who want to test upcoming Git releases if the tests do work with RCs, so change t0001 to apply the same transform to our Makefile version before comparing it to the contents of GIT-VERSION-FILE. Signed-off-by: John Keeping <john@keeping.me.uk>
* t0001: ignore ".dirty" suffix on Git versionJohn 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 directoryJohn 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 URLsJohn 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 availableLukas 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`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 &&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 archivesLukas 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 $HOMEJason A. Donenfeld2013-04-08-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 infrastructureJohn Keeping2013-04-08-2/+2
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* tests: use Git's test frameworkJohn Keeping2013-04-08-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 syncJohn Keeping2013-03-20-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 archivesJohn Keeping2013-03-04-2/+37
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* tests: make whitespace consistentJohn Keeping2013-03-04-14/+17
| | | | Signed-off-by: John Keeping <john@keeping.me.uk>
* tests: "grep -e" is not portable to all platformsJohn Keeping2013-03-04-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 entityJason A. Donenfeld2012-10-17-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'Lars Hjemli2012-03-18-3/+3
|\
| * tests: properly quote arguments to printfFerry Huberts2012-03-18-1/+1
| | | | | | | | | | | | v2: incorporate remarks of Lukas Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
| * tests: handle paths with whitespaceFerry Huberts2012-03-18-2/+2
| | | | | | | | | | | | v2: incorporate remarks of Lukas Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
* | Merge branch 'stable'Lars Hjemli2011-07-21-0/+1
|\|
| * tests: fix failures when CDPATH is setFerry 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 expansionLars Hjemli2011-06-13-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 columnLars 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 argsLars Hjemli2011-05-23-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>