From: Patrick Steinhardt Date: Fri, 23 Aug 2019 13:32:54 +0000 (+0200) Subject: tests: (libfdisk) remove reliance on buffer behaviour of standard streams X-Git-Tag: v2.35-rc1~266 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8892f94c5777dd667b963ac70f48c3c8ac05c880;p=thirdparty%2Futil-linux.git tests: (libfdisk) remove reliance on buffer behaviour of standard streams The tests in libfdisk/mkpart-full all rely on the buffering behaviour of standard output and standard error streams, most importantly that stderr is non-buffering and stdout is buffering. This doesn't hold on all libc implementations when redirecting to a file, breaking the test suite on such platforms. Use `ts_run --unbuffered` to stop buffering of the standard output stream to fix this. Signed-off-by: Patrick Steinhardt --- diff --git a/tests/expected/libfdisk/mkpart-full-gpt b/tests/expected/libfdisk/mkpart-full-gpt index d33483ac6c..7740454fd3 100644 --- a/tests/expected/libfdisk/mkpart-full-gpt +++ b/tests/expected/libfdisk/mkpart-full-gpt @@ -1,17 +1,17 @@ -Requested partition: -Requested partition: -Requested partition: -Requested partition: -Requested partition: -Requested partition: -Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . Disk : 15 MiB, 15728640 bytes, 30720 sectors Units: sectors of 1 * 512 = 512 bytes diff --git a/tests/expected/libfdisk/mkpart-full-gpt-err-overlap b/tests/expected/libfdisk/mkpart-full-gpt-err-overlap index 6733392309..ebf0784158 100644 --- a/tests/expected/libfdisk/mkpart-full-gpt-err-overlap +++ b/tests/expected/libfdisk/mkpart-full-gpt-err-overlap @@ -1,11 +1,11 @@ -Requested partition: -Requested partition: -Requested partition: -Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Sector 5000 already used. sample-fdisk-mkpart-fullspec: failed to add #4 partition Disk : 15 MiB, 15728640 bytes, 30720 sectors diff --git a/tests/expected/libfdisk/mkpart-full-gpt-nopartno b/tests/expected/libfdisk/mkpart-full-gpt-nopartno index 2c1423b751..fc9fdf2407 100644 --- a/tests/expected/libfdisk/mkpart-full-gpt-nopartno +++ b/tests/expected/libfdisk/mkpart-full-gpt-nopartno @@ -1,17 +1,17 @@ -Requested partition: ,start=2048,size=2048> -Requested partition: ,start=4096,size=2048> -Requested partition: ,start=6144,size=2048> -Requested partition: ,start=8192,size=2048> -Requested partition: ,start=10240,size=2048> -Requested partition: ,start=12288,size=2048> -Requested partition: ,start=14336,size=2048> Created a new . +Requested partition: ,start=2048,size=2048> Created a new . +Requested partition: ,start=4096,size=2048> Created a new . +Requested partition: ,start=6144,size=2048> Created a new . +Requested partition: ,start=8192,size=2048> Created a new . +Requested partition: ,start=10240,size=2048> Created a new . +Requested partition: ,start=12288,size=2048> Created a new . +Requested partition: ,start=14336,size=2048> Created a new . Disk : 15 MiB, 15728640 bytes, 30720 sectors Units: sectors of 1 * 512 = 512 bytes diff --git a/tests/expected/libfdisk/mkpart-full-gpt-partno-gap b/tests/expected/libfdisk/mkpart-full-gpt-partno-gap index b142b5efe3..3a65d37e42 100644 --- a/tests/expected/libfdisk/mkpart-full-gpt-partno-gap +++ b/tests/expected/libfdisk/mkpart-full-gpt-partno-gap @@ -1,17 +1,17 @@ -Requested partition: -Requested partition: -Requested partition: -Requested partition: -Requested partition: -Requested partition: -Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . Disk : 15 MiB, 15728640 bytes, 30720 sectors Units: sectors of 1 * 512 = 512 bytes diff --git a/tests/expected/libfdisk/mkpart-full-gpt-space-gap b/tests/expected/libfdisk/mkpart-full-gpt-space-gap index c26f2896ba..64b2da4ab2 100644 --- a/tests/expected/libfdisk/mkpart-full-gpt-space-gap +++ b/tests/expected/libfdisk/mkpart-full-gpt-space-gap @@ -1,13 +1,13 @@ -Requested partition: -Requested partition: -Requested partition: -Requested partition: -Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . Disk : 15 MiB, 15728640 bytes, 30720 sectors Units: sectors of 1 * 512 = 512 bytes diff --git a/tests/expected/libfdisk/mkpart-full-mbr-err-logical b/tests/expected/libfdisk/mkpart-full-mbr-err-logical index c2c0b0df62..6d48f487a6 100644 --- a/tests/expected/libfdisk/mkpart-full-mbr-err-logical +++ b/tests/expected/libfdisk/mkpart-full-mbr-err-logical @@ -1,17 +1,17 @@ -Requested partition: -Requested partition: -Requested partition: -Requested partition: -Requested partition: -Requested partition: -sample-fdisk-mkpart-fullspec: failed to add #6 partition Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Adding logical partition 5 Created a new . +Requested partition: +sample-fdisk-mkpart-fullspec: failed to add #6 partition Disk : 15 MiB, 15728640 bytes, 30720 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes diff --git a/tests/expected/libfdisk/mkpart-full-mbr-err-nospace b/tests/expected/libfdisk/mkpart-full-mbr-err-nospace index d7a0065699..a79c5800a1 100644 --- a/tests/expected/libfdisk/mkpart-full-mbr-err-nospace +++ b/tests/expected/libfdisk/mkpart-full-mbr-err-nospace @@ -1,9 +1,9 @@ -Requested partition: -Requested partition: -Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Start sector 4096 out of range. sample-fdisk-mkpart-fullspec: failed to add #3 partition Disk : 15 MiB, 15728640 bytes, 30720 sectors diff --git a/tests/expected/libfdisk/mkpart-full-mbr-err-primary b/tests/expected/libfdisk/mkpart-full-mbr-err-primary index 1142f65312..93edf2b074 100644 --- a/tests/expected/libfdisk/mkpart-full-mbr-err-primary +++ b/tests/expected/libfdisk/mkpart-full-mbr-err-primary @@ -1,9 +1,9 @@ -Requested partition: -Requested partition: -Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Extended partition does not exists. Failed to add logical partition. sample-fdisk-mkpart-fullspec: failed to add #7 partition Disk : 15 MiB, 15728640 bytes, 30720 sectors diff --git a/tests/expected/libfdisk/mkpart-full-mbr-logical b/tests/expected/libfdisk/mkpart-full-mbr-logical index 97e7a4a540..ff2611cbb2 100644 --- a/tests/expected/libfdisk/mkpart-full-mbr-logical +++ b/tests/expected/libfdisk/mkpart-full-mbr-logical @@ -1,19 +1,19 @@ -Requested partition: -Requested partition: -Requested partition: -Requested partition: -Requested partition: -Requested partition: -Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Adding logical partition 5 Created a new . +Requested partition: Adding logical partition 6 Created a new . +Requested partition: Adding logical partition 7 Created a new . Disk : 15 MiB, 15728640 bytes, 30720 sectors diff --git a/tests/expected/libfdisk/mkpart-full-mbr-nopartno b/tests/expected/libfdisk/mkpart-full-mbr-nopartno index 23f7ad5a75..c8c449cd1b 100644 --- a/tests/expected/libfdisk/mkpart-full-mbr-nopartno +++ b/tests/expected/libfdisk/mkpart-full-mbr-nopartno @@ -1,19 +1,19 @@ -Requested partition: ,start=2048,size=2048> -Requested partition: ,start=4096,size=2048> -Requested partition: ,start=6144,size=2048> -Requested partition: ,start=8192,size=22528> -Requested partition: ,start=10240,size=2048> -Requested partition: ,start=14336,size=2048> -Requested partition: ,start=18432,size=12288> Created a new . +Requested partition: ,start=2048,size=2048> Created a new . +Requested partition: ,start=4096,size=2048> Created a new . +Requested partition: ,start=6144,size=2048> Created a new . +Requested partition: ,start=8192,size=22528> Created a new . +Requested partition: ,start=10240,size=2048> Adding logical partition 5 Created a new . +Requested partition: ,start=14336,size=2048> Adding logical partition 6 Created a new . +Requested partition: ,start=18432,size=12288> Adding logical partition 7 Created a new . Disk : 15 MiB, 15728640 bytes, 30720 sectors diff --git a/tests/expected/libfdisk/mkpart-full-mbr-primary b/tests/expected/libfdisk/mkpart-full-mbr-primary index 31e84344d4..c71ec9e1fa 100644 --- a/tests/expected/libfdisk/mkpart-full-mbr-primary +++ b/tests/expected/libfdisk/mkpart-full-mbr-primary @@ -1,11 +1,11 @@ -Requested partition: -Requested partition: -Requested partition: -Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . Disk : 15 MiB, 15728640 bytes, 30720 sectors Units: sectors of 1 * 512 = 512 bytes diff --git a/tests/expected/libfdisk/mkpart-full-mbr-primary-nopartno b/tests/expected/libfdisk/mkpart-full-mbr-primary-nopartno index 90a71f3ab2..33ba9ff880 100644 --- a/tests/expected/libfdisk/mkpart-full-mbr-primary-nopartno +++ b/tests/expected/libfdisk/mkpart-full-mbr-primary-nopartno @@ -1,11 +1,11 @@ -Requested partition: ,start=2048,size=2048> -Requested partition: ,start=4096,size=2048> -Requested partition: ,start=6144,size=2048> -Requested partition: ,start=8192,size=22528> Created a new . +Requested partition: ,start=2048,size=2048> Created a new . +Requested partition: ,start=4096,size=2048> Created a new . +Requested partition: ,start=6144,size=2048> Created a new . +Requested partition: ,start=8192,size=22528> Created a new . Disk : 15 MiB, 15728640 bytes, 30720 sectors Units: sectors of 1 * 512 = 512 bytes diff --git a/tests/expected/libfdisk/mkpart-full-mbr-space-gap b/tests/expected/libfdisk/mkpart-full-mbr-space-gap index 45d45071fe..881ea9ec74 100644 --- a/tests/expected/libfdisk/mkpart-full-mbr-space-gap +++ b/tests/expected/libfdisk/mkpart-full-mbr-space-gap @@ -1,9 +1,9 @@ -Requested partition: -Requested partition: -Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . +Requested partition: Created a new . Disk : 15 MiB, 15728640 bytes, 30720 sectors Units: sectors of 1 * 512 = 512 bytes diff --git a/tests/ts/libfdisk/mkpart-full b/tests/ts/libfdisk/mkpart-full index eda506ef6b..9fb46ef670 100755 --- a/tests/ts/libfdisk/mkpart-full +++ b/tests/ts/libfdisk/mkpart-full @@ -31,7 +31,7 @@ ts_check_test_command "$TS_CMD_WIPEFS" TEST_IMAGE_NAME=$(ts_image_init 15) ts_init_subtest "mbr-primary" -$TESTPROG --label mbr --device ${TEST_IMAGE_NAME} \ +ts_run --unbuffered $TESTPROG --label mbr --device ${TEST_IMAGE_NAME} \ 1,2048,2048 \ 2,4096,2048 \ 3,6144,2048 \ @@ -45,7 +45,7 @@ $TS_CMD_WIPEFS --all --force ${TEST_IMAGE_NAME} &> /dev/null ts_init_subtest "mbr-primary-nopartno" -$TESTPROG --label mbr --device ${TEST_IMAGE_NAME} -- \ +ts_run --unbuffered $TESTPROG --label mbr --device ${TEST_IMAGE_NAME} -- \ -,2048,2048 \ -,4096,2048 \ -,6144,2048 \ @@ -59,7 +59,7 @@ $TS_CMD_WIPEFS --all --force ${TEST_IMAGE_NAME} &> /dev/null ## no extended but partno > 4 requested ts_init_subtest "mbr-err-primary" -$TESTPROG --label mbr --device ${TEST_IMAGE_NAME} \ +ts_run --unbuffered $TESTPROG --label mbr --device ${TEST_IMAGE_NAME} \ 1,2048,2048 \ 2,4096,2048 \ 7,6144,2048 \ @@ -72,7 +72,7 @@ $TS_CMD_WIPEFS --all --force ${TEST_IMAGE_NAME} &> /dev/null ## no extended but partno > 4 requested ts_init_subtest "mbr-err-nospace" -$TESTPROG --label mbr --device ${TEST_IMAGE_NAME} \ +ts_run --unbuffered $TESTPROG --label mbr --device ${TEST_IMAGE_NAME} \ 1,2048,2048 \ 2,4096,2048 \ 3,4096,2048 \ @@ -85,7 +85,7 @@ $TS_CMD_WIPEFS --all --force ${TEST_IMAGE_NAME} &> /dev/null ts_init_subtest "mbr-logical" -$TESTPROG --label mbr --device ${TEST_IMAGE_NAME} \ +ts_run --unbuffered $TESTPROG --label mbr --device ${TEST_IMAGE_NAME} \ 1,2048,2048 \ 2,4096,2048 \ 3,6144,2048 \ @@ -101,7 +101,7 @@ ts_finalize_subtest $TS_CMD_WIPEFS --all --force ${TEST_IMAGE_NAME} &> /dev/null ts_init_subtest "mbr-nopartno" -$TESTPROG --label mbr --device ${TEST_IMAGE_NAME} -- \ +ts_run --unbuffered $TESTPROG --label mbr --device ${TEST_IMAGE_NAME} -- \ -,2048,2048 \ -,4096,2048 \ -,6144,2048 \ @@ -118,7 +118,7 @@ $TS_CMD_WIPEFS --all --force ${TEST_IMAGE_NAME} &> /dev/null ### 6th partition (logical) out of extended ts_init_subtest "mbr-err-logical" -$TESTPROG --label mbr --device ${TEST_IMAGE_NAME} \ +ts_run --unbuffered $TESTPROG --label mbr --device ${TEST_IMAGE_NAME} \ 1,2048,2048 \ 2,4096,2048 \ 3,6144,2048 \ @@ -134,7 +134,7 @@ ts_finalize_subtest $TS_CMD_WIPEFS --all --force ${TEST_IMAGE_NAME} &> /dev/null ts_init_subtest "mbr-space-gap" -$TESTPROG --label mbr --device ${TEST_IMAGE_NAME} \ +ts_run --unbuffered $TESTPROG --label mbr --device ${TEST_IMAGE_NAME} \ 1,2048,2048 \ 2,6144,2048 \ 3,8192,2048 \ @@ -146,7 +146,7 @@ ts_finalize_subtest $TS_CMD_WIPEFS --all --force ${TEST_IMAGE_NAME} &> /dev/null ts_init_subtest "gpt" -$TESTPROG --label gpt --device ${TEST_IMAGE_NAME} \ +ts_run --unbuffered $TESTPROG --label gpt --device ${TEST_IMAGE_NAME} \ 1,2048,2048 \ 2,4096,2048 \ 3,6144,2048 \ @@ -162,7 +162,7 @@ ts_finalize_subtest $TS_CMD_WIPEFS --all --force ${TEST_IMAGE_NAME} &> /dev/null ts_init_subtest "gpt-nopartno" -$TESTPROG --label gpt --device ${TEST_IMAGE_NAME} -- \ +ts_run --unbuffered $TESTPROG --label gpt --device ${TEST_IMAGE_NAME} -- \ -,2048,2048 \ -,4096,2048 \ -,6144,2048 \ @@ -179,7 +179,7 @@ $TS_CMD_WIPEFS --all --force ${TEST_IMAGE_NAME} &> /dev/null ### 4th partition overlap 4th and 5th ts_init_subtest "gpt-err-overlap" -$TESTPROG --label gpt --device ${TEST_IMAGE_NAME} \ +ts_run --unbuffered $TESTPROG --label gpt --device ${TEST_IMAGE_NAME} \ 1,2048,2048 \ 2,4096,2048 \ 3,6144,2048 \ @@ -195,7 +195,7 @@ ts_finalize_subtest $TS_CMD_WIPEFS --all --force ${TEST_IMAGE_NAME} &> /dev/null ts_init_subtest "gpt-partno-gap" -$TESTPROG --label gpt --device ${TEST_IMAGE_NAME} \ +ts_run --unbuffered $TESTPROG --label gpt --device ${TEST_IMAGE_NAME} \ 1,2048,2048 \ 2,4096,2048 \ 4,6144,2048 \ @@ -211,7 +211,7 @@ ts_finalize_subtest $TS_CMD_WIPEFS --all --force ${TEST_IMAGE_NAME} &> /dev/null ts_init_subtest "gpt-space-gap" -$TESTPROG --label gpt --device ${TEST_IMAGE_NAME} \ +ts_run --unbuffered $TESTPROG --label gpt --device ${TEST_IMAGE_NAME} \ 1,2048,2048 \ 2,6144,2048 \ 3,8192,2048 \