]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: remove unbuffered ts_run feature
authorKarel Zak <kzak@redhat.com>
Fri, 30 Aug 2019 14:10:48 +0000 (16:10 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 30 Aug 2019 14:30:35 +0000 (16:30 +0200)
It's unnecessary as stdout and stderr are split in the tests.

Signed-off-by: Karel Zak <kzak@redhat.com>
tests/expected/misc/swaplabel
tests/expected/misc/swaplabel.err [new file with mode: 0644]
tests/expected/rename/exit_codes
tests/expected/rename/exit_codes.err [new file with mode: 0644]
tests/functions.sh
tests/ts/misc/swaplabel
tests/ts/rename/exit_codes

index 790a28c6cfeb1d1b779698e6cd6a3e35e8850fdd..22255bfe14f5d76df733833afff597dabf69726b 100644 (file)
@@ -1,7 +1,4 @@
-mkswap: error: swap area needs to be at least 10 pages
-mkswap: <swapfile>: insecure permissions <perm>, 0600 suggested.
 Setting up swapspace version 1, size = 9 pages (9xPGSZ bytes)
-mkswap: Label was truncated.
 LABEL=1234567890abcde, UUID=12345678-abcd-abcd-abcd-1234567890ab
 LABEL: 1234567890abcde
 UUID:  12345678-abcd-abcd-abcd-1234567890ab
diff --git a/tests/expected/misc/swaplabel.err b/tests/expected/misc/swaplabel.err
new file mode 100644 (file)
index 0000000..acfec20
--- /dev/null
@@ -0,0 +1,3 @@
+mkswap: error: swap area needs to be at least 10 pages
+mkswap: <swapfile>: insecure permissions <perm>, 0600 suggested.
+mkswap: Label was truncated.
index 3d53010b2df1623a1bf434cc34de6b50d324ed48..07885f7074ce612338e5b637fcd2f913b391aaac 100644 (file)
@@ -3,5 +3,4 @@ RENAME_EXIT_NOTHING: 4
 `rename_exit_codes.2' -> `rename_exit_values.2'
 EXIT_SUCCESS: 0
 `rename_exit_values.1' -> `rename_exit_codes.1'
-rename: rename_exit_values.2: rename to rename_exit_codes.2 failed: Is a directory
 RENAME_EXIT_SOMEOK: 2
diff --git a/tests/expected/rename/exit_codes.err b/tests/expected/rename/exit_codes.err
new file mode 100644 (file)
index 0000000..6478542
--- /dev/null
@@ -0,0 +1 @@
+rename: rename_exit_values.2: rename to rename_exit_codes.2 failed: Is a directory
index 1ce03e4536c4a954bc678b3fb6e9ab403da601ce..0af8b96b77f9a7527baa95013d5224bbabd1b054 100644 (file)
@@ -436,21 +436,6 @@ function ts_init_py {
 }
 
 function ts_run {
-       local UNBUFFERED=
-
-       while true; do
-               case "$1" in
-                       --unbuffered)
-                               UNBUFFERED=1
-                               shift;;
-                       --)
-                               shift
-                               break;;
-                       *)
-                               break;;
-               esac
-       done
-
        declare -a args
 
        #
@@ -460,17 +445,6 @@ function ts_run {
                args+=(env ASAN_OPTIONS=detect_leaks=1)
        fi
 
-       #
-       # Disable buffering of stdout
-       #
-       if [ -n "$UNBUFFERED" ]; then
-               if type unbuffer >/dev/null 2>&1; then
-                       args+=(unbuffer)
-               elif type stdbuf >/dev/null 2>&1 && [ "$TS_ENABLE_ASAN" != "yes" ]; then
-                       args+=(stdbuf --output=0)
-               fi
-       fi
-
        #
        # valgrind mode
        #
index 5a1bb46fb9be1cf9b1ce1fd234a3f013907d7b4b..0801cb213aab50571965df85c1358f55ed2b9b4f 100755 (executable)
@@ -39,26 +39,29 @@ MIN_SWAP_SIZE_KB=$(( MIN_SWAP_SIZE / 1024 ))
 
 rm -f $IMAGE
 fallocate_or_skip $(( $MIN_SWAP_SIZE - 1 )) $IMAGE
-ts_run --unbuffered $TS_CMD_MKSWAP \
+$TS_CMD_MKSWAP \
        --label 1234567890abcdef \
        --uuid 12345678-abcd-abcd-abcd-1234567890ab \
-       $IMAGE 2>&1 |\
-       sed -e "s/ $MIN_SWAP_SIZE_KB KiB/ 10 pages/" \
-           -e "s:$IMAGE:<swapfile>:g" \
-           -e "s/insecure permissions [0-9]*/insecure permissions <perm>/g" \
-       >> $TS_OUTPUT 2>> $TS_ERRLOG
+       $IMAGE >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+sed -i -e "s/ $MIN_SWAP_SIZE_KB KiB/ 10 pages/" \
+    -e "s:$IMAGE:<swapfile>:g" \
+    -e "s/insecure permissions [0-9]*/insecure permissions <perm>/g" \
+   $TS_OUTPUT $TS_ERRLOG
 
 rm -f $IMAGE
 fallocate_or_skip $MIN_SWAP_SIZE $IMAGE
-ts_run --unbuffered $TS_CMD_MKSWAP \
+$TS_CMD_MKSWAP \
        --label 1234567890abcdef \
        --uuid 12345678-abcd-abcd-abcd-1234567890ab \
-       $IMAGE 2>&1 |\
-       sed -e "s/ $(( $MIN_SWAP_SIZE_KB - $PAGE_SIZE_KB )) KiB/ 9 pages/" \
-           -e "s/($(( $MIN_SWAP_SIZE - $PAGE_SIZE )) bytes)/(9xPGSZ bytes)/" \
-           -e "s:$IMAGE:<swapfile>:g" \
-           -e "s/insecure permissions [0-9]*/insecure permissions <perm>/g" \
-       >> $TS_OUTPUT 2>> $TS_ERRLOG
+       $IMAGE >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+sed -i -e "s/ $(( $MIN_SWAP_SIZE_KB - $PAGE_SIZE_KB )) KiB/ 9 pages/" \
+    -e "s/($(( $MIN_SWAP_SIZE - $PAGE_SIZE )) bytes)/(9xPGSZ bytes)/" \
+    -e "s:$IMAGE:<swapfile>:g" \
+    -e "s/insecure permissions [0-9]*/insecure permissions <perm>/g" \
+    $TS_OUTPUT $TS_ERRLOG
+
 $TS_CMD_SWAPLABEL $IMAGE >> $TS_OUTPUT 2>> $TS_ERRLOG
 
 #rm -f $IMAGE
index c7810bb342ec85ed8b621096e0d1a29c49025c6d..a9d9095fd8a98801b350f70fb4f7334454422719 100755 (executable)
@@ -33,7 +33,7 @@ $TS_CMD_RENAME -v codes values rename_exit_codes.? >> $TS_OUTPUT 2>> $TS_ERRLOG
 echo "EXIT_SUCCESS: $?" >> $TS_OUTPUT
 
 mkdir rename_exit_codes.2
-ts_run --unbuffered $TS_CMD_RENAME -v values codes rename_exit_values.? >> $TS_OUTPUT 2>> $TS_ERRLOG
+$TS_CMD_RENAME -v values codes rename_exit_values.? >> $TS_OUTPUT 2>> $TS_ERRLOG
 echo "RENAME_EXIT_SOMEOK: $?" >> $TS_OUTPUT
 
 rmdir rename_exit_codes.2