2008-04-28 09:32:42 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_description='Validate cache'
|
2008-04-28 09:32:42 +00:00
|
|
|
. ./setup.sh
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'verify cache-size=0' '
|
2008-04-28 09:32:42 +00:00
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
rm -f cache/* &&
|
2013-04-09 18:02:32 +00:00
|
|
|
sed -e "s/cache-size=1021$/cache-size=0/" cgitrc >cgitrc.tmp &&
|
|
|
|
mv -f cgitrc.tmp cgitrc &&
|
2008-04-28 09:32:42 +00:00
|
|
|
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" &&
|
2013-04-01 14:09:05 +00:00
|
|
|
ls cache >output &&
|
|
|
|
test_line_count = 0 output
|
2008-04-28 09:32:42 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'verify cache-size=1' '
|
2008-04-28 09:32:42 +00:00
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
rm -f cache/* &&
|
2013-04-09 18:02:32 +00:00
|
|
|
sed -e "s/cache-size=0$/cache-size=1/" cgitrc >cgitrc.tmp &&
|
|
|
|
mv -f cgitrc.tmp cgitrc &&
|
2008-04-28 09:32:42 +00:00
|
|
|
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" &&
|
2013-04-01 14:09:05 +00:00
|
|
|
ls cache >output &&
|
|
|
|
test_line_count = 1 output
|
2008-04-28 09:32:42 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'verify cache-size=1021' '
|
2008-04-28 09:32:42 +00:00
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
rm -f cache/* &&
|
2013-04-09 18:02:32 +00:00
|
|
|
sed -e "s/cache-size=1$/cache-size=1021/" cgitrc >cgitrc.tmp &&
|
|
|
|
mv -f cgitrc.tmp cgitrc &&
|
2008-04-28 09:32:42 +00:00
|
|
|
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" &&
|
2013-04-01 14:09:05 +00:00
|
|
|
ls cache >output &&
|
2013-05-18 17:46:39 +00:00
|
|
|
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
|
2008-04-28 09:32:42 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_done
|