diff options
author | Taylor R Campbell <campbell+tor@mumble.net> | 2018-11-22 00:53:57 +0000 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2018-11-23 12:51:39 -0500 |
commit | 997a8b0ca7a4f4eafa2cd09582c4bcc0507e2fa6 (patch) | |
tree | 8fa6285a3a97104149ff1407a3ce5f52a26a5eee /src/test/test_rebind.sh | |
parent | 3741f9e524a2d3bd7239ca865d6169fd1e3dddb5 (diff) | |
download | tor-997a8b0ca7a4f4eafa2cd09582c4bcc0507e2fa6.tar.gz tor-997a8b0ca7a4f4eafa2cd09582c4bcc0507e2fa6.zip |
Create a temporary directory for tor's DataDirectory in test_rebind.
Fixes #28562.
While here, put the argument count test and usage message _before_ we
attempt to read from sys.argv.
Diffstat (limited to 'src/test/test_rebind.sh')
-rwxr-xr-x | src/test/test_rebind.sh | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/test/test_rebind.sh b/src/test/test_rebind.sh index 76eb9f2e4d..498072de35 100755 --- a/src/test/test_rebind.sh +++ b/src/test/test_rebind.sh @@ -14,6 +14,19 @@ fi exitcode=0 -"${PYTHON:-python}" "${abs_top_srcdir:-.}/src/test/test_rebind.py" "${TESTING_TOR_BINARY}" || exitcode=1 +tmpdir= +clean () { test -n "$tmpdir" && test -d "$tmpdir" && rm -rf "$tmpdir" || :; } +trap clean EXIT HUP INT TERM + +tmpdir="`mktemp -d -t tor_rebind_test.XXXXXX`" +if [ -z "$tmpdir" ]; then + echo >&2 mktemp failed + exit 2 +elif [ ! -d "$tmpdir" ]; then + echo >&2 mktemp failed to make a directory + exit 3 +fi + +"${PYTHON:-python}" "${abs_top_srcdir:-.}/src/test/test_rebind.py" "${TESTING_TOR_BINARY}" "$tmpdir" || exitcode=1 exit ${exitcode} |