summaryrefslogtreecommitdiffstats
path: root/tests/ts
diff options
context:
space:
mode:
authorKarel Zak2014-05-07 09:21:52 +0200
committerKarel Zak2014-05-07 09:21:52 +0200
commitc571e61969ec1e38b9aa84a1871c7e2266123ad4 (patch)
tree11815a6322319b4d80733f9c20dab7942d03ec4d /tests/ts
parentlib/boottime: add a new file (diff)
parenttests: fix kill problems (diff)
downloadkernel-qcow2-util-linux-c571e61969ec1e38b9aa84a1871c7e2266123ad4.tar.gz
kernel-qcow2-util-linux-c571e61969ec1e38b9aa84a1871c7e2266123ad4.tar.xz
kernel-qcow2-util-linux-c571e61969ec1e38b9aa84a1871c7e2266123ad4.zip
Merge branch 'kill-tests' of https://github.com/rudimeier/util-linux
Diffstat (limited to 'tests/ts')
-rwxr-xr-xtests/ts/kill/all_processes7
-rw-r--r--tests/ts/kill/kill_functions.sh5
-rwxr-xr-xtests/ts/kill/name_to_number7
-rwxr-xr-xtests/ts/kill/options6
-rwxr-xr-xtests/ts/kill/print_pid6
5 files changed, 18 insertions, 13 deletions
diff --git a/tests/ts/kill/all_processes b/tests/ts/kill/all_processes
index af863d56a..93f78ad60 100755
--- a/tests/ts/kill/all_processes
+++ b/tests/ts/kill/all_processes
@@ -25,9 +25,8 @@ ts_check_test_command "$TS_HELPER_SIGRECEIVE"
. "$TS_SELF/kill_functions.sh"
-HELPER_SYMLINK="$TS_CWD/$(mktemp -u XXXXXXXXXXXXXXX)"
-ln -s "$TS_HELPER_SIGRECEIVE" "$HELPER_SYMLINK"
-trap "rm -f $HELPER_SYMLINK" 0
+HELPER_SYMLINK="$(mktemp "${TS_OUTDIR}/alXXXXXXXXXXXXX")"
+ln -sf "$TS_HELPER_SIGRECEIVE" "$HELPER_SYMLINK"
"$HELPER_SYMLINK" -s "$TS_TESTUSER" >> "$TS_OUTPUT" 2>&1 &
TEST_PID=$!
@@ -53,4 +52,6 @@ fi
sed -i "s/${HELPER_SYMLINK##*/}/${TS_HELPER_SIGRECEIVE##*/}/" "$TS_OUTPUT"
+rm -f "$HELPER_SYMLINK"
+
ts_finalize
diff --git a/tests/ts/kill/kill_functions.sh b/tests/ts/kill/kill_functions.sh
index 043b4cb4f..73fff053d 100644
--- a/tests/ts/kill/kill_functions.sh
+++ b/tests/ts/kill/kill_functions.sh
@@ -1,11 +1,14 @@
+# unfortunately we are using gawk features
+type gawk >/dev/null 2>&1 || ts_skip "cannot find gawk"
+
# The test_sigreceive is ready when signal process mask contains SIGHUP
function check_test_sigreceive {
local rc=0
local pid=$1
for i in 0.01 0.1 1 1 1 1; do
- awk 'BEGIN { retval=1 }
+ gawk 'BEGIN { retval=1 }
/^SigCgt/ {
lbyte = strtonum("0x" substr($2, 16, 16))
if (and(lbyte, 1)) {
diff --git a/tests/ts/kill/name_to_number b/tests/ts/kill/name_to_number
index a57ed852e..9a370bbcc 100755
--- a/tests/ts/kill/name_to_number
+++ b/tests/ts/kill/name_to_number
@@ -24,8 +24,9 @@ ts_check_test_command "$TS_HELPER_SIGRECEIVE"
. "$TS_SELF/kill_functions.sh"
all_ok=true
-HELPER_SYMLINK="$TS_OUTDIR/$(mktemp -u XXXXXXXXXXXXXXX)"
-ln -s "$TS_HELPER_SIGRECEIVE" "$HELPER_SYMLINK"
+
+HELPER_SYMLINK="$(mktemp "${TS_OUTDIR}/naXXXXXXXXXXXXX")"
+ln -sf "$TS_HELPER_SIGRECEIVE" "$HELPER_SYMLINK"
for SIG in $($TS_CMD_KILL -L); do
if [ "x${SIG//[0-9]/}" = "x" ]; then
@@ -56,7 +57,7 @@ for SIG in $($TS_CMD_KILL -L); do
done
if $all_ok; then
- echo 'all ok' >> $TS_OUTPUT
+ echo 'all ok' >> "$TS_OUTPUT"
fi
rm -f "$HELPER_SYMLINK"
diff --git a/tests/ts/kill/options b/tests/ts/kill/options
index 413037c21..6cdaa24d4 100755
--- a/tests/ts/kill/options
+++ b/tests/ts/kill/options
@@ -25,9 +25,8 @@ ts_check_test_command "$TS_HELPER_SIGRECEIVE"
all_ok=true
-HELPER_SYMLINK="$TS_OUTDIR/$(mktemp -u XXXXXXXXXXXXXXX)"
-ln -s "$TS_HELPER_SIGRECEIVE" "$HELPER_SYMLINK"
-trap "rm -f $HELPER_SYMLINK" 0
+HELPER_SYMLINK="$(mktemp "${TS_OUTDIR}/opXXXXXXXXXXXXX")"
+ln -sf "$TS_HELPER_SIGRECEIVE" "$HELPER_SYMLINK"
try_option()
{
@@ -61,5 +60,6 @@ try_option -SIGHUP
if $all_ok; then
echo 'all ok' >> "$TS_OUTPUT"
fi
+rm -f "$HELPER_SYMLINK"
ts_finalize
diff --git a/tests/ts/kill/print_pid b/tests/ts/kill/print_pid
index 4da8b4509..1b3052bb8 100755
--- a/tests/ts/kill/print_pid
+++ b/tests/ts/kill/print_pid
@@ -25,9 +25,8 @@ ts_check_test_command "$TS_HELPER_SIGRECEIVE"
all_ok=true
-HELPER_SYMLINK="$TS_OUTDIR/$(mktemp -u XXXXXXXXXXXXXXX)"
-ln -s "$TS_HELPER_SIGRECEIVE" "$HELPER_SYMLINK"
-trap "rm -f $HELPER_SYMLINK" 0
+HELPER_SYMLINK="$(mktemp "${TS_OUTDIR}/prXXXXXXXXXXXXX")"
+ln -sf "$TS_HELPER_SIGRECEIVE" "$HELPER_SYMLINK"
"$HELPER_SYMLINK" >> "$TS_OUTPUT" 2>&1 &
TEST_PID=$!
@@ -54,5 +53,6 @@ fi
if $all_ok; then
echo 'all ok' >> "$TS_OUTPUT"
fi
+rm -f "$HELPER_SYMLINK"
ts_finalize