diff options
author | John Keeping <john@keeping.me.uk> | 2013-04-01 23:09:05 (JST) |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2013-04-09 05:27:11 (JST) |
commit | c95cc5ec56dbb7394015eb18201403be6d80f69b (patch) | |
tree | 7014b96a1a1408b5291532c0c442082aba693a80 /tests/t0020-validate-cache.sh | |
parent | 8a92df033e974af6338b530a0d78d1bdb0b0f918 (diff) | |
download | cgit-c95cc5ec56dbb7394015eb18201403be6d80f69b.zip cgit-c95cc5ec56dbb7394015eb18201403be6d80f69b.tar.gz |
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>
Diffstat (limited to 'tests/t0020-validate-cache.sh')
-rwxr-xr-x | tests/t0020-validate-cache.sh | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/tests/t0020-validate-cache.sh b/tests/t0020-validate-cache.sh index 53ec2eb..1910b47 100755 --- a/tests/t0020-validate-cache.sh +++ b/tests/t0020-validate-cache.sh | |||
@@ -1,13 +1,12 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | test_description='Validate cache' | ||
3 | . ./setup.sh | 4 | . ./setup.sh |
4 | 5 | ||
5 | prepare_tests 'Validate cache' | 6 | test_expect_success 'verify cache-size=0' ' |
6 | 7 | ||
7 | run_test 'verify cache-size=0' ' | 8 | rm -f cache/* && |
8 | 9 | sed -i -e "s/cache-size=1021$/cache-size=0/" cgitrc && | |
9 | rm -f trash/cache/* && | ||
10 | sed -i -e "s/cache-size=1021$/cache-size=0/" trash/cgitrc && | ||
11 | cgit_url "" && | 10 | cgit_url "" && |
12 | cgit_url "foo" && | 11 | cgit_url "foo" && |
13 | cgit_url "foo/refs" && | 12 | cgit_url "foo/refs" && |
@@ -21,13 +20,14 @@ run_test 'verify cache-size=0' ' | |||
21 | cgit_url "bar/log" && | 20 | cgit_url "bar/log" && |
22 | cgit_url "bar/diff" && | 21 | cgit_url "bar/diff" && |
23 | cgit_url "bar/patch" && | 22 | cgit_url "bar/patch" && |
24 | test 0 -eq $(ls trash/cache | wc -l) | 23 | ls cache >output && |
24 | test_line_count = 0 output | ||
25 | ' | 25 | ' |
26 | 26 | ||
27 | run_test 'verify cache-size=1' ' | 27 | test_expect_success 'verify cache-size=1' ' |
28 | 28 | ||
29 | rm -f trash/cache/* && | 29 | rm -f cache/* && |
30 | sed -i -e "s/cache-size=0$/cache-size=1/" trash/cgitrc && | 30 | sed -i -e "s/cache-size=0$/cache-size=1/" cgitrc && |
31 | cgit_url "" && | 31 | cgit_url "" && |
32 | cgit_url "foo" && | 32 | cgit_url "foo" && |
33 | cgit_url "foo/refs" && | 33 | cgit_url "foo/refs" && |
@@ -41,13 +41,14 @@ run_test 'verify cache-size=1' ' | |||
41 | cgit_url "bar/log" && | 41 | cgit_url "bar/log" && |
42 | cgit_url "bar/diff" && | 42 | cgit_url "bar/diff" && |
43 | cgit_url "bar/patch" && | 43 | cgit_url "bar/patch" && |
44 | test 1 -eq $(ls trash/cache | wc -l) | 44 | ls cache >output && |
45 | test_line_count = 1 output | ||
45 | ' | 46 | ' |
46 | 47 | ||
47 | run_test 'verify cache-size=1021' ' | 48 | test_expect_success 'verify cache-size=1021' ' |
48 | 49 | ||
49 | rm -f trash/cache/* && | 50 | rm -f cache/* && |
50 | sed -i -e "s/cache-size=1$/cache-size=1021/" trash/cgitrc && | 51 | sed -i -e "s/cache-size=1$/cache-size=1021/" cgitrc && |
51 | cgit_url "" && | 52 | cgit_url "" && |
52 | cgit_url "foo" && | 53 | cgit_url "foo" && |
53 | cgit_url "foo/refs" && | 54 | cgit_url "foo/refs" && |
@@ -61,7 +62,8 @@ run_test 'verify cache-size=1021' ' | |||
61 | cgit_url "bar/log" && | 62 | cgit_url "bar/log" && |
62 | cgit_url "bar/diff" && | 63 | cgit_url "bar/diff" && |
63 | cgit_url "bar/patch" && | 64 | cgit_url "bar/patch" && |
64 | test 13 -eq $(ls trash/cache | wc -l) | 65 | ls cache >output && |
66 | test_line_count = 13 output | ||
65 | ' | 67 | ' |
66 | 68 | ||
67 | tests_done | 69 | test_done |