Wykres commitów

75 Commity

Autor SHA1 Wiadomość Data
Christian Hesse
27a6d69ab3 tests: successfully validate rc versions
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>
2019-06-05 15:38:14 +02:00
Ville Skyttä
67d0f87050 global: spelling fixes
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2017-10-15 18:44:55 +02:00
John Keeping
2ef4edee19 tests: allow shell to be overridden
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>
2015-08-13 15:36:18 +02:00
Jason A. Donenfeld
2d386e227e t0110: Chain together using && 2015-08-12 15:16:05 +02:00
John Keeping
7552266aac ui-patch: match git-format-patch(1) output
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>
2014-12-28 14:44:44 +01:00
John Keeping
ce8f490229 t0108: modernize style
* &&-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>
2014-12-28 14:43:51 +01:00
Jason A. Donenfeld
f759cc0f08 tests: only do lua tests if lua is compiled-in
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2014-01-20 13:11:10 +01:00
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>
2014-01-16 00:53:18 +01:00
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>
2014-01-15 14:45:21 +01:00
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>
2014-01-14 13:55:53 +01:00
John Keeping
a52aaa90da tests: add CGIT_TEST_OPTS variable to Makefile
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>
2014-01-12 23:03:54 +01:00
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>
2014-01-12 19:33:03 +01:00
Peter Wu
4468ec1b15 Reduce line number bloat, fix hover effect
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>
2014-01-08 14:59:38 +01:00
Lukas Fleischer
d93cebaa18 tests/: Add t0110-rawdiff.sh
This adds some basic tests for the /rawdiff/ command.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2013-08-26 21:04:02 +02:00
Lukas Fleischer
5a8862723f t0108: Add tests for revision ranges
Add tests to check whether generating multiple patches at once works.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2013-08-26 21:03:53 +02:00
Lukas Fleischer
b5b1f0715a t0108: Compare output with git-format-patch(1)
Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2013-08-26 21:03:35 +02:00
Lukas Fleischer
840858594e ui-patch.c: Add additional newline after each patch
For consistency with git-format-patch(1).

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
2013-08-26 21:03:23 +02:00
Lukas Fleischer
370535fc70 t0108: Avoid unnecessary fork()
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>
2013-08-26 21:01:11 +02:00
John Keeping
f32a2da636 cache.c: cache ls_cache output properly
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>
2013-05-22 12:53:06 +02:00
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>
2013-05-22 12:53:06 +02:00
John Keeping
7966fd9b8e t0109: "function" is a bash-ism
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>
2013-05-13 15:16:48 +02:00
Jason A. Donenfeld
8bf4a0465e ui-snapshot: do not access $HOME
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>
2013-04-30 12:29:07 +02:00
John Keeping
8d07ad3388 t0001: validate Git -rcN version numbers correctly
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>
2013-04-27 17:21:22 +02:00
John Keeping
d483e8f569 t0001: ignore ".dirty" suffix on Git version
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>
2013-04-15 16:59:37 +02:00
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>
2013-04-15 16:59:37 +02:00
John Keeping
64f30688fa t0109: test more URLs
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>
2013-04-15 16:59:06 +02:00
Lukas Fleischer
81bf4d32b3 t0107: Skip ZIP tests if unzip(1) isn't available
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>
2013-04-10 14:49:31 +02:00
Lukas Fleischer
016364d4ed tests/: Do not use sed -i
"-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>
2013-04-10 14:49:31 +02:00
John Keeping
880223dc84 t0109: chain operations with &&
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>
2013-04-10 14:14:06 +02:00
Lukas Fleischer
410da3ac1c t0107: Use tar -z for gzip'ed archives
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>
2013-04-09 00:13:52 +02:00
Jason A. Donenfeld
dd1f0e5f1b tests: Make sure that git does not access $HOME
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>
2013-04-08 22:53:07 +02:00
John Keeping
9844c60755 tests/.gitignore: update for using Git's test infrastructure
Signed-off-by: John Keeping <john@keeping.me.uk>
2013-04-08 22:27:53 +02:00
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>
2013-04-08 22:27:11 +02:00
John Keeping
e1e0e038fd tests: check that Git version are in sync
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>
2013-03-20 21:06:50 +01:00
John Keeping
d5a43b429a t0107-snapshot: add tests for ZIP archives
Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-04 19:41:26 -05:00
John Keeping
f9b801a174 tests: make whitespace consistent
Signed-off-by: John Keeping <john@keeping.me.uk>
2013-03-04 19:39:07 -05:00
John Keeping
392e07d28a tests: "grep -e" is not portable to all platforms
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>
2013-03-04 19:38:44 -05:00
Jason A. Donenfeld
1cb8b494a5 tests: check for proper html entity
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>
2012-10-17 17:18:35 +02:00
Lars Hjemli
08352c7a02 Merge branch 'stable' 2012-03-18 20:23:30 +00:00
Ferry Huberts
561959cffa tests: properly quote arguments to printf
v2: incorporate remarks of Lukas

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
2012-03-18 10:54:50 +00:00
Ferry Huberts
f8492f79a3 tests: handle paths with whitespace
v2: incorporate remarks of Lukas

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
2012-03-18 10:54:42 +00:00
Lars Hjemli
73e13e2bf7 Merge branch 'stable' 2011-07-21 12:50:07 +00:00
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>
2011-07-21 12:48:37 +00:00
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>
2011-06-13 23:04:30 +00:00
Lars Hjemli
d885158f6a ui-log.c: do not link from age column
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>
2011-06-02 10:30:26 +00:00
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>
2011-05-23 22:58:35 +02:00
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>
2011-05-23 22:58:35 +02:00
Mark Lodato
c94414a4c8 t0108-patch: add 'tests_done' to end
Signed-off-by: Mark Lodato <lodatom@gmail.com>
2010-08-29 17:27:40 +02:00
Lars Hjemli
dfc4c82aad Merge branch 'jw/commit-decorations'
Conflicts:
	cgit.css

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
2009-01-27 23:00:40 +01:00
Lars Hjemli
38fde35f9a tests/t0105-commit.sh: expect commit decorations
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>
2009-01-27 22:59:23 +01:00