]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: (libfdisk) remove reliance on buffer behaviour of standard streams
authorPatrick Steinhardt <ps@pks.im>
Fri, 23 Aug 2019 13:32:54 +0000 (15:32 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 27 Aug 2019 07:36:26 +0000 (09:36 +0200)
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 <ps@pks.im>
14 files changed:
tests/expected/libfdisk/mkpart-full-gpt
tests/expected/libfdisk/mkpart-full-gpt-err-overlap
tests/expected/libfdisk/mkpart-full-gpt-nopartno
tests/expected/libfdisk/mkpart-full-gpt-partno-gap
tests/expected/libfdisk/mkpart-full-gpt-space-gap
tests/expected/libfdisk/mkpart-full-mbr-err-logical
tests/expected/libfdisk/mkpart-full-mbr-err-nospace
tests/expected/libfdisk/mkpart-full-mbr-err-primary
tests/expected/libfdisk/mkpart-full-mbr-logical
tests/expected/libfdisk/mkpart-full-mbr-nopartno
tests/expected/libfdisk/mkpart-full-mbr-primary
tests/expected/libfdisk/mkpart-full-mbr-primary-nopartno
tests/expected/libfdisk/mkpart-full-mbr-space-gap
tests/ts/libfdisk/mkpart-full

index d33483ac6cfcdba9634211804cfb2692b2083184..7740454fd3006fe97cf05e47f1e4463d335d7d20 100644 (file)
@@ -1,17 +1,17 @@
-Requested partition: <partno=0,start=2048,size=2048>
-Requested partition: <partno=1,start=4096,size=2048>
-Requested partition: <partno=2,start=6144,size=2048>
-Requested partition: <partno=3,start=8192,size=2048>
-Requested partition: <partno=4,start=10240,size=2048>
-Requested partition: <partno=5,start=12288,size=2048>
-Requested partition: <partno=6,start=14336,size=2048>
 Created a new <removed>.
+Requested partition: <partno=0,start=2048,size=2048>
 Created a new <removed>.
+Requested partition: <partno=1,start=4096,size=2048>
 Created a new <removed>.
+Requested partition: <partno=2,start=6144,size=2048>
 Created a new <removed>.
+Requested partition: <partno=3,start=8192,size=2048>
 Created a new <removed>.
+Requested partition: <partno=4,start=10240,size=2048>
 Created a new <removed>.
+Requested partition: <partno=5,start=12288,size=2048>
 Created a new <removed>.
+Requested partition: <partno=6,start=14336,size=2048>
 Created a new <removed>.
 Disk <removed>: 15 MiB, 15728640 bytes, 30720 sectors
 Units: sectors of 1 * 512 = 512 bytes
index 6733392309e77fad2e7eb71725508844abfa3121..ebf0784158a20c7ef78d33a56255e8e03b55d063 100644 (file)
@@ -1,11 +1,11 @@
-Requested partition: <partno=0,start=2048,size=2048>
-Requested partition: <partno=1,start=4096,size=2048>
-Requested partition: <partno=2,start=6144,size=2048>
-Requested partition: <partno=3,start=5000,size=2048>
 Created a new <removed>.
+Requested partition: <partno=0,start=2048,size=2048>
 Created a new <removed>.
+Requested partition: <partno=1,start=4096,size=2048>
 Created a new <removed>.
+Requested partition: <partno=2,start=6144,size=2048>
 Created a new <removed>.
+Requested partition: <partno=3,start=5000,size=2048>
 Sector 5000 already used.
 sample-fdisk-mkpart-fullspec: failed to add #4 partition
 Disk <removed>: 15 MiB, 15728640 bytes, 30720 sectors
index 2c1423b751a0f01b1dbabd7a9bf0b4e90b1e4bca..fc9fdf2407134bc97577d290889e733eb19e2ebf 100644 (file)
@@ -1,17 +1,17 @@
-Requested partition: <partno=<default>,start=2048,size=2048>
-Requested partition: <partno=<default>,start=4096,size=2048>
-Requested partition: <partno=<default>,start=6144,size=2048>
-Requested partition: <partno=<default>,start=8192,size=2048>
-Requested partition: <partno=<default>,start=10240,size=2048>
-Requested partition: <partno=<default>,start=12288,size=2048>
-Requested partition: <partno=<default>,start=14336,size=2048>
 Created a new <removed>.
+Requested partition: <partno=<default>,start=2048,size=2048>
 Created a new <removed>.
+Requested partition: <partno=<default>,start=4096,size=2048>
 Created a new <removed>.
+Requested partition: <partno=<default>,start=6144,size=2048>
 Created a new <removed>.
+Requested partition: <partno=<default>,start=8192,size=2048>
 Created a new <removed>.
+Requested partition: <partno=<default>,start=10240,size=2048>
 Created a new <removed>.
+Requested partition: <partno=<default>,start=12288,size=2048>
 Created a new <removed>.
+Requested partition: <partno=<default>,start=14336,size=2048>
 Created a new <removed>.
 Disk <removed>: 15 MiB, 15728640 bytes, 30720 sectors
 Units: sectors of 1 * 512 = 512 bytes
index b142b5efe371e524259890e251dea6c5234378ef..3a65d37e42a145af0b03913a99442a595718c1df 100644 (file)
@@ -1,17 +1,17 @@
-Requested partition: <partno=0,start=2048,size=2048>
-Requested partition: <partno=1,start=4096,size=2048>
-Requested partition: <partno=3,start=6144,size=2048>
-Requested partition: <partno=4,start=8192,size=2048>
-Requested partition: <partno=6,start=10240,size=2048>
-Requested partition: <partno=7,start=12288,size=2048>
-Requested partition: <partno=8,start=14336,size=2048>
 Created a new <removed>.
+Requested partition: <partno=0,start=2048,size=2048>
 Created a new <removed>.
+Requested partition: <partno=1,start=4096,size=2048>
 Created a new <removed>.
+Requested partition: <partno=3,start=6144,size=2048>
 Created a new <removed>.
+Requested partition: <partno=4,start=8192,size=2048>
 Created a new <removed>.
+Requested partition: <partno=6,start=10240,size=2048>
 Created a new <removed>.
+Requested partition: <partno=7,start=12288,size=2048>
 Created a new <removed>.
+Requested partition: <partno=8,start=14336,size=2048>
 Created a new <removed>.
 Disk <removed>: 15 MiB, 15728640 bytes, 30720 sectors
 Units: sectors of 1 * 512 = 512 bytes
index c26f2896bac3d59cfde042369182ff6e4d673c45..64b2da4ab22df982737eb85e76446b48179c7c19 100644 (file)
@@ -1,13 +1,13 @@
-Requested partition: <partno=0,start=2048,size=2048>
-Requested partition: <partno=1,start=6144,size=2048>
-Requested partition: <partno=2,start=8192,size=2048>
-Requested partition: <partno=3,start=12288,size=2048>
-Requested partition: <partno=4,start=14336,size=2048>
 Created a new <removed>.
+Requested partition: <partno=0,start=2048,size=2048>
 Created a new <removed>.
+Requested partition: <partno=1,start=6144,size=2048>
 Created a new <removed>.
+Requested partition: <partno=2,start=8192,size=2048>
 Created a new <removed>.
+Requested partition: <partno=3,start=12288,size=2048>
 Created a new <removed>.
+Requested partition: <partno=4,start=14336,size=2048>
 Created a new <removed>.
 Disk <removed>: 15 MiB, 15728640 bytes, 30720 sectors
 Units: sectors of 1 * 512 = 512 bytes
index c2c0b0df620c355ec99fc57f10c7f01188381d84..6d48f487a62b0a096faac34ecb9143f528b666cf 100644 (file)
@@ -1,17 +1,17 @@
-Requested partition: <partno=0,start=2048,size=2048>
-Requested partition: <partno=1,start=4096,size=2048>
-Requested partition: <partno=2,start=6144,size=2048>
-Requested partition: <partno=3,start=8192,size=22528>
-Requested partition: <partno=4,start=10240,size=2048>
-Requested partition: <partno=5,start=4096,size=2048>
-sample-fdisk-mkpart-fullspec: failed to add #6 partition
 Created a new <removed>.
+Requested partition: <partno=0,start=2048,size=2048>
 Created a new <removed>.
+Requested partition: <partno=1,start=4096,size=2048>
 Created a new <removed>.
+Requested partition: <partno=2,start=6144,size=2048>
 Created a new <removed>.
+Requested partition: <partno=3,start=8192,size=22528>
 Created a new <removed>.
+Requested partition: <partno=4,start=10240,size=2048>
 Adding logical partition 5
 Created a new <removed>.
+Requested partition: <partno=5,start=4096,size=2048>
+sample-fdisk-mkpart-fullspec: failed to add #6 partition
 Disk <removed>: 15 MiB, 15728640 bytes, 30720 sectors
 Units: sectors of 1 * 512 = 512 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
index d7a006569972fa7ff966957b77dd57797b645ab5..a79c5800a16297b7f1ef5fe8b4951df5e64245e7 100644 (file)
@@ -1,9 +1,9 @@
-Requested partition: <partno=0,start=2048,size=2048>
-Requested partition: <partno=1,start=4096,size=2048>
-Requested partition: <partno=2,start=4096,size=2048>
 Created a new <removed>.
+Requested partition: <partno=0,start=2048,size=2048>
 Created a new <removed>.
+Requested partition: <partno=1,start=4096,size=2048>
 Created a new <removed>.
+Requested partition: <partno=2,start=4096,size=2048>
 Start sector 4096 out of range.
 sample-fdisk-mkpart-fullspec: failed to add #3 partition
 Disk <removed>: 15 MiB, 15728640 bytes, 30720 sectors
index 1142f6531220c087381f75b76ab6b69d5e39b4ec..93edf2b0748ef282c60219d8d8129db8f5c588a3 100644 (file)
@@ -1,9 +1,9 @@
-Requested partition: <partno=0,start=2048,size=2048>
-Requested partition: <partno=1,start=4096,size=2048>
-Requested partition: <partno=6,start=6144,size=2048>
 Created a new <removed>.
+Requested partition: <partno=0,start=2048,size=2048>
 Created a new <removed>.
+Requested partition: <partno=1,start=4096,size=2048>
 Created a new <removed>.
+Requested partition: <partno=6,start=6144,size=2048>
 Extended partition does not exists. Failed to add logical partition.
 sample-fdisk-mkpart-fullspec: failed to add #7 partition
 Disk <removed>: 15 MiB, 15728640 bytes, 30720 sectors
index 97e7a4a540164230641da46935e698ba0f7badd3..ff2611cbb24ff99b7ea05869d0e470680086bd07 100644 (file)
@@ -1,19 +1,19 @@
-Requested partition: <partno=0,start=2048,size=2048>
-Requested partition: <partno=1,start=4096,size=2048>
-Requested partition: <partno=2,start=6144,size=2048>
-Requested partition: <partno=3,start=8192,size=22528>
-Requested partition: <partno=4,start=10240,size=2048>
-Requested partition: <partno=5,start=14336,size=2048>
-Requested partition: <partno=6,start=18432,size=12288>
 Created a new <removed>.
+Requested partition: <partno=0,start=2048,size=2048>
 Created a new <removed>.
+Requested partition: <partno=1,start=4096,size=2048>
 Created a new <removed>.
+Requested partition: <partno=2,start=6144,size=2048>
 Created a new <removed>.
+Requested partition: <partno=3,start=8192,size=22528>
 Created a new <removed>.
+Requested partition: <partno=4,start=10240,size=2048>
 Adding logical partition 5
 Created a new <removed>.
+Requested partition: <partno=5,start=14336,size=2048>
 Adding logical partition 6
 Created a new <removed>.
+Requested partition: <partno=6,start=18432,size=12288>
 Adding logical partition 7
 Created a new <removed>.
 Disk <removed>: 15 MiB, 15728640 bytes, 30720 sectors
index 23f7ad5a75cca2c257b3e430b61e25b3815ebe25..c8c449cd1bc1c7ff5620f3965bea9800fa92f86c 100644 (file)
@@ -1,19 +1,19 @@
-Requested partition: <partno=<default>,start=2048,size=2048>
-Requested partition: <partno=<default>,start=4096,size=2048>
-Requested partition: <partno=<default>,start=6144,size=2048>
-Requested partition: <partno=<default>,start=8192,size=22528>
-Requested partition: <partno=<default>,start=10240,size=2048>
-Requested partition: <partno=<default>,start=14336,size=2048>
-Requested partition: <partno=<default>,start=18432,size=12288>
 Created a new <removed>.
+Requested partition: <partno=<default>,start=2048,size=2048>
 Created a new <removed>.
+Requested partition: <partno=<default>,start=4096,size=2048>
 Created a new <removed>.
+Requested partition: <partno=<default>,start=6144,size=2048>
 Created a new <removed>.
+Requested partition: <partno=<default>,start=8192,size=22528>
 Created a new <removed>.
+Requested partition: <partno=<default>,start=10240,size=2048>
 Adding logical partition 5
 Created a new <removed>.
+Requested partition: <partno=<default>,start=14336,size=2048>
 Adding logical partition 6
 Created a new <removed>.
+Requested partition: <partno=<default>,start=18432,size=12288>
 Adding logical partition 7
 Created a new <removed>.
 Disk <removed>: 15 MiB, 15728640 bytes, 30720 sectors
index 31e84344d4981cef4233a6110e7d7d4092346b02..c71ec9e1fa49e0da0f32447a4bfe21101686a79f 100644 (file)
@@ -1,11 +1,11 @@
-Requested partition: <partno=0,start=2048,size=2048>
-Requested partition: <partno=1,start=4096,size=2048>
-Requested partition: <partno=2,start=6144,size=2048>
-Requested partition: <partno=3,start=8192,size=22528>
 Created a new <removed>.
+Requested partition: <partno=0,start=2048,size=2048>
 Created a new <removed>.
+Requested partition: <partno=1,start=4096,size=2048>
 Created a new <removed>.
+Requested partition: <partno=2,start=6144,size=2048>
 Created a new <removed>.
+Requested partition: <partno=3,start=8192,size=22528>
 Created a new <removed>.
 Disk <removed>: 15 MiB, 15728640 bytes, 30720 sectors
 Units: sectors of 1 * 512 = 512 bytes
index 90a71f3ab23303afcdbe22a601bb335971cf7062..33ba9ff88090e6d3d9f1c8e5f5c103d9b5cc4b64 100644 (file)
@@ -1,11 +1,11 @@
-Requested partition: <partno=<default>,start=2048,size=2048>
-Requested partition: <partno=<default>,start=4096,size=2048>
-Requested partition: <partno=<default>,start=6144,size=2048>
-Requested partition: <partno=<default>,start=8192,size=22528>
 Created a new <removed>.
+Requested partition: <partno=<default>,start=2048,size=2048>
 Created a new <removed>.
+Requested partition: <partno=<default>,start=4096,size=2048>
 Created a new <removed>.
+Requested partition: <partno=<default>,start=6144,size=2048>
 Created a new <removed>.
+Requested partition: <partno=<default>,start=8192,size=22528>
 Created a new <removed>.
 Disk <removed>: 15 MiB, 15728640 bytes, 30720 sectors
 Units: sectors of 1 * 512 = 512 bytes
index 45d45071fe4c21fbcfa0c2d7abc519696443615d..881ea9ec74f2f01221292915335448f9f667a842 100644 (file)
@@ -1,9 +1,9 @@
-Requested partition: <partno=0,start=2048,size=2048>
-Requested partition: <partno=1,start=6144,size=2048>
-Requested partition: <partno=2,start=8192,size=2048>
 Created a new <removed>.
+Requested partition: <partno=0,start=2048,size=2048>
 Created a new <removed>.
+Requested partition: <partno=1,start=6144,size=2048>
 Created a new <removed>.
+Requested partition: <partno=2,start=8192,size=2048>
 Created a new <removed>.
 Disk <removed>: 15 MiB, 15728640 bytes, 30720 sectors
 Units: sectors of 1 * 512 = 512 bytes
index eda506ef6b90168ba210735694b87e9fff69c158..9fb46ef67074d0da653cbf0ce0c9d358e7f4da84 100755 (executable)
@@ -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 \