From: Vojtěch Eichler Date: Tue, 19 Oct 2021 18:45:28 +0000 (+0200) Subject: tests: split additional tests into subtests X-Git-Tag: v2.38-rc1~199^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b75bc0e78f1d2a9e76b900de8ca17f176483cafb;p=thirdparty%2Futil-linux.git tests: split additional tests into subtests --- diff --git a/tests/expected/misc/line b/tests/expected/misc/line index 783ef801f5..e69de29bb2 100644 --- a/tests/expected/misc/line +++ b/tests/expected/misc/line @@ -1,25 +0,0 @@ -# usually behave like "head -n 1" -a -ret: 0 -# never consume more than one line -1 -2 -ret: 0 -# add a newline -abc -ret: 1 -# print one newline on empty input - -ret: 1 -# add a newline, return 1 when EOF -xyz -ret: 1 -# print one newline on empty input, return 1 when EOF - -ret: 1 -# large line of zero bytes -00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -* -00100000 0a |.| -00100001 -ret: 0 diff --git a/tests/expected/misc/line-empty-input b/tests/expected/misc/line-empty-input new file mode 100644 index 0000000000..29c61d5df1 --- /dev/null +++ b/tests/expected/misc/line-empty-input @@ -0,0 +1,2 @@ + +ret: 1 diff --git a/tests/expected/misc/line-empty-input-wait-for-eof b/tests/expected/misc/line-empty-input-wait-for-eof new file mode 100644 index 0000000000..29c61d5df1 --- /dev/null +++ b/tests/expected/misc/line-empty-input-wait-for-eof @@ -0,0 +1,2 @@ + +ret: 1 diff --git a/tests/expected/misc/line-large-line b/tests/expected/misc/line-large-line new file mode 100644 index 0000000000..dc4f520231 --- /dev/null +++ b/tests/expected/misc/line-large-line @@ -0,0 +1,5 @@ +00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00100000 0a |.| +00100001 +ret: 0 diff --git a/tests/expected/misc/line-one-call b/tests/expected/misc/line-one-call new file mode 100644 index 0000000000..cbf0b3b719 --- /dev/null +++ b/tests/expected/misc/line-one-call @@ -0,0 +1,2 @@ +a +ret: 0 diff --git a/tests/expected/misc/line-text-without-eol b/tests/expected/misc/line-text-without-eol new file mode 100644 index 0000000000..42f49d60f8 --- /dev/null +++ b/tests/expected/misc/line-text-without-eol @@ -0,0 +1,2 @@ +abc +ret: 1 diff --git a/tests/expected/misc/line-two-calls b/tests/expected/misc/line-two-calls new file mode 100644 index 0000000000..dfe723fe27 --- /dev/null +++ b/tests/expected/misc/line-two-calls @@ -0,0 +1,3 @@ +1 +2 +ret: 0 diff --git a/tests/expected/misc/line-wait-for-eof b/tests/expected/misc/line-wait-for-eof new file mode 100644 index 0000000000..fcc3c8f278 --- /dev/null +++ b/tests/expected/misc/line-wait-for-eof @@ -0,0 +1,2 @@ +xyz +ret: 1 diff --git a/tests/expected/ul/basic b/tests/expected/ul/basic index 8838f14724..e69de29bb2 100644 --- a/tests/expected/ul/basic +++ b/tests/expected/ul/basic @@ -1,111 +0,0 @@ -printable characters - -! -" -# -$ -% -& -' -( -) -* -+ -, -- -. -/ -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -: -; -< -= -> -? -@ -A -B -C -D -E -F -G -H -I -J -K -L -M -N -O -P -Q -R -S -T -U -V -W -X -Y -Z -[ -\ -] -^ -_ -` -a -b -c -d -e -f -g -h -i -j -k -l -m -n -o -p -q -r -s -t -u -v -w -x -y -z -{ -| -} -~ -filter input -backspacex - tab -R -SO -SI(B -underline -flush - after flush -normal -reverse -eof -indicated -ul -__ diff --git a/tests/expected/ul/basic-filter-input b/tests/expected/ul/basic-filter-input new file mode 100644 index 0000000000..b8154c1bf7 --- /dev/null +++ b/tests/expected/ul/basic-filter-input @@ -0,0 +1,11 @@ +backspacex + tab +R +SO +SI(B +underline +flush + after flush +normal +reverse +eof diff --git a/tests/expected/ul/basic-indicated b/tests/expected/ul/basic-indicated new file mode 100644 index 0000000000..5b57285c50 --- /dev/null +++ b/tests/expected/ul/basic-indicated @@ -0,0 +1,2 @@ +ul +__ diff --git a/tests/expected/ul/basic-printable-characters b/tests/expected/ul/basic-printable-characters new file mode 100644 index 0000000000..3bc7fbc7be --- /dev/null +++ b/tests/expected/ul/basic-printable-characters @@ -0,0 +1,95 @@ + +! +" +# +$ +% +& +' +( +) +* ++ +, +- +. +/ +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +: +; +< += +> +? +@ +A +B +C +D +E +F +G +H +I +J +K +L +M +N +O +P +Q +R +S +T +U +V +W +X +Y +Z +[ +\ +] +^ +_ +` +a +b +c +d +e +f +g +h +i +j +k +l +m +n +o +p +q +r +s +t +u +v +w +x +y +z +{ +| +} +~ diff --git a/tests/ts/misc/line b/tests/ts/misc/line index 62fcb7964d..8424fc7f0b 100755 --- a/tests/ts/misc/line +++ b/tests/ts/misc/line @@ -21,38 +21,45 @@ ts_init "$*" ts_check_test_command "$TS_CMD_LINE" ts_check_test_command "$TS_CMD_HEXDUMP" -ts_log '# usually behave like "head -n 1"' +ts_init_subtest 'one-call' printf "a\nb\n" | $TS_CMD_LINE >> $TS_OUTPUT 2>> $TS_ERRLOG echo "ret: $?" >> $TS_OUTPUT +ts_finalize_subtest -ts_log '# never consume more than one line' +ts_init_subtest 'two-calls' printf "1\n2\n" | ($TS_CMD_LINE && $TS_CMD_LINE) >> $TS_OUTPUT 2>> $TS_ERRLOG echo "ret: $?" >> $TS_OUTPUT +ts_finalize_subtest -ts_log '# add a newline' +ts_init_subtest 'text-without-eol' printf "abc" | $TS_CMD_LINE >> $TS_OUTPUT 2>> $TS_ERRLOG echo "ret: $?" >> $TS_OUTPUT +ts_finalize_subtest -ts_log '# print one newline on empty input' +ts_init_subtest 'empty-input' printf "" | $TS_CMD_LINE >> $TS_OUTPUT 2>> $TS_ERRLOG echo "ret: $?" >> $TS_OUTPUT +ts_finalize_subtest -ts_log '# add a newline, return 1 when EOF' +ts_init_subtest 'wait-for-eof' (printf "xyz" && cat > $TS_OUTPUT 2>> $TS_ERRLOG echo "ret: $?" >> $TS_OUTPUT +ts_finalize_subtest -ts_log '# print one newline on empty input, return 1 when EOF' +ts_init_subtest 'empty-input-wait-for-eof' $TS_CMD_LINE > $TS_OUTPUT 2>> $TS_ERRLOG echo "ret: $?" >> $TS_OUTPUT +ts_finalize_subtest -ts_log '# large line of zero bytes' +ts_init_subtest 'large-line' dd if=/dev/zero bs=1k count=1k 2>/dev/null | $TS_CMD_LINE line | $TS_CMD_HEXDUMP -C >> $TS_OUTPUT 2>> $TS_ERRLOG echo "ret: $?" >> $TS_OUTPUT +ts_finalize_subtest ts_finalize diff --git a/tests/ts/ul/basic b/tests/ts/ul/basic index 5a7ff03687..883c8dea08 100755 --- a/tests/ts/ul/basic +++ b/tests/ts/ul/basic @@ -27,13 +27,16 @@ ts_check_test_command "$TS_CMD_UL" # This test provides different result on some terminals and virtual machines TS_KNOWN_FAIL="yes" -ts_log "printable characters" +ts_init_subtest "printable-characters" $TS_CMD_UL < $TS_SELF/basic.input >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest -ts_log "filter input" +ts_init_subtest "filter-input" $TS_CMD_UL $TS_SELF/filter.input >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest -ts_log "indicated" +ts_init_subtest "indicated" printf "u\b_l\b_\n" | ul --indicated >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest ts_finalize