]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: directly check exitcode for stability and code simplicity
authorChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Fri, 10 Apr 2026 17:47:30 +0000 (13:47 -0400)
committerChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Mon, 4 May 2026 11:31:08 +0000 (07:31 -0400)
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
35 files changed:
tests/run.sh
tests/ts/blkdiscard/offsets
tests/ts/choom/choom
tests/ts/chrt/chrt
tests/ts/copyfilerange/copyfilerange
tests/ts/cramfs/mkfs
tests/ts/getopt/basic
tests/ts/hwclock/systohc
tests/ts/kill/options
tests/ts/kill/pidfdino
tests/ts/kill/print_pid
tests/ts/kill/queue
tests/ts/libmount/context
tests/ts/libmount/context-py
tests/ts/libmount/context-utab
tests/ts/libmount/context-utab-py
tests/ts/lslogins/checkuser
tests/ts/lslogins/json_mode
tests/ts/misc/canonicalize
tests/ts/mount/fallback
tests/ts/mount/fstab-all
tests/ts/mount/fstab-bind
tests/ts/mount/fstab-broken
tests/ts/mount/fstab-none
tests/ts/mount/remount
tests/ts/mount/shared-subtree
tests/ts/mount/special
tests/ts/mount/umount-alltargets
tests/ts/mount/umount-recursive
tests/ts/pipesz/pipesz
tests/ts/setarch/setarch
tests/ts/su/environ
tests/ts/su/group
tests/ts/uuidd/uuidd
tests/ts/uuidgen/uuidgen

index 3d26bea31eedfc9949f6845dce025d0856d33fd0..52a4635991b55404c7bb7fd11b714fbf10b3f479 100755 (executable)
@@ -245,11 +245,10 @@ fi
 
 mkdir -p "$top_builddir"/tests/
 >| $top_builddir/tests/failures
-printf "%s\n" ${comps[*]} |
-       sort |
-       xargs -I '{}' -P $paraller_jobs -n 1 bash -c "'{}' \"$OPTS\" ||
-               echo '{}' >> $top_builddir/tests/failures"
-if [ $? != 0 ]; then
+
+if ! printf "%s\n" "${comps[@]}" | sort | xargs -I '{}' -P $paraller_jobs -n 1 bash -c "'{}' \"$OPTS\" \
+               || echo '{}' >> $top_builddir/tests/failures"; then
+
        echo "xargs error" >&2
        exit 1
 fi
index 89925bc422d69d507cb9725bf0e3ea81b5f00f04..a74d1171be14e46f147e7e2899726ea9e16ef49f 100755 (executable)
@@ -51,6 +51,7 @@ if [ "$?" != "0" ]; then
        grep -q "BLKDISCARD ioctl failed: Operation not supported" "$TS_ERRLOG" \
                && ts_skip "BLKDISCARD not supported"
 fi
+
 run_tscmd $TS_CMD_BLKDISCARD -v --offset 1 $DEVICE
 run_tscmd $TS_CMD_BLKDISCARD -v -o 511 $DEVICE
 run_tscmd $TS_CMD_BLKDISCARD -v -o 512 $DEVICE
index 054c87cc4d28a36a63a08d1a32af65bf859db9eb..f333ed286cb220566becb1dff034639adbddcd73 100755 (executable)
@@ -30,9 +30,7 @@ oom_score_adj=$("$TS_CMD_CHOOM" --pid $PID \
 
 (( oom_score_adj++ ))
 
-"$TS_CMD_CHOOM" --pid $PID --adjust $oom_score_adj &>/dev/null
-
-if [[ "$?" != 0 ]]; then
+if ! "$TS_CMD_CHOOM" --pid $PID --adjust $oom_score_adj &>/dev/null; then
         ts_failed "OOM adjust score change failed"
 fi
 
@@ -44,4 +42,4 @@ if (( "$new_oom_score_adj" == "$oom_score_adj" )); then
         echo "ok" >> "$TS_OUTPUT"
 fi
 
-ts_finalize
\ No newline at end of file
+ts_finalize
index eaa0a90d51da9b65bcedbb8a093f07091e601b7c..f31f54eaf002eda37733d9f4bf1b386b31ee0189 100755 (executable)
@@ -38,8 +38,7 @@ function skip_policy {
 }
 
 function skip_kernel_lt {
-       ts_kernel_ver_lt $1 $2 $3
-       if [ $? == 0 ]; then
+       if ts_kernel_ver_lt $1 $2 $3; then
                ts_skip_subtest "kernel version must be >= $1.$2.$3"
                return 1
        fi
@@ -63,8 +62,7 @@ function cleanup_output {
 
 
 ts_init_subtest "fifo"
-skip_policy SCHED_FIFO
-if [ $? == 0 ]; then
+if skip_policy SCHED_FIFO; then
        do_chrt --fifo 1
        do_chrt --fifo 99
        cleanup_output
@@ -73,8 +71,7 @@ fi
 
 
 ts_init_subtest "batch"
-skip_policy SCHED_BATCH && skip_kernel_ge 6 12 0
-if [ $? == 0 ]; then
+if skip_policy SCHED_BATCH && skip_kernel_ge 6 12 0; then
        do_chrt --batch 0
        cleanup_output
        ts_finalize_subtest
@@ -82,8 +79,7 @@ fi
 
 
 ts_init_subtest "batch-custom-slice"
-skip_policy SCHED_BATCH && skip_kernel_lt 6 12 0
-if [ $? == 0 ]; then
+if skip_policy SCHED_BATCH && skip_kernel_lt 6 12 0; then
        do_chrt --batch --sched-runtime 100000 0
        cleanup_output
        ts_finalize_subtest
@@ -91,8 +87,7 @@ fi
 
 
 ts_init_subtest "other"
-skip_policy SCHED_OTHER && skip_kernel_ge 6 12 0
-if [ $? == 0 ]; then
+if skip_policy SCHED_OTHER && skip_kernel_ge 6 12 0; then
        do_chrt --other 0
        cleanup_output
        ts_finalize_subtest
@@ -100,8 +95,7 @@ fi
 
 
 ts_init_subtest "other-custom-slice"
-skip_policy SCHED_OTHER && skip_kernel_lt 6 12 0
-if [ $? == 0 ]; then
+if skip_policy SCHED_OTHER && skip_kernel_lt 6 12 0; then
        do_chrt --other --sched-runtime 100000 0
        cleanup_output
        ts_finalize_subtest
@@ -109,8 +103,7 @@ fi
 
 
 ts_init_subtest "rr"
-skip_policy SCHED_RR
-if [ $? == 0 ]; then
+if skip_policy SCHED_RR; then
        do_chrt --rr 1
        do_chrt --rr 99
        cleanup_output
@@ -119,8 +112,7 @@ fi
 
 
 ts_init_subtest "idle"
-skip_policy SCHED_IDLE
-if [ $? == 0 ]; then
+if skip_policy SCHED_IDLE; then
        do_chrt --idle 0
        cleanup_output
        ts_finalize_subtest
@@ -128,8 +120,7 @@ fi
 
 
 ts_init_subtest "deadline"
-skip_policy SCHED_DEADLINE
-if [ $? == 0 ]; then
+if skip_policy SCHED_DEADLINE; then
        do_chrt --deadline --sched-period 130000 0
        do_chrt --deadline --sched-period 130000 --sched-deadline 120000 0
        do_chrt --deadline --sched-period 130000 --sched-deadline 120000 --sched-runtime 100000 0
@@ -138,8 +129,7 @@ if [ $? == 0 ]; then
 fi
 
 ts_init_subtest "ext"
-skip_policy SCHED_EXT
-if [ $? == 0 ]; then
+if skip_policy SCHED_EXT; then
        do_chrt --ext 0
        do_chrt -e 0
        cleanup_output
index 0cc05e0a4433347f540c9640d13ec5501239cb55..5d487738bcba20da98b3d90e6eb15e2ebd2615a8 100755 (executable)
@@ -34,8 +34,7 @@ cat b >>"$TS_OUTPUT"
 ts_finalize_subtest
 
 ts_init_subtest "invalid-input"
-"$TS_CMD_COPYFILERANGE" a b 3:bogus:1 bogus::2 :::: bogus svhhs:%%:8  &>/dev/null
-if [[ "$?" != "0" ]]; then
+if ! "$TS_CMD_COPYFILERANGE" a b 3:bogus:1 bogus::2 :::: bogus svhhs:%%:8 &>/dev/null; then
        echo "ok" >"$TS_OUTPUT"
 fi
 ts_finalize_subtest
index a6313494195ddde8118cf61b529ed3ba68f08065..7cffb535f08a79620f749099b0e93975a37d1435 100755 (executable)
@@ -98,8 +98,7 @@ DEVICE=$($TS_CMD_LOSETUP --show -f $IMAGE_PATH)
 ts_register_loop_device "$DEVICE"
 
 ts_log "check the image"
-ts_device_has "TYPE" "cramfs" $DEVICE
-[  "$?" == "0" ] || ts_die "Cannot find cramfs on $DEVICE"
+ts_device_has "TYPE" "cramfs" $DEVICE || ts_die "Cannot find cramfs on $DEVICE"
 
 ts_log "mount the image"
 ts_mount "cramfs" -r -L $LABEL $TS_MOUNTPOINT
index 8fbe4420960f7526be0f8d74d73b093b421f023b..58635e51546a1619e2b6aeebbdc805cfdec35d42 100755 (executable)
@@ -23,9 +23,14 @@ ts_init "$*"
 
 ts_check_test_command "$TS_CMD_GETOPT"
 
-TEMP=$($TS_CMD_GETOPT -o ab:c:: --long a-long,b-long:,c-long:: -n 'example.bash' -- -a -b 1 -c2  --a-long --b-long 3 --c-long foo bar)
 
-if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
+
+if ! TEMP=$($TS_CMD_GETOPT -o ab:c:: --long a-long,b-long:,c-long:: \
+       -n 'example.bash' -- -a -b 1 -c2  --a-long --b-long 3 --c-long foo bar); 
+then
+       echo "Terminating..." >&2
+       exit 1 ; 
+fi
 
 eval set -- "$TEMP"
 
index e6d8e5d384563b52d11098768cbe4d6d0ff5062f..c1a4c567225588202a4979ffe0963ff0e7c7435f 100755 (executable)
@@ -80,8 +80,7 @@ diff=$(check_diff_offset $OFFSET_A $OFFSET_B 0.02) \
        || ts_skip "unreliable ntp or sys clock offsets: $NTP_IP $OFFSET_A $OFFSET_B +/-$diff"
 
 # hwclock --show should work if we have a hw clock
-tmp=$($TS_CMD_HWCLOCK --show 2>&1)
-if [ $? != "0" ]; then
+if ! tmp=$($TS_CMD_HWCLOCK --show 2>&1); then
        echo "$tmp" | grep -q "Cannot access the Hardware Clock via" \
                && ts_skip "no hardware clock found"
        ts_failed "hwclock --show"
index 8313a6fec09dcaaf2fdc8e6424acb2c2f42397a4..c4151a9bd81aebdd3ca7a77922fac90d11e93963 100755 (executable)
@@ -40,8 +40,7 @@ try_option()
        check_test_sigreceive $TEST_PID
        [ $? -eq 1 ] || echo "${HELPER_SYMLINK##*/} helper did not start" >> "$TS_OUTPUT"
 
-       "$TS_CMD_KILL" "$@" $TEST_PID >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-       if [ $? -ne 0 ]; then
+       if ! "$TS_CMD_KILL" "$@" $TEST_PID >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"; then
                echo "kill $@ did not work" >> "$TS_OUTPUT"
                all_ok=false
        fi
index 9d6e57ed6192e2bd5a929b880a4d168e931764d5..f4c31c8040d3b586891cfc35bd560af4e718d397 100755 (executable)
@@ -53,8 +53,7 @@ try_option()
        check_test_sigreceive "${TEST_PID}"
        [ $? -eq 1 ] || echo "${HELPER_SYMLINK##*/} helper did not start" >> "$TS_OUTPUT"
 
-       "$TS_CMD_KILL" "$@" "${TEST_PID}:${TEST_PIDFD_INO}" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-       if [ $? -ne 0 ]; then
+       if ! "$TS_CMD_KILL" "$@" "${TEST_PID}:${TEST_PIDFD_INO}" >>"$TS_OUTPUT" 2>>"$TS_ERRLOG"; then
                echo "kill $* did not work" >> "$TS_OUTPUT"
                all_ok=false
        fi
@@ -78,4 +77,4 @@ if $all_ok; then
 fi
 rm -f "$HELPER_SYMLINK"
 
-ts_finalize
\ No newline at end of file
+ts_finalize
index f97f88d8637e28bdba42829b6ba479084d88e12d..abaf08f45c8ba44dced3146657ed4a4ad20dc7d1 100755 (executable)
@@ -38,8 +38,7 @@ TEST_PID=$!
 check_test_sigreceive $TEST_PID
 [ $? -eq 1 ] || echo "${HELPER_SYMLINK##*/} helper did not start" >> "$TS_OUTPUT"
 
-KILL_PID=$("$TS_CMD_KILL" -p ${HELPER_SYMLINK##*/} 2>> "$TS_OUTPUT" 2>> "$TS_ERRLOG")
-if [ $? -ne 0 ]; then
+if ! KILL_PID=$("$TS_CMD_KILL" -p "${HELPER_SYMLINK##*/}" 2>> "$TS_ERRLOG"); then
        echo "kill -p did not work" >> "$TS_OUTPUT"
        all_ok=false
 fi
index 0a7d5d26a82918ae038eb1338a024ac3d59e670c..5f89d6e23b49381595c9cce0046923289d046db3 100755 (executable)
@@ -38,8 +38,8 @@ TEST_PID=$!
 check_test_sigreceive $TEST_PID
 [ $? -eq 1 ] || echo "${HELPER_SYMLINK##*/} helper did not start" >> "$TS_OUTPUT"
 
-"$TS_CMD_KILL" -1 --queue 42 $TEST_PID >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-if [ $? -ne 0 ]; then
+
+if ! "$TS_CMD_KILL" -1 --queue 42 $TEST_PID >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"; then
        echo "kill --queue 42 failed" >> "$TS_OUTPUT"
        all_ok=false
 fi
index 8ed878068f0d48b73e6493a6368e78b2374d5766..4046e6703c1a28af9cc362253e4ac353db3045f6 100755 (executable)
@@ -48,8 +48,7 @@ DEVICE="${TS_DEVICE}1"
 
 udevadm settle
 
-grep -q " $DEVNAME\$" /proc/partitions
-if [ $? -ne 0 ]; then
+if ! grep -q " $DEVNAME\$" /proc/partitions; then
        ts_skip "no partition!"
 fi
 
index 862ca0de17f3ce7a6420eade2930baabd1aefe7b..4c6d182b268572314d553e844aea8e0e464a9cfc 100755 (executable)
@@ -57,8 +57,7 @@ DEVICE="${TS_DEVICE}1"
 
 udevadm settle
 
-grep -q " $DEVNAME\$" /proc/partitions
-if [ $? -ne 0 ]; then
+if ! grep -q " $DEVNAME\$" /proc/partitions; then
        ts_skip "no partition!"
 fi
 
index b955c2eb98ea6551f0ffce28203d929131c77ac4..e431b072234558a17448be3d4c5fe038bbc734d0 100755 (executable)
@@ -45,8 +45,7 @@ DEVICE="${TS_DEVICE}1"
 
 udevadm settle
 
-grep -q " $DEVNAME\$" /proc/partitions
-if [ $? -ne 0 ]; then
+if ! grep -q " $DEVNAME\$" /proc/partitions; then
        ts_skip "no partition!"
 fi
 
index cf1a0654c4328aac79f09c65741f7f3713b67ae5..3916f8897aa8779ac58206ba07370fb298b51487 100755 (executable)
@@ -50,8 +50,8 @@ DEVICE="${TS_DEVICE}1"
 
 udevadm settle
 
-grep -q " $DEVNAME\$" /proc/partitions
-if [ $? -ne 0 ]; then
+
+if ! grep -q " $DEVNAME\$" /proc/partitions; then
        ts_skip "no partition!"
 fi
 
index b6b14e0c6701fa0d64258a723789cb4cdf59916e..6fa7f29b63867b1071dead1cad6415997ab6e7ed 100755 (executable)
@@ -8,8 +8,8 @@ ts_init "$*"
 ts_check_prog sqlite3
 ts_check_test_command "$TS_CMD_LSLOGINS"
 
-$TS_CMD_LSLOGINS --version|grep "lastlog2" >/dev/null
-if [ $? -ne 0 ]; then
+
+if ! $TS_CMD_LSLOGINS --version|grep "lastlog2" >/dev/null; then
     ts_skip "lastlog2 not supported"
 fi
 
index 3ca96d39599782186fd8f6a0349996f2a73f3be2..f70419ad7e5c3f49e74fbb6c50ea2ea4267b6b8b 100755 (executable)
@@ -8,8 +8,8 @@ ts_init "$*"
 ts_check_prog sqlite3
 ts_check_test_command "$TS_CMD_LSLOGINS"
 
-$TS_CMD_LSLOGINS --version|grep "lastlog2" >/dev/null
-if [ $? -ne 0 ]; then
+
+if ! $TS_CMD_LSLOGINS --version|grep "lastlog2" >/dev/null; then
     ts_skip "lastlog2 not supported"
 fi
 
@@ -29,4 +29,4 @@ $TS_CMD_LSLOGINS --lastlog-file=/dev/null \
         --json > "$TS_OUTPUT"
 
 rm $DB_FILE
-ts_finalize
\ No newline at end of file
+ts_finalize
index d65c79412e320791f16255cb76d1c7e79a48c7f3..94fdb46945279f0337b4c2070d3fc36e0207af64 100755 (executable)
@@ -27,8 +27,8 @@ grep -q 'nodev[[:space:]]*tmpfs' /proc/filesystems || \
        ts_skip_subtest "tmpfs unsupported"
 
 mkdir -p $TS_MOUNTPOINT &>  /dev/null
-$TS_CMD_MOUNT -t tmpfs tmpfs $TS_MOUNTPOINT >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[ $? -eq 0 ] || ts_skip "tmpfs mount failed"
+$TS_CMD_MOUNT -t tmpfs tmpfs $TS_MOUNTPOINT >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+               || ts_skip "tmpfs mount failed"
 
 # reuse the same TS_MOUNTPOINT in all subtests
 BASE=$TS_MOUNTPOINT
index 8a24634b2819989e3df95d2ede7a95d8e8f32e03..6a21327102076d399f67db650a1b1334ead026fe 100755 (executable)
@@ -23,11 +23,10 @@ test_mount_fallback() {
        mkdir -p "$TS_MOUNTPOINT"
 
        "$TS_CMD_ENOSYS" $2 -- "$TS_CMD_MOUNT" --bind "$MY_SOURCE" "$TS_MOUNTPOINT" \
-               >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-       [ "$?" = "0" ] || ts_log "error: mount $TS_MOUNTPOINT"
+               >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" || ts_log "error: mount $TS_MOUNTPOINT"
 
-       "$TS_CMD_FINDMNT" --mountpoint "$TS_MOUNTPOINT" &> /dev/null
-       [ $? -eq 0 ] || ts_die "Not found target (mount failed?)"
+       "$TS_CMD_FINDMNT" --mountpoint "$TS_MOUNTPOINT" &> /dev/null \
+                                       || ts_die "Not found target (mount failed?)"
 
        "$TS_CMD_UMOUNT" "$TS_MOUNTPOINT" || ts_die "Cannot umount $TS_MOUNTPOINT"
 
@@ -72,8 +71,9 @@ ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts"
 $TS_CMD_ENOSYS -s mount_setattr -- \
        "$TS_CMD_MOUNT" --options remount,ro "$MOUNTPOINT" \
        >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-$TS_CMD_FINDMNT --kernel --mountpoint "$MOUNTPOINT" --options "ro" &> /dev/null
-[ "$?" == "0" ] || ts_die "Cannot find read-only in $MOUNTPOINT in /proc/self/mountinfo"
+$TS_CMD_FINDMNT --kernel --mountpoint "$MOUNTPOINT" --options "ro" &> /dev/null \
+                       || ts_die "Cannot find read-only in $MOUNTPOINT in /proc/self/mountinfo"
+
 $TS_CMD_ENOSYS -s mount_setattr -- \
        "$TS_CMD_MOUNT" --make-slave "$MOUNTPOINT" \
        >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
index 2519230cd5015af859fdecb7e648414308209ae0..7448557ae19f9e79a2a528656e340c1be1294c51 100755 (executable)
@@ -85,48 +85,43 @@ ts_finalize_subtest
 
 
 ts_init_subtest "filter-type"
-$TS_CMD_MOUNT --all --fstab "${TS_FSTAB}" --types ext4 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[ $? == 0 ] || ts_log "mount failed"
+$TS_CMD_MOUNT --all --fstab "${TS_FSTAB}" --types ext4 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+                       || ts_log "mount failed"
 udevadm settle
-$TS_CMD_UMOUNT ${MOUNTPOINT}D
-[ $? == 0 ] || ts_log "umount failed"
+$TS_CMD_UMOUNT ${MOUNTPOINT}D || ts_log "umount failed"
 ts_finalize_subtest
 
 
 ts_init_subtest "filter-notype"
-$TS_CMD_MOUNT --all --fstab "${TS_FSTAB}" --types noext4 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[ $? == 0 ] || ts_log "mount failed"
+$TS_CMD_MOUNT --all --fstab "${TS_FSTAB}" --types noext4 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+                       || ts_log "mount failed"
 udevadm settle
-$TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C}
-[ $? == 0 ] || ts_log "umount failed"
+$TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C} || ts_log "umount failed"
 ts_finalize_subtest
 
 
 ts_init_subtest "filter-option"
-$TS_CMD_MOUNT --all --fstab "${TS_FSTAB}" --test-opts ro >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[ $? == 0 ] || ts_log "mount failed"
+$TS_CMD_MOUNT --all --fstab "${TS_FSTAB}" --test-opts ro >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+                       || ts_log "mount failed"
 udevadm settle
-$TS_CMD_UMOUNT ${MOUNTPOINT}C
-[ $? == 0 ] || ts_log "umount failed"
+$TS_CMD_UMOUNT ${MOUNTPOINT}C || ts_log "umount failed"
 ts_finalize_subtest
 
 
 ts_init_subtest "override-option"
-$TS_CMD_MOUNT --all --fstab "${TS_FSTAB}" --options ro >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[ $? == 0 ] || ts_log "mount failed"
+$TS_CMD_MOUNT --all --fstab "${TS_FSTAB}" --options ro >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+                       || ts_log "mount failed"
 udevadm settle
-$TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C,D}
-[ $? == 0 ] || ts_log "umount failed"
+$TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C,D} || ts_log "umount failed"
 ts_finalize_subtest
 
 
 ts_init_subtest "relative-path"
 cd "$TS_OUTDIR" > /dev/null
-$TS_CMD_MOUNT --all --fstab $(basename "${TS_FSTAB}") >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[ $? == 0 ] || ts_log "mount failed"
+$TS_CMD_MOUNT --all --fstab $(basename "${TS_FSTAB}") >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+                       || ts_log "mount failed"
 udevadm settle
-$TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C,D}
-[ $? == 0 ] || ts_log "umount failed"
+$TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C,D} || ts_log "umount failed"
 cd - > /dev/null
 ts_finalize_subtest
 
@@ -143,11 +138,10 @@ echo  "${TS_DEVICE}4 /foo/D ext4 rw,defaults 0 0" >> "${TS_FSTAB}"
 $TS_CMD_MOUNT  --all \
                --fstab "${TS_FSTAB}" \
                --target-prefix $MY_ROOT \
-               --options X-mount.mkdir >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[ $? == 0 ] || ts_log "mount failed"
+               --options X-mount.mkdir >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+               || ts_log "mount failed"
 udevadm settle
-$TS_CMD_UMOUNT $MY_ROOT/foo/{A,B,C,D}
-[ $? == 0 ] || ts_log "umount failed"
+$TS_CMD_UMOUNT $MY_ROOT/foo/{A,B,C,D} || ts_log "umount failed"
 ts_finalize_subtest
 
 ts_finalize
index cd47fd122be8e66a7b34fe10aa9f7517054dfb56..abcece722d105eaad623ea614723b363aac35061 100755 (executable)
@@ -20,11 +20,11 @@ ts_fstab_add $MY_SOURCE "$TS_MOUNTPOINT" "none" "bind,default,noauto"
 mkdir -p $MY_SOURCE
 mkdir -p $TS_MOUNTPOINT
 
-$TS_CMD_MOUNT --fstab "$TS_FSTAB" $TS_MOUNTPOINT >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[ "$?" = "0" ] || ts_log "error: mount $TS_MOUNTPOINT"
+$TS_CMD_MOUNT --fstab "$TS_FSTAB" $TS_MOUNTPOINT >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+                || ts_log "error: mount $TS_MOUNTPOINT"
 
-$TS_CMD_FINDMNT --mountpoint "$TS_MOUNTPOINT" &> /dev/null
-[ $? -eq 0 ] || ts_die "Not found target (mount failed?)"
+$TS_CMD_FINDMNT --mountpoint "$TS_MOUNTPOINT" &> /dev/null \
+                || ts_die "Not found target (mount failed?)"
 
 $TS_CMD_UMOUNT $TS_MOUNTPOINT || ts_die "Cannot umount $TS_MOUNTPOINT"
 
index 75b87876d71193bf678ef09b0a972f44c838b7a3..ea70001fa209c4a9861dea708c8d318b123ead65 100755 (executable)
@@ -38,16 +38,16 @@ echo "tmpd $MNT tmpfs" >> "$TS_FSTAB"
 ts_fstab_close
 
 ts_init_subtest "mount"
-$TS_CMD_MOUNT --fstab "$TS_FSTAB" $MNT &> /dev/null
-[ "$?" = "0" ] || ts_log "error: mount $MNT"
-$TS_CMD_FINDMNT --kernel --mountpoint "$MNT" &> /dev/null
-if [ "$?" != "0" ]; then
+$TS_CMD_MOUNT --fstab "$TS_FSTAB" $MNT &> /dev/null || ts_log "error: mount $MNT"
+
+if ! $TS_CMD_FINDMNT --kernel --mountpoint "$MNT" &> /dev/null; then
        ts_log "Cannot find $MNT in /proc/self/mountinfo"
 else
        ts_log "OK"
 fi
-$TS_CMD_UMOUNT $MNT &> /dev/null
-if [ "$?" = "0" ]; then
+
+
+if $TS_CMD_UMOUNT $MNT &> /dev/null; then
        # for old systems with mtab and /sbin/mount.tmpfs
        /bin/umount --fake "$MNT" &> /dev/null
 else
@@ -57,16 +57,16 @@ ts_finalize_subtest
 
 
 ts_init_subtest "mount-all"
-$TS_CMD_MOUNT --fstab "$TS_FSTAB" --all &> /dev/null
-[ "$?" = "0" ] || ts_log "error: mount -a"
-$TS_CMD_FINDMNT --kernel --mountpoint "$MNT" &> /dev/null
-if [ "$?" != "0" ]; then
+$TS_CMD_MOUNT --fstab "$TS_FSTAB" --all &> /dev/null || ts_log "error: mount -a"
+
+if ! $TS_CMD_FINDMNT --kernel --mountpoint "$MNT" &> /dev/null; then
        ts_log "Cannot find $MNT in /proc/self/mountinfo"
 else
        ts_log "OK"
 fi
-$TS_CMD_UMOUNT $MNT &> /dev/null
-if [ "$?" = "0" ]; then
+
+
+if $TS_CMD_UMOUNT $MNT &> /dev/null; then
        # for old systems with mtab and /sbin/mount.tmpfs
        /bin/umount --fake $MNT &> /dev/null
 else
index f7526d19aa337b24b1bcc0d4aba37fa92b0dfbe5..9d8981eab8e1b6c6a9c7af7d54aa7e2c43630c35 100755 (executable)
@@ -17,14 +17,13 @@ ts_fstab_add "none" "$TS_MOUNTPOINT" "tmpfs" "rw,nosuid,nodev,relatime"
 
 mkdir -p $TS_MOUNTPOINT
 
-$TS_CMD_MOUNT --fstab "$TS_FSTAB" $TS_MOUNTPOINT >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[ "$?" = "0" ] || ts_log "error: mount $TS_MOUNTPOINT"
+$TS_CMD_MOUNT --fstab "$TS_FSTAB" $TS_MOUNTPOINT >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+        || ts_log "error: mount $TS_MOUNTPOINT"
 
-$TS_CMD_FINDMNT --mountpoint "$TS_MOUNTPOINT" &> /dev/null
-[ $? -eq 0 ] || ts_die "Not found target (mount failed?)"
+$TS_CMD_FINDMNT --mountpoint "$TS_MOUNTPOINT" &> /dev/null || ts_die "Not found target (mount failed?)"
 
-$TS_CMD_FINDMNT --source "none" --mountpoint "$TS_MOUNTPOINT" &> /dev/null
-[ $? -eq 0 ] || ts_die "Not found source and target"
+$TS_CMD_FINDMNT --source "none" --mountpoint "$TS_MOUNTPOINT" &> /dev/null \
+        || ts_die "Not found source and target"
 
 $TS_CMD_UMOUNT $TS_MOUNTPOINT || ts_die "Cannot umount $TS_MOUNTPOINT"
 
index d661fb7d4c5773ea3061fa1190b937c6eb53aefb..01d7950864cc3489567b48c824ecb38d88b63330 100755 (executable)
@@ -48,11 +48,11 @@ grep -E -q "^$DEVICE $TS_MOUNTPOINT" $MTAB_FILE \
 
 # remount
 $TS_CMD_MOUNT --options remount,ro $TS_MOUNTPOINT &> /dev/null \
-        || ts_die "Cannot remount $TS_MOUNTPOINT"
+       || ts_die "Cannot remount $TS_MOUNTPOINT"
 
 # check the remount
-$TS_CMD_FINDMNT --kernel --mountpoint "$TS_MOUNTPOINT" --options "ro" &> /dev/null
-[ "$?" == "0" ] || ts_die "Cannot find read-only in $TS_MOUNTPOINT in /proc/self/mountinfo"
+$TS_CMD_FINDMNT --kernel --mountpoint "$TS_MOUNTPOINT" --options "ro" &> /dev/null \
+       || ts_die "Cannot find read-only in $TS_MOUNTPOINT in /proc/self/mountinfo"
 
 ts_log "Success"
 ts_finalize
index 09779b956e4d376454f4ed374bdeaf185f435339..d1e88066d93097a27e06f846b55d7c487333095d 100755 (executable)
@@ -17,12 +17,11 @@ ts_check_prog "mkfs.ext2"
 [ -d $TS_MOUNTPOINT ] || mkdir -p $TS_MOUNTPOINT
 
 # bind
-$TS_CMD_MOUNT --bind $TS_MOUNTPOINT $TS_MOUNTPOINT &> /dev/null
-[ "$?" = "0" ] || ts_die "error: mount --bind"
+$TS_CMD_MOUNT --bind $TS_MOUNTPOINT $TS_MOUNTPOINT &> /dev/null || ts_die "error: mount --bind"
 
 # check the bind
-$TS_CMD_FINDMNT --kernel --mountpoint $TS_MOUNTPOINT  &> /dev/null
-[ "$?" == "0" ] || ts_die "Cannot find bound $TS_MOUNTPOINT in /proc/self/mountinfo"
+$TS_CMD_FINDMNT --kernel --mountpoint $TS_MOUNTPOINT  &> /dev/null \
+               || ts_die "Cannot find bound $TS_MOUNTPOINT in /proc/self/mountinfo"
 
 # use the same mounpoint for all sub-tests
 MOUNTPOINT="$TS_MOUNTPOINT"
index 8b0cc94d5834f7073a1eda172a366a21fb9cc23c..6a5b5085d49288628a544fb9606121c60f271ff4 100755 (executable)
@@ -59,8 +59,7 @@ ts_finalize_subtest
 
 ts_init_subtest "missing-options"
 
-grep -q 'nodev[[:space:]]*tmpfs' /proc/filesystems
-if [ "$?" == "0" ]; then
+if grep -q 'nodev[[:space:]]*tmpfs' /proc/filesystems; then
 cat > $MOUNTER <<EOF
 #!/usr/bin/env bash
 # This util-linux regression test component
@@ -79,8 +78,7 @@ EOF
        $TS_CMD_MOUNT -t mytest -o x-bar=BAR /foo "$mountpoint" &> "$TS_OUTPUT"
        udevadm settle
 
-       grep -q "$mountpoint" /proc/mounts
-       if [ "$?" == "0" ]; then
+       if grep -q "$mountpoint" /proc/mounts; then
                cat "$LIBMOUNT_UTAB" \
                        | grep "$mountpoint" \
                        | sed -e "s|$mountpoint|/mountpoint|g" \
index 96e071050bc528e2e7a0dceacba192754a6570f0..95a30158d71ee3a68da6e0cc73cb24002378c2d9 100755 (executable)
@@ -15,8 +15,9 @@ ts_check_test_command "$TS_CMD_FDISK"
 ts_skip_nonroot
 ts_check_prog "mkfs.ext2"
 
-$TS_CMD_UMOUNT --help | grep -q all-targets
-[ $? -eq 1 ] && ts_skip "all-targets unsupported"
+if ! $TS_CMD_UMOUNT --help | grep -q all-targets; then
+       ts_skip "all-targets unsupported"
+fi
 
 # set global variable TS_DEVICE
 ts_scsi_debug_init dev_size_mb=50
@@ -87,8 +88,7 @@ MOUNTPOINT=$TS_MOUNTPOINT
 #
 ts_init_subtest "all-targets-mnt"
 multi_mount ${TS_DEVICE}1 $MOUNTPOINT
-$TS_CMD_UMOUNT --all-targets ${MOUNTPOINT}1 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[ $? == 0 ] || ts_log "umount failed"
+$TS_CMD_UMOUNT --all-targets ${MOUNTPOINT}1 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" || ts_log "umount failed"
 ts_finalize_subtest
 
 #
@@ -96,8 +96,7 @@ ts_finalize_subtest
 #
 ts_init_subtest "all-targets-dev"
 multi_mount ${TS_DEVICE}1 $MOUNTPOINT
-$TS_CMD_UMOUNT --all-targets ${TS_DEVICE}1 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[ $? == 0 ] || ts_log "umount failed"
+$TS_CMD_UMOUNT --all-targets ${TS_DEVICE}1 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" || ts_log "umount failed"
 ts_finalize_subtest
 
 #
@@ -112,8 +111,9 @@ $TS_CMD_MOUNT ${TS_DEVICE}2 ${MOUNTPOINT}1/subA &> /dev/null
 $TS_CMD_MOUNT ${TS_DEVICE}3 ${MOUNTPOINT}1/subA/subAB &> /dev/null
 [ -d "${MOUNTPOINT}1/subB" ] || mkdir -p ${MOUNTPOINT}1/subB
 $TS_CMD_MOUNT ${TS_DEVICE}4 ${MOUNTPOINT}1/subB &> /dev/null
-$TS_CMD_UMOUNT --recursive --all-targets ${TS_DEVICE}1 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[ $? == 0 ] || ts_log "umount failed"
+
+$TS_CMD_UMOUNT --recursive --all-targets ${TS_DEVICE}1 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+               || ts_log "umount failed"
 ts_finalize_subtest
 
 ts_log "Success"
index 1b0b29fb3c18908023d33edacc5437842ac54fe5..32410263b4f2a617f6cb26005725660ba7ae87c9 100755 (executable)
@@ -92,16 +92,16 @@ ts_log "F) Mount mountpoint-bind"
 $TS_CMD_MOUNT --bind $TS_MOUNTPOINT $TS_MOUNTPOINT &> /dev/null
 
 udevadm settle
-$TS_CMD_UMOUNT --recursive $TS_MOUNTPOINT >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[ $? == 0 ] || ts_die "umount failed"
+$TS_CMD_UMOUNT --recursive $TS_MOUNTPOINT >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+        || ts_die "umount failed"
 
 # the mountpoint has already been unmounted, so this second call should not fail
-$TS_CMD_UMOUNT --graceful $TS_MOUNTPOINT >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[ $? == 0 ] || ts_die "--graceful on unmounted mountpoint failed"
+$TS_CMD_UMOUNT --graceful $TS_MOUNTPOINT >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+        || ts_die "--graceful on unmounted mountpoint failed"
 
 # non-existent path should not fail with --graceful
-$TS_CMD_UMOUNT --graceful /non-existent-path-$$ >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[ $? == 0 ] || ts_die "--graceful on non-existent path failed"
+$TS_CMD_UMOUNT --graceful /non-existent-path-$$ >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+        || ts_die "--graceful on non-existent path failed"
 
 ts_log "Success"
 ts_finalize
index 0090c5d98ab531452e9da3226125459f962a4fde..c1f4fa61891ff045c9b3aa4cefcf7f15f5b7dfad 100755 (executable)
@@ -26,53 +26,53 @@ set -o pipefail
 DEFAULT_PIPE_SIZE=$(($($TS_HELPER_SYSINFO pagesize) * 16))
 
 ts_init_subtest "set-fd-bad"
-$TS_CMD_PIPESZ --check --set 4096 --fd 42 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[[ $? -eq 0 ]] && ts_logerr "expected failure"
+$TS_CMD_PIPESZ --check --set 4096 --fd 42 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" && ts_logerr "expected failure"
 ts_finalize_subtest
 
 ts_init_subtest "set-fd"
-echo -n | $TS_CMD_PIPESZ --check --set 4096 --stdin >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[[ $? -ne 0 ]] && ts_logerr "expected success"
+echo -n | $TS_CMD_PIPESZ --check --set 4096 --stdin >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+        || ts_logerr "expected success"
 ts_finalize_subtest
 
 ts_init_subtest "set-file-bad"
-$TS_CMD_PIPESZ --check --set 4096 --file "/dev/null" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[[ $? -eq 0 ]] && ts_logerr "expected failure"
+$TS_CMD_PIPESZ --check --set 4096 --file "/dev/null" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+        && ts_logerr "expected failure"
 ts_finalize_subtest
 
 ts_init_subtest "set-file"
-echo -n | $TS_CMD_PIPESZ --check --set 4096 --file "/dev/stdin" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[[ $? -ne 0 ]] && ts_logerr "expected success"
+echo -n | $TS_CMD_PIPESZ --check --set 4096 --file "/dev/stdin" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+        || ts_logerr "expected success"
 ts_finalize_subtest
 
 ts_init_subtest "get-fd-bad"
-$TS_CMD_PIPESZ --check --get --fd 42 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[[ $? -eq 0 ]] && ts_logerr "expected failure"
+$TS_CMD_PIPESZ --check --get --fd 42 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" && ts_logerr "expected failure"
 ts_finalize_subtest
 
 ts_init_subtest "get-fd"
-echo -n | $TS_CMD_PIPESZ --check --get --stdin 2>> "$TS_ERRLOG" | sed "s/$DEFAULT_PIPE_SIZE/DEFAULT_PIPE_SIZE/g" >> "$TS_OUTPUT"
-[[ $? -ne 0 ]] && ts_logerr "expected success"
+echo -n | $TS_CMD_PIPESZ --check --get --stdin 2>> "$TS_ERRLOG" \
+        | sed "s/$DEFAULT_PIPE_SIZE/DEFAULT_PIPE_SIZE/g" >> "$TS_OUTPUT" \
+        || ts_logerr "expected success"
 ts_finalize_subtest
 
 ts_init_subtest "get-file-bad"
-$TS_CMD_PIPESZ --check --get --file "/dev/null" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[[ $? -eq 0 ]] && ts_logerr "expected failure"
+$TS_CMD_PIPESZ --check --get --file "/dev/null" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+        && ts_logerr "expected failure"
 ts_finalize_subtest
 
 ts_init_subtest "get-file"
-echo -n | $TS_CMD_PIPESZ --check --get --file "/dev/stdin" 2>> "$TS_ERRLOG" | sed "s/$DEFAULT_PIPE_SIZE/DEFAULT_PIPE_SIZE/g" >> "$TS_OUTPUT"
-[[ $? -ne 0 ]] && ts_logerr "expected success"
+echo -n | $TS_CMD_PIPESZ --check --get --file "/dev/stdin" 2>> "$TS_ERRLOG" \
+        | sed "s/$DEFAULT_PIPE_SIZE/DEFAULT_PIPE_SIZE/g" >> "$TS_OUTPUT" \
+        || ts_logerr "expected success"
 ts_finalize_subtest
 
 ts_init_subtest "pipe-max-size"
-echo -n | $TS_CMD_PIPESZ --check --stdin >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[[ $? -ne 0 ]] && ts_logerr "expected success"
+echo -n | $TS_CMD_PIPESZ --check --stdin >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+        || ts_logerr "expected success"
 ts_finalize_subtest
 
 ts_init_subtest "exec"
-echo this_should_be_output_by_cat | $TS_CMD_PIPESZ --check --stdin cat >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-[[ $? -ne 0 ]] && ts_logerr "expected success"
+echo this_should_be_output_by_cat | $TS_CMD_PIPESZ --check --stdin cat >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" \
+        || ts_logerr "expected success"
 ts_finalize_subtest
 
 set +o pipefail
index 05b72f3cb92f9e76ad79a0137a49de47e1781cf1..e2c71c828a0c1f9afea5c5275fb9a031bbda7b04 100755 (executable)
@@ -46,8 +46,7 @@ ts_init_subtest uname26
 finmsg="" # for debugging 2.6 issues
 
 echo "###### --uname-2.6 echo" >>"$TS_OUTPUT"
-$TS_CMD_SETARCH $ARCH --verbose --uname-2.6 echo "2.6 worked" >> "$TS_OUTPUT" 2>&1
-if [ $? -eq 0 ]; then
+if $TS_CMD_SETARCH $ARCH --verbose --uname-2.6 echo "2.6 worked" >> "$TS_OUTPUT" 2>&1; then
        expected='^2.6 worked$'
 else
        # this may happen after execvp - gets written to stderr
@@ -57,8 +56,7 @@ fi
 sed -i "$ s/$expected/2.6 works or kernel too old/" "$TS_OUTPUT"
 
 echo "###### --uname-2.6 true, non-verbose" >>"$TS_OUTPUT"
-$TS_CMD_SETARCH $ARCH --uname-2.6 true >> "$TS_OUTPUT" 2>&1
-if [ $? -eq 0 ]; then
+if $TS_CMD_SETARCH $ARCH --uname-2.6 true >> "$TS_OUTPUT" 2>&1; then
        echo "2.6 works or kernel too old" >> "$TS_OUTPUT"
 else
        # this may happen after execvp - gets written to stderr
index 88242936c797f3d9da4d7403fb5f17c8f509fbc3..6769db5d1e354ac45250e79b280fed0557df5759 100755 (executable)
@@ -32,7 +32,7 @@ $TS_CMD_SU --whitelist-environment FOO,BAR --login --command 'echo foo:$FOO bar:
 # the environment, not the overall functionality of su(1). Therefore, if su(1)
 # fails due to authentication, the test should be skipped.
 #
-grep -q 'Authentication failure' "$TS_ERRLOG"
-[ $? -eq 0 ] && ts_skip "authentication failure"
+
+grep -q 'Authentication failure' "$TS_ERRLOG" && ts_skip "authentication failure"
 
 ts_finalize
index 157dd8249e69688f0010d80877e7b35d0f280b8e..a51984c0b56d6e4547a1a14d667eb49efca99a79 100755 (executable)
@@ -52,8 +52,7 @@ ts_init_subtest "primary-login"
                         | grep -o "$grp_name" \
                         | uniq >> "$TS_OUTPUT"
 
-grep -q 'Authentication failure' "$TS_ERRLOG"
-[ "$?" -eq 0 ] && ts_skip_subtest "authentication failure"
+grep -q 'Authentication failure' "$TS_ERRLOG" && ts_skip_subtest "authentication failure"
 ts_finalize_subtest
 
 ts_init_subtest "supplemental-no-login"
@@ -69,8 +68,7 @@ ts_init_subtest "supplemental-login"
                         | grep -o "$grp_name" \
                         | uniq >> "$TS_OUTPUT"
 
-grep -q 'Authentication failure' "$TS_ERRLOG"
-[ "$?" -eq 0 ] && ts_skip_subtest "authentication failure"
+grep -q 'Authentication failure' "$TS_ERRLOG" && ts_skip_subtest "authentication failure"
 ts_finalize_subtest
 
 ts_init_subtest "group-id"
@@ -85,4 +83,4 @@ ts_finalize_subtest
 
 groupdel "$grp_name"
 
-ts_finalize
\ No newline at end of file
+ts_finalize
index 04f02f431a33d2ca860c5a7c11bf9efe8c73dedc..04889ae1ca69c316faca02e6f9d1a0b50818cf01 100755 (executable)
@@ -26,8 +26,7 @@ UUIDD_PID="$(mktemp -u "${TS_OUTDIR}/uuiddXXXXXXXXXXXXX")"
 # socket path must be short (SIZEOF_SOCKADDR_UN_SUN_PATH 108)
 UUIDD_SOCKET=$(mktemp "/tmp/ultest-$TS_COMPONENT-$TS_TESTNAME-socketXXXXXX")
 
-$TS_CMD_UUIDD -p "$UUIDD_PID" -s "$UUIDD_SOCKET"
-if [ $? -ne 0 ]; then
+if ! $TS_CMD_UUIDD -p "$UUIDD_PID" -s "$UUIDD_SOCKET"; then
        ts_failed "daemon start"
 fi
 
index 112eab76655eb4c45da5025073e6fec3192fa44e..3ecc0ed94ac6b427c9eed35c260305bb53e56add 100755 (executable)
@@ -24,15 +24,20 @@ ts_check_test_command "$TS_CMD_UUIDGEN"
 OUTPUT_FILE="$(mktemp "${TS_OUTDIR}/uuidgenXXXXXXXXXXXXX")"
 
 test_flag() {
+       local uuidgen_ret uuid_parse_ret
+       uuid_parse_ret=0
+
        echo "option: $1" >> "$TS_OUTPUT"
-       $TS_CMD_UUIDGEN $1 > "$OUTPUT_FILE" 2>>"$TS_OUTPUT"
-       ret=$?
+       $TS_CMD_UUIDGEN "$1" > "$OUTPUT_FILE" 2>>"$TS_OUTPUT"
+       uuidgen_ret=$?
+
        $TS_HELPER_UUID_PARSER "$OUTPUT_FILE" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
-       if [ $? -ne 0 ] || [ $ret -ne 0 ]; then
+       uuid_parse_ret=$?
+       if [ $uuid_parse_ret -ne 0 ] || [ $uuidgen_ret -ne 0 ]; then
                echo "something wrong with $OUTPUT_FILE" >> "$TS_OUTPUT"
-               cat $OUTPUT_FILE >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
+               cat "$OUTPUT_FILE" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
        fi
-       echo "return values: $ret and $?" >> "$TS_OUTPUT"
+       echo "return values: $uuidgen_ret and $uuid_parse_ret" >> "$TS_OUTPUT"
 }
 
 test_flag -r