aboutsummaryrefslogtreecommitdiffstats
path: root/tests/setup.sh
diff options
context:
space:
mode:
authorGravatar John Keeping <john@keeping.me.uk>2013-04-09 04:12:38 (JST)
committerGravatar Jason A. Donenfeld <Jason@zx2c4.com>2014-01-13 03:33:03 (JST)
commit1b1974c45e5e23e5527aa43c4d9ece423a13dfdc (patch)
tree863ba37c8c25b917e1823ec10db6600a9b41e129 /tests/setup.sh
parent382ecf152e1bd9546f6c84ace71c62ca07f6648b (diff)
downloadcgit-1b1974c45e5e23e5527aa43c4d9ece423a13dfdc.zip
cgit-1b1974c45e5e23e5527aa43c4d9ece423a13dfdc.tar.gz
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>
Diffstat (limited to 'tests/setup.sh')
-rwxr-xr-xtests/setup.sh37
1 files changed, 36 insertions, 1 deletions
diff --git a/tests/setup.sh b/tests/setup.sh
index 1d8677a..5476ced 100755
--- a/tests/setup.sh
+++ b/tests/setup.sh
@@ -15,13 +15,48 @@
15# run_test 'repo index' 'cgit_url "/" | tidy -e' 15# run_test 'repo index' 'cgit_url "/" | tidy -e'
16# run_test 'repo summary' 'cgit_url "/foo" | tidy -e' 16# run_test 'repo summary' 'cgit_url "/foo" | tidy -e'
17 17
18# We don't want to run Git commands through Valgrind, so we filter out the
19# --valgrind option here and handle it ourselves. We copy the arguments
20# assuming that none contain a newline, although other whitespace is
21# preserved.
22LF='
23'
24test_argv=
25
26while test $# != 0
27do
28 case "$1" in
29 --va|--val|--valg|--valgr|--valgri|--valgrin|--valgrind)
30 cgit_valgrind=t
31 test_argv="$test_argv${LF}--verbose"
32 ;;
33 *)
34 test_argv="$test_argv$LF$1"
35 ;;
36 esac
37 shift
38done
39
40OLDIFS=$IFS
41IFS=$LF
42set -- $test_argv
43IFS=$OLDIFS
44
18: ${TEST_DIRECTORY=$(pwd)/../git/t} 45: ${TEST_DIRECTORY=$(pwd)/../git/t}
19: ${TEST_OUTPUT_DIRECTORY=$(pwd)} 46: ${TEST_OUTPUT_DIRECTORY=$(pwd)}
20TEST_NO_CREATE_REPO=YesPlease 47TEST_NO_CREATE_REPO=YesPlease
21. "$TEST_DIRECTORY"/test-lib.sh 48. "$TEST_DIRECTORY"/test-lib.sh
22 49
23# Prepend the directory containing cgit to PATH. 50# Prepend the directory containing cgit to PATH.
24PATH="$(pwd)/../..:$PATH" 51if test -n "$cgit_valgrind"
52then
53 GIT_VALGRIND="$TEST_DIRECTORY/valgrind"
54 CGIT_VALGRIND=$(cd ../valgrind && pwd)
55 PATH="$CGIT_VALGRIND/bin:$PATH"
56 export GIT_VALGRIND CGIT_VALGRIND
57else
58 PATH="$(pwd)/../..:$PATH"
59fi
25 60
26mkrepo() { 61mkrepo() {
27 name=$1 62 name=$1