Commit Graph

28 Commits (master)

Author SHA1 Message Date
Christian Hesse adcc4f822f tests: try with commit-graph
Git 2.24.0 enabled commit-graph by default and caused crashes without
necessary update. Let's test to work with commit-graph.

Signed-off-by: Christian Hesse <mail@eworm.de>
4 years ago
Christian Hesse 892ba8c3cc ui-snapshot: add support for zstd compression
This patch adds support for zstd [0] compressed snapshots (*.tar.zst).
We enable multiple working threads (-T0), but keep default compression
level. The latter can be influenced by environment variable.

[0] https://www.zstd.net/

Signed-off-by: Christian Hesse <mail@eworm.de>
4 years ago
Christian Hesse cc230bf044 tests: add tests for xz compressed snapshots
Signed-off-by: Christian Hesse <mail@eworm.de>
4 years ago
Hanspeter Portner 06671f4b21 ui-snapshot: add support for lzip compression
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>
4 years ago
Jason A. Donenfeld f759cc0f08 tests: only do lua tests if lua is compiled-in
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
10 years ago
Lukas Fleischer 3741254a69 t0111: Additions and fixes
* 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>
10 years ago
Lukas Fleischer caf557a2ba t0111: Add basic tests for Lua filters
* 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>
10 years ago
Lukas Fleischer ce56d89a26 tests/: Add t0111-filter.sh
This adds basic tests for all types of exec filters.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
10 years ago
John Keeping 1b1974c45e tests: add Valgrind support
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>
10 years ago
John Keeping 75bfec6448 tests: introduce strip_header() helper function
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>
11 years ago
John Keeping 31f56fc1ec tests: set TEST_OUTPUT_DIRECTORY to the CGit test directory
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>
11 years ago
John Keeping c95cc5ec56 tests: use Git's test framework
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>
11 years ago
Lars Hjemli 08352c7a02 Merge branch 'stable' 12 years ago
Ferry Huberts 561959cffa tests: properly quote arguments to printf
v2: incorporate remarks of Lukas

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
12 years ago
Ferry Huberts f8492f79a3 tests: handle paths with whitespace
v2: incorporate remarks of Lukas

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
12 years ago
Lars Hjemli 73e13e2bf7 Merge branch 'stable' 13 years ago
Ferry Huberts 877ff68100 tests: fix failures when CDPATH is set
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>
13 years ago
Lars Hjemli a1429dbc89 cgit.c: add 'clone-url' setting with support for macro expansion
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>
13 years ago
Lars Hjemli 084ca50972 tests: add tests for links with space in path and/or args
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>
13 years ago
Lars Hjemli afe04daa33 tests/setup.sh: add support for known bugs
This patch makes it possible to add tests for known bugs without aborting
the testrun.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
13 years ago
Lars Hjemli b6faa78091 tests/setup.sh: allow testsuite to fail properly with POSIX standard shells
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>
16 years ago
Ramsay Jones e4d2f2b042 Fix tests to work on Ubuntu (dash)
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>
16 years ago
Lars Hjemli b575115d9d ui-shared.c: use html_url_arg()
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>
16 years ago
Lars Hjemli 939d32fda7 Redesign the caching layer
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>
16 years ago
Lars Hjemli 538cb4a7d7 tests/setup.sh: cleanup test script output and logging
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>
16 years ago
Lars Hjemli b44b02a982 Make output from `make test` more readable
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
16 years ago
Lars Hjemli 19134112bf Add regression-test for description-less repos
The segfault fixed in commit eacde43d71 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>
16 years ago
Lars Hjemli b4649fc905 Create initial testsuite
This creates a simple testsuite, heavily inspired by the testsuite in git.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
17 years ago