summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2014-05-14 13:19:37 +0200
committerKarel Zak2014-05-14 13:19:37 +0200
commitbb04c0773ff939f3d0cf802abaad67c14f16250a (patch)
tree9c41232d8726fec16ffa98117ac8d94055aaf2de
parentlosetup: fix -f on systems without /dev/loop-control (diff)
parenttests, script/race is known to fail (diff)
downloadkernel-qcow2-util-linux-bb04c0773ff939f3d0cf802abaad67c14f16250a.tar.gz
kernel-qcow2-util-linux-bb04c0773ff939f3d0cf802abaad67c14f16250a.tar.xz
kernel-qcow2-util-linux-bb04c0773ff939f3d0cf802abaad67c14f16250a.zip
Merge branch 'tests-known' of https://github.com/rudimeier/util-linux
* 'tests-known' of https://github.com/rudimeier/util-linux: tests, script/race is known to fail tests: script/race would work with variable loop count tests: ipcs/limits2 is known to fail tests: fix hexdump for big endian tests, add missing output for hexdump tests: fix hexdump, add ts_finalize tests: fix "KNOWN FAILED" for subtests
-rw-r--r--tests/expected/hexdump/highlighting0
-rw-r--r--tests/expected/hexdump/highlighting-2b_dec-841
-rw-r--r--tests/expected/script/race2
-rw-r--r--tests/functions.sh27
-rwxr-xr-xtests/ts/hexdump/format-strings8
-rwxr-xr-xtests/ts/hexdump/highlighting27
-rwxr-xr-xtests/ts/ipcs/limits25
-rwxr-xr-xtests/ts/script/race14
8 files changed, 106 insertions, 18 deletions
diff --git a/tests/expected/hexdump/highlighting b/tests/expected/hexdump/highlighting
deleted file mode 100644
index e69de29bb..000000000
--- a/tests/expected/hexdump/highlighting
+++ /dev/null
diff --git a/tests/expected/hexdump/highlighting-2b_dec-8 b/tests/expected/hexdump/highlighting-2b_dec-8
new file mode 100644
index 000000000..c62a559cc
--- /dev/null
+++ b/tests/expected/hexdump/highlighting-2b_dec-8
@@ -0,0 +1,41 @@
+0000000 08192 08193 08194 08195 08196 08197 08198 08199
+0000010 08200 08201 08202 08203 08204 08205 08206 08207
+0000020 08208 08209 08210 08211 08212 08213 08214 08215
+0000030 08216 08217 08218 08219 08220 08221 08222 08223
+0000040 08224 08225 08226 08227 08228 08229 08230 08231
+0000050 08232 08233 08234 08235 08236 08237 08238 08239
+0000060 08240  08241  08242  08243 08244 08245 08246 08247
+0000070 08248 08249 08250 08251 08252 08253 08254 08255
+0000080 08256 08257 08258 08259 08260 08261 08262 08263
+0000090 08264 08265 08266 08267 08268 08269 08270 08271
+00000a0 08272 08273 08274 08275 08276 08277 08278 08279
+00000b0 08280 08281 08282 08283 08284 08285 08286 08287
+00000c0 08288 08289 08290 08291 08292 08293 08294 08295
+00000d0 08296 08297 08298 08299 08300 08301 08302 08303
+00000e0 08304 08305 08306 08307 08308 08309 08310 08311
+00000f0 08312 08313 08314 08315 08316 08317 08318 08319
+0000100 32962 49696 08321 33474 49696 08323 33986 49696
+0000110 08325 34498 49696 08327 35010 49696 08329 35522
+0000120 49696 08331 36034 49696 08333 36546 49696 08335
+0000130 37058 49696 08337 37570 49696 08339 38082 49696
+0000140 08341 38594 49696 08343 39106 49696 08345 39618
+0000150 49696 08347 40130 49696 08349 40642 49696 08351
+0000160 41154 49696 08353 41666 49696 08355 42178 49696
+0000170 08357 42690 49696 08359 43202 49696 08361 43714
+0000180 49696 08363 44226 49696 08365 44738 49696 08367
+0000190 45250 49696 08369 45762 49696 08371 46274 49696
+00001a0 08373 46786 49696 08375 47298 49696 08377 47810
+00001b0 49696 08379 48322 49696 08381 48834 49696 08383
+00001c0 32963 49952 08321 33475 49952 08323 33987 49952
+00001d0 08325 34499 49952 08327 35011 49952 08329 35523
+00001e0 49952 08331 36035 49952 08333 36547 49952 08335
+00001f0 37059 49952 08337 37571 49952 08339 38083 49952
+0000200 08341 38595 49952 08343 39107 49952 08345 39619
+0000210 49952 08347 40131 49952 08349 40643 49952 08351
+0000220 41155 49952 08353 41667 49952 08355 42179 49952
+0000230 08357 42691 49952 08359 43203 49952 08361 43715
+0000240 49952 08363 44227 49952 08365 44739 49952 08367
+0000250 45251 49952 08369 45763 49952 08371 46275 49952
+0000260 08373 46787 49952 08375 47299 49952 08377 47811
+0000270 49952 08379 48323 49952 08381 48835 49952 08383
+0000280
diff --git a/tests/expected/script/race b/tests/expected/script/race
index 83b33d238..faede5f62 100644
--- a/tests/expected/script/race
+++ b/tests/expected/script/race
@@ -1 +1 @@
-1000
+all bingos seen
diff --git a/tests/functions.sh b/tests/functions.sh
index 1dc671d9e..7174a35af 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -64,25 +64,25 @@ function ts_skip_nonroot {
}
function ts_failed_subtest {
+ local msg="FAILED"
+ local ret=1
+ if [ "$TS_KNOWN_FAIL" = "yes" ]; then
+ msg="KNOWN FAILED"
+ ret=0
+ fi
+
if [ x"$1" == x"" ]; then
- ts_report " FAILED ($TS_NS)"
+ ts_report " $msg ($TS_NS)"
else
- ts_report " FAILED ($1)"
+ ts_report " $msg ($1)"
fi
+
+ return $ret
}
function ts_failed {
ts_failed_subtest "$1"
- exit 1
-}
-
-function ts_known_failed {
- if [ x"$1" == x"" ]; then
- ts_report " KNOWN FAILED ($TS_NS)"
- else
- ts_report " KNOWN FAILED ($1)"
- fi
- exit 0
+ exit $?
}
function ts_ok_subtest {
@@ -393,9 +393,6 @@ function ts_finalize {
if [ -s $TS_EXPECTED ]; then
ts_gen_diff
if [ $? -eq 1 ]; then
- if [ "$TS_KNOWN_FAIL" = "yes" ]; then
- ts_known_failed "$1"
- fi
ts_failed "$1"
fi
ts_ok "$1"
diff --git a/tests/ts/hexdump/format-strings b/tests/ts/hexdump/format-strings
index 229e6513f..f3d9289c7 100755
--- a/tests/ts/hexdump/format-strings
+++ b/tests/ts/hexdump/format-strings
@@ -24,8 +24,13 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_HEXDUMP"
+# on big endian systems some of the subtests have different expected output
+BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order)
+BE_EXT=$(test "$BYTE_ORDER" = "BE" && echo ".BE")
+
#885314
ts_init_subtest "empty-format"
+TS_EXPECTED+=$BE_EXT
INPUT=$(printf \\1)
$TS_CMD_HEXDUMP -n1 -ve '2 "" "%x"' <<< $INPUT 2>&1 >> $TS_OUTPUT
@@ -46,14 +51,17 @@ $TS_CMD_HEXDUMP -C $FILES/ascii.in &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "2b_dec"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP -d $FILES/ascii.in &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "2b_octal"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP -o $FILES/ascii.in &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "2b_hex"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP -x $FILES/ascii.in &> $TS_OUTPUT
ts_finalize_subtest
diff --git a/tests/ts/hexdump/highlighting b/tests/ts/hexdump/highlighting
index 45d1a6c3f..cf78f7b96 100755
--- a/tests/ts/hexdump/highlighting
+++ b/tests/ts/hexdump/highlighting
@@ -24,7 +24,11 @@ ADDRFMT='-e "%07.7_Ax\n"'
. $TS_TOPDIR/functions.sh
ts_init "$*"
-[ -x $TS_CMD_HEXDUMP ] || ts_skip "hexdump not compiled"
+ts_check_test_command "$TS_CMD_HEXDUMP"
+
+# on big endian systems some of the subtests have different expected output
+BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order)
+BE_EXT=$(test "$BYTE_ORDER" = "BE" && echo ".BE")
#
# basic formats /w some highlighting tweaks
@@ -39,6 +43,7 @@ ts_finalize_subtest
# highlight bytes with the value of 0x41 (A) and 0x61 (a)
ts_init_subtest "1b_octal-2"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 16/1 "%03o_L[red:0x41,red:0x61] " "\n"' \
$FILES/ascii.in &> $TS_OUTPUT
@@ -54,6 +59,7 @@ ts_finalize_subtest
# highlight the byte at offset 194 if it's value is 0x61 (a)
# and the byte at offset 130 if it's value is A (0x41)
ts_init_subtest "1b_octal-4"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 16/1 "%03o_L[red:A@130,red:0x61@194] " "\n"' \
$FILES/ascii.in &> $TS_OUTPUT
@@ -62,6 +68,7 @@ ts_finalize_subtest
# highlight the byte at offset 194 if it's value is 0x61 (a)
# and the byte at offset 130 if it's value is C (0x41) (false)
ts_init_subtest "1b_octal-5"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 16/1 "%03o_L[red:C@130,red:0x61@194] " "\n"' \
$FILES/ascii.in &> $TS_OUTPUT
@@ -76,6 +83,7 @@ ts_finalize_subtest
# highlight bytes with the value of 0101 (A) and 0141 (a)
ts_init_subtest "1b_octal-7"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 16/1 "%03o_L[red:0101,red:0141] " "\n"' \
$FILES/ascii.in &> $TS_OUTPUT
@@ -83,6 +91,7 @@ ts_finalize_subtest
# highlight bytes with the value of 0101 (A), 0x61 (a), or if the character is a caret
ts_init_subtest "1b_octal-8"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 16/1 "%03o_L[red:0101,blue:0x61,green:^] " "\n"' \
$FILES/ascii.in &> $TS_OUTPUT
@@ -90,6 +99,7 @@ ts_finalize_subtest
# highlight bytes with the value of 0101 (A), 0x61 (a), or if the character at 196 is not 'c'
ts_init_subtest "1b_octal-9"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 16/1 "%03o_L[red:0101,blue:0x61,!green:c@196] " "\n"' \
$FILES/ascii.in &> $TS_OUTPUT
@@ -118,6 +128,7 @@ ts_finalize_subtest
# color last address gray, the null byte blue, the spaces brown(-ish) and the text cyan
ts_init_subtest "canon-1"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS \
-e '"%08.8_Ax_L[gray]\n"' \
-e '"%08.8_ax " 8/1 "%02x_L[blue:0x0,brown:0x20] " " " 8/1 "%02x_L[brown:0x20] " ' \
@@ -137,6 +148,7 @@ ts_finalize_subtest
# color the current print unit if one of the bytes it prints is at offset 100 (0x64)
ts_init_subtest "2b_dec-1"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 8/2 " %05u_L[red@100] " "\n"' \
$FILES/ascii.in &> $TS_OUTPUT
@@ -144,6 +156,7 @@ ts_finalize_subtest
# color the current print unit if of the bytes it prints are at offsets 98 and 99
ts_init_subtest "2b_dec-2"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 8/2 " %05u_L[red@98-99] " "\n"' \
$FILES/ascii.in &> $TS_OUTPUT
@@ -151,6 +164,7 @@ ts_finalize_subtest
# color the current print unit if some or all of the bytes it prints are at offsets 98 and 99
ts_init_subtest "2b_dec-3"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 8/2 " %05u_L[red@97-99] " "\n"' \
$FILES/ascii.in &> $TS_OUTPUT
@@ -158,6 +172,7 @@ ts_finalize_subtest
# color the current print unit if it prints "A " at 130-131
ts_init_subtest "2b_dec-4"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 8/2 " %05u_L[red:A @130-131] " "\n"' \
$FILES/ascii.in &> $TS_OUTPUT
@@ -165,6 +180,7 @@ ts_finalize_subtest
# color the current print unit if it doesn't print "B " at 130-131
ts_init_subtest "2b_dec-5"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 8/2 " %05u_L[!red:B @130-131] " "\n"' \
$FILES/ascii.in &> $TS_OUTPUT
@@ -186,6 +202,7 @@ ts_finalize_subtest
# color the current print unit if of the bytes it prints are at offsets 98-102 (multiple print units)
ts_init_subtest "2b_dec-8"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 8/2 " %05u_L[red@98-102] " "\n"' \
$FILES/ascii.in &> $TS_OUTPUT
@@ -193,6 +210,7 @@ ts_finalize_subtest
# color the current print unit if some or all of the bytes it prints are at offsets 97 and 99 (true)
ts_init_subtest "4b_dec-1"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 8/4 " %05u_L[red@97-99] " "\n"' \
$FILES/ascii.in &> $TS_OUTPUT
@@ -200,6 +218,7 @@ ts_finalize_subtest
# color the current print unit if some or all of the bytes it prints are at offsets 96-99
ts_init_subtest "4b_dec-2"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 8/4 " %05u_L[red@96-99] " "\n"' \
$FILES/ascii.in &> $TS_OUTPUT
@@ -207,6 +226,7 @@ ts_finalize_subtest
# look for @@@@
ts_init_subtest "4b_dec-3"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 8/4 " %05u_L[red:@@@@] " "\n"' \
&> $TS_OUTPUT <<< "@@@@"
@@ -214,6 +234,7 @@ ts_finalize_subtest
# look for @@@@ at 0-3
ts_init_subtest "4b_dec-4"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 8/4 " %05u_L[red:@@@@@0-3] " "\n"' \
&> $TS_OUTPUT <<< "@@@@"
@@ -228,6 +249,7 @@ ts_finalize_subtest
# look for @@@ at 1-3 - in the format boundaries - correct
ts_init_subtest "4b_dec-6"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 8/4 " %05u_L[red:@@@@1-3] " "\n"' \
&> $TS_OUTPUT <<< "@@@@"
@@ -235,7 +257,10 @@ ts_finalize_subtest
# look for @@@ at 2-4 - correct range length, however steps over 2 print units - no colors
ts_init_subtest "4b_dec-7"
+TS_EXPECTED+=$BE_EXT
$TS_CMD_HEXDUMP $OPTS $ADDRFMT \
-e '"%07.7_ax " 8/4 " %05u_L[red:@@@@2-4] " "\n"' \
&> $TS_OUTPUT <<< "@@@@"
ts_finalize_subtest
+
+ts_finalize
diff --git a/tests/ts/ipcs/limits2 b/tests/ts/ipcs/limits2
index 7a7549aa3..ea90174b9 100755
--- a/tests/ts/ipcs/limits2
+++ b/tests/ts/ipcs/limits2
@@ -28,6 +28,11 @@ type bc >/dev/null 2>&1 || ts_skip "cannot find bc command"
. $TS_SELF/functions.sh
+# TODO https://github.com/karelzak/util-linux/issues/51
+if [ $(</proc/sys/kernel/shmall) -ge $(bc <<<"2^64 / $PAGE_SIZE") ]; then
+ TS_KNOWN_FAIL="yes"
+fi
+
ts_log "check for difference between kernel and IPC"
ipcs_limits_check >> $TS_OUTPUT
diff --git a/tests/ts/script/race b/tests/ts/script/race
index ef7e83f12..c94740236 100755
--- a/tests/ts/script/race
+++ b/tests/ts/script/race
@@ -24,14 +24,26 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_SCRIPT"
+# TODO see comments about script design
+# https://github.com/karelzak/util-linux/pull/62
+TS_KNOWN_FAIL="yes"
+
bingofile="$TS_OUTDIR/${TS_TESTNAME}-bingo"
set -o pipefail
-for i in `seq 1 1000`; do
+count=1000
+for i in `seq 1 $count`; do
$TS_CMD_SCRIPT -q -c "printf 'Bingo\n'" $bingofile
done | grep -c Bingo >> $TS_OUTPUT
+seen=$(<$TS_OUTPUT)
+if [ $seen = $count ]; then
+ echo "all bingos seen" > $TS_OUTPUT
+else
+ echo "only $seen of $count bingos seen" > $TS_OUTPUT
+fi
+
rm -f $bingofile
ts_finalize