ctdb-tests: Improve portability by not using mktemp --tmpdir option
authorMartin Schwenke <martin@meltin.net>
Sun, 1 Jul 2018 03:28:40 +0000 (13:28 +1000)
committerMartin Schwenke <martins@samba.org>
Sat, 28 Jul 2018 01:50:10 +0000 (03:50 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/cunit/pidfile_test_001.sh
ctdb/tests/cunit/run_event_001.sh
ctdb/tests/cunit/run_proc_001.sh
ctdb/tests/eventscripts/13.per_ip_routing.024.sh
ctdb/tests/scripts/integration.bash

index 620682e5f0c9bb64b5bd45920ca0d0edca93af5a..fb80d62cf6fdbb668efad7db9c26aa44d79ea9e6 100755 (executable)
@@ -2,7 +2,7 @@
 
 . "${TEST_SCRIPTS_DIR}/unit.sh"
 
-pidfile=$(mktemp --tmpdir="$TEST_VAR_DIR")
+pidfile=$(TMPDIR="$TEST_VAR_DIR" mktemp)
 
 ok_null
 unit_test pidfile_test $pidfile
index f8f74fbf23acda375fe008a72096ef92707c1752..6735fcbf33e653a4ff31ca35383a10322fb3473d 100755 (executable)
@@ -8,7 +8,7 @@ run_event_init() failed, ret=2
 EOF
 unit_test run_event_test /a/b/c list
 
-scriptdir=$(mktemp -d --tmpdir="$TEST_VAR_DIR")
+scriptdir=$(TMPDIR="$TEST_VAR_DIR" mktemp -d)
 
 # Empty directory
 ok <<EOF
index b817637e574b6afafd86e6e5141fd2dace08a5d1..e2fde88612e78f83e735cdec00a4e07c71ec657c 100755 (executable)
@@ -9,7 +9,7 @@ EOF
 unit_test run_proc_test 0 -1 /a/b/c
 
 # Non-executable path
-prog=$(mktemp --tmpdir="$TEST_VAR_DIR")
+prog=$(TMPDIR="$TEST_VAR_DIR" mktemp)
 cat > "$prog" <<EOF
 echo hello
 EOF
@@ -49,7 +49,7 @@ EOF
 unit_test run_proc_test 5 -1 "$prog"
 
 # Redirected output
-output=$(mktemp --tmpdir="$TEST_VAR_DIR")
+output=$(TMPDIR="$TEST_VAR_DIR" mktemp)
 cat > "$prog" <<EOF
 #!/bin/sh
 exec >"$output" 2>&1
@@ -110,7 +110,7 @@ EOF
 unit_test run_proc_test 1 -1 "$prog"
 
 # No zombie processes
-pidfile=$(mktemp --tmpdir="$TEST_VAR_DIR")
+pidfile=$(TMPDIR="$TEST_VAR_DIR" mktemp)
 
 cat > "$prog" <<EOF
 #!/bin/sh
index 61a9b52cb79479e228baa2d99a644a97efa7ced9..809573d0936c3bd2b80884a8f7a48f88fa236bb3 100755 (executable)
@@ -9,7 +9,7 @@ setup
 create_policy_routing_config 1 default
 
 _rt_tables="$CTDB_SYS_ETCDIR/iproute2/rt_tables"
-_rt_orig=$(mktemp --tmpdir="$EVENTSCRIPTS_TESTS_VAR_DIR")
+_rt_orig=$(TMPDIR="$EVENTSCRIPTS_TESTS_VAR_DIR" mktemp)
 cp "$_rt_tables" "$_rt_orig"
 
 ctdb_get_1_public_address | {
index c3c573c96223bf4c26517b15e438eabdda02f9c7..3750c442eba2da186eb1826372edfb62f179c188 100644 (file)
@@ -633,7 +633,7 @@ nfs_test_setup ()
     nfs_first_export=$(showmount -e $test_ip | sed -n -e '2s/ .*//p')
 
     echo "Creating test subdirectory..."
-    try_command_on_node $test_node "mktemp -d --tmpdir=$nfs_first_export"
+    try_command_on_node $test_node "TMPDIR=$nfs_first_export mktemp -d"
     nfs_test_dir="$out"
     try_command_on_node $test_node "chmod 777 $nfs_test_dir"