aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/setup.sh37
-rwxr-xr-xtests/valgrind/bin/cgit12
2 files changed, 48 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
diff --git a/tests/valgrind/bin/cgit b/tests/valgrind/bin/cgit
new file mode 100755
index 0000000..dcdfbe5
--- /dev/null
+++ b/tests/valgrind/bin/cgit
@@ -0,0 +1,12 @@
1#!/bin/sh
2
3# Note that we currently use Git's suppression file and there are variables
4# $GIT_VALGRIND and $CGIT_VALGRIND which point to different places.
5exec valgrind -q --error-exitcode=126 \
6 --suppressions="$GIT_VALGRIND/default.supp" \
7 --gen-suppressions=all \
8 --leak-check=no \
9 --track-origins=yes \
10 --log-fd=4 \
11 --input-fd=4 \
12 "$CGIT_VALGRIND/../../cgit" "$@"