diff options
author | Vincent Ambo <Vincent Ambo> | 2020-01-11T23·30+0000 |
---|---|---|
committer | Vincent Ambo <Vincent Ambo> | 2020-01-11T23·31+0000 |
commit | 5a069d588820da31134d435268bca1cd1532783a (patch) | |
tree | dcfee961700d80d0a30848818a2f07934af264a2 /third_party/cgit/tests/t0020-validate-cache.sh | |
parent | 829de752da8039c7e3dab99db06d4e2112ca6ef4 (diff) | |
parent | 723dc8fbcb1a4609c264758eae420ee2811a2b55 (diff) |
merge(third_party/cgit): Import at master of 2020-01-11 r/371
Imported commit '723dc8fbcb1a4609c264758eae420ee2811a2b55' as 'third_party/cgit'.
Diffstat (limited to 'third_party/cgit/tests/t0020-validate-cache.sh')
-rwxr-xr-x | third_party/cgit/tests/t0020-validate-cache.sh | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/third_party/cgit/tests/t0020-validate-cache.sh b/third_party/cgit/tests/t0020-validate-cache.sh new file mode 100755 index 000000000000..657765d897b5 --- /dev/null +++ b/third_party/cgit/tests/t0020-validate-cache.sh @@ -0,0 +1,78 @@ +#!/bin/sh + +test_description='Validate cache' +. ./setup.sh + +test_expect_success 'verify cache-size=0' ' + + rm -f cache/* && + sed -e "s/cache-size=1021$/cache-size=0/" cgitrc >cgitrc.tmp && + mv -f cgitrc.tmp cgitrc && + cgit_url "" && + cgit_url "foo" && + cgit_url "foo/refs" && + cgit_url "foo/tree" && + cgit_url "foo/log" && + cgit_url "foo/diff" && + cgit_url "foo/patch" && + cgit_url "bar" && + cgit_url "bar/refs" && + cgit_url "bar/tree" && + cgit_url "bar/log" && + cgit_url "bar/diff" && + cgit_url "bar/patch" && + ls cache >output && + test_line_count = 0 output +' + +test_expect_success 'verify cache-size=1' ' + + rm -f cache/* && + sed -e "s/cache-size=0$/cache-size=1/" cgitrc >cgitrc.tmp && + mv -f cgitrc.tmp cgitrc && + cgit_url "" && + cgit_url "foo" && + cgit_url "foo/refs" && + cgit_url "foo/tree" && + cgit_url "foo/log" && + cgit_url "foo/diff" && + cgit_url "foo/patch" && + cgit_url "bar" && + cgit_url "bar/refs" && + cgit_url "bar/tree" && + cgit_url "bar/log" && + cgit_url "bar/diff" && + cgit_url "bar/patch" && + ls cache >output && + test_line_count = 1 output +' + +test_expect_success 'verify cache-size=1021' ' + + rm -f cache/* && + sed -e "s/cache-size=1$/cache-size=1021/" cgitrc >cgitrc.tmp && + mv -f cgitrc.tmp cgitrc && + cgit_url "" && + cgit_url "foo" && + cgit_url "foo/refs" && + cgit_url "foo/tree" && + cgit_url "foo/log" && + cgit_url "foo/diff" && + cgit_url "foo/patch" && + cgit_url "bar" && + cgit_url "bar/refs" && + cgit_url "bar/tree" && + cgit_url "bar/log" && + cgit_url "bar/diff" && + cgit_url "bar/patch" && + ls cache >output && + test_line_count = 13 output && + cgit_url "foo/ls_cache" >output.full && + strip_headers <output.full >output && + test_line_count = 13 output && + # Check that ls_cache output is cached correctly + cgit_url "foo/ls_cache" >output.second && + test_cmp output.full output.second +' + +test_done |