diff options
Diffstat (limited to 'tests/init.sh')
-rwxr-xr-x | tests/init.sh | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/init.sh b/tests/init.sh index da743c2ab..584194f0e 100755 --- a/tests/init.sh +++ b/tests/init.sh @@ -1,6 +1,6 @@ # source this file; set up for tests -# Copyright (C) 2009-2016 Free Software Foundation, Inc. +# Copyright (C) 2009-2017 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -45,6 +45,9 @@ # Running a single test, with verbose output: # $ make check TESTS=test-foo.sh VERBOSE=yes # +# Running a single test, keeping the temporary directory: +# $ make check TESTS=test-foo.sh KEEP=yes +# # Running a single test, with single-stepping: # 1. Go into a sub-shell: # $ bash @@ -349,11 +352,15 @@ remove_tmp_ () { __st=$? cleanup_ - # cd out of the directory we're about to remove - cd "$initial_cwd_" || cd / || cd /tmp - chmod -R u+rwx "$test_dir_" - # If removal fails and exit status was to be 0, then change it to 1. - rm -rf "$test_dir_" || { test $__st = 0 && __st=1; } + if test "$KEEP" = yes; then + echo "Not removing temporary directory $test_dir_" + else + # cd out of the directory we're about to remove + cd "$initial_cwd_" || cd / || cd /tmp + chmod -R u+rwx "$test_dir_" + # If removal fails and exit status was to be 0, then change it to 1. + rm -rf "$test_dir_" || { test $__st = 0 && __st=1; } + fi exit $__st } |