s3:tests: Create a temporary directory for test_veto_files.sh
authorAndreas Schneider <asn@samba.org>
Wed, 19 Apr 2023 18:45:52 +0000 (20:45 +0200)
committerJule Anger <janger@samba.org>
Fri, 28 Apr 2023 14:16:11 +0000 (14:16 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15360

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit b5a66840e3057cbff85fe6cd231310c4a9cfb34b)

source3/script/tests/test_veto_files.sh

index 5ecfb53b8a41e52bf1fceab28c550b8865a88a11..e246e864b322134f5d97c4c3c59eae58072923ba 100755 (executable)
@@ -29,6 +29,10 @@ incdir=$(dirname "$0")/../../../testprogs/blackbox
 
 failed=0
 
+TMPDIR=${PREFIX_ABS}/$(basename "${0}")
+mkdir -p "${TMPDIR}" || exit 1
+cd "${TMPDIR}" || exit 1
+
 #
 # Cleanup function.
 #
@@ -51,7 +55,7 @@ smbclient_get_expect_error()
 {
        filename1="$1"
        expected_error="$2"
-       tmpfile=$PREFIX/smbclient_interactive_prompt_commands
+       tmpfile=${TMPDIR}/smbclient_interactive_prompt_commands
        cat >"$tmpfile" <<EOF
 get $filename1 got_file
 quit
@@ -88,7 +92,7 @@ smbclient_create_expect_error()
 {
        filename="$1.$$"
        expected_error="$2"
-       tmpfile=$PREFIX/smbclient_interactive_prompt_commands
+       tmpfile=${TMPDIR}/smbclient_interactive_prompt_commands
        cat >"$tmpfile" <<EOF
 put $tmpfile $filename
 quit
@@ -245,4 +249,6 @@ testit "get_veto_file" test_get_veto_file || failed=$(("$failed" + 1))
 
 do_cleanup
 
+cd "${PREFIX_ABS}" && rm -rf ${TMPDIR}
+
 exit "$failed"