diff options
| author | John Keeping | 2013-04-08 20:12:38 +0100 |
|---|---|---|
| committer | Jason A. Donenfeld | 2014-01-12 19:33:03 +0100 |
| commit | 1b1974c45e5e23e5527aa43c4d9ece423a13dfdc (patch) | |
| tree | 863ba37c8c25b917e1823ec10db6600a9b41e129 /tests/setup.sh | |
| parent | 382ecf152e1bd9546f6c84ace71c62ca07f6648b (diff) | |
| download | cgit-1b1974c45e5e23e5527aa43c4d9ece423a13dfdc.tar.gz cgit-1b1974c45e5e23e5527aa43c4d9ece423a13dfdc.tar.bz2 cgit-1b1974c45e5e23e5527aa43c4d9ece423a13dfdc.zip | |
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-x | tests/setup.sh | 37 |
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. | ||
| 22 | LF=' | ||
| 23 | ' | ||
| 24 | test_argv= | ||
| 25 | |||
| 26 | while test $# != 0 | ||
| 27 | do | ||
| 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 | ||
| 38 | done | ||
| 39 | |||
| 40 | OLDIFS=$IFS | ||
| 41 | IFS=$LF | ||
| 42 | set -- $test_argv | ||
| 43 | IFS=$OLDIFS | ||
| 44 | |||
| 18 | : ${TEST_DIRECTORY=$(pwd)/../git/t} | 45 | : ${TEST_DIRECTORY=$(pwd)/../git/t} |
| 19 | : ${TEST_OUTPUT_DIRECTORY=$(pwd)} | 46 | : ${TEST_OUTPUT_DIRECTORY=$(pwd)} |
| 20 | TEST_NO_CREATE_REPO=YesPlease | 47 | TEST_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. |
| 24 | PATH="$(pwd)/../..:$PATH" | 51 | if test -n "$cgit_valgrind" |
| 52 | then | ||
| 53 | GIT_VALGRIND="$TEST_DIRECTORY/valgrind" | ||
| 54 | CGIT_VALGRIND=$(cd ../valgrind && pwd) | ||
| 55 | PATH="$CGIT_VALGRIND/bin:$PATH" | ||
| 56 | export GIT_VALGRIND CGIT_VALGRIND | ||
| 57 | else | ||
| 58 | PATH="$(pwd)/../..:$PATH" | ||
| 59 | fi | ||
| 25 | 60 | ||
| 26 | mkrepo() { | 61 | mkrepo() { |
| 27 | name=$1 | 62 | name=$1 |
