]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
pipesz: use native PAGE_SIZE in tests
authorNathan Sharp <nwsharp@live.com>
Sat, 4 Jun 2022 02:00:22 +0000 (20:00 -0600)
committerKarel Zak <kzak@redhat.com>
Mon, 6 Jun 2022 10:19:22 +0000 (12:19 +0200)
Reported-by: Anatoly Pugachev <matorola@gmail.com>
Signed-off-by: Nathan Sharp <nwsharp@live.com>
tests/expected/misc/pipesz-get-fd
tests/expected/misc/pipesz-get-file
tests/ts/misc/pipesz

index ef103dc9d82e549e6055fa82c53e1b9fefe23359..aa4cab1881208f3f05b2a7f448f2f47d805f7752 100644 (file)
@@ -1 +1 @@
-fd 0   65536   0
+fd 0   DEFAULT_PIPE_SIZE       0
index c1e1a9d786cd0d7d2b0a77bb6ed44c26c5ec5126..32dc6bd1d3240b937cda1aef0b60bc931d96c87a 100644 (file)
@@ -1 +1 @@
-/dev/stdin     65536   0
+/dev/stdin     DEFAULT_PIPE_SIZE       0
index be5eb45e6228b772c888b8f4056f6e149a874005..25724cd4c670fa6bd56efcf668f272f4d66ad65b 100755 (executable)
@@ -18,6 +18,10 @@ TS_DESC="pipesz"
 . $TS_TOPDIR/functions.sh
 ts_init "$*"
 
+set -o pipefail
+
+DEFAULT_PIPE_SIZE=$(($(getconf PAGE_SIZE) * 16))
+
 ts_check_test_command "$TS_CMD_PIPESZ"
 
 ts_init_subtest "set-fd-bad"
@@ -46,7 +50,7 @@ $TS_CMD_PIPESZ --check --get --fd 42 >> $TS_OUTPUT 2>> $TS_ERRLOG
 ts_finalize_subtest
 
 ts_init_subtest "get-fd"
-echo -n | $TS_CMD_PIPESZ --check --get --stdin >> $TS_OUTPUT 2>> $TS_ERRLOG
+echo -n | $TS_CMD_PIPESZ --check --get --stdin 2>> $TS_ERRLOG | sed "s/$DEFAULT_PIPE_SIZE/DEFAULT_PIPE_SIZE/g" >> $TS_OUTPUT
 [[ $? -ne 0 ]] && ts_logerr "expected success"
 ts_finalize_subtest
 
@@ -56,7 +60,7 @@ $TS_CMD_PIPESZ --check --get --file "/dev/null" >> $TS_OUTPUT 2>> $TS_ERRLOG
 ts_finalize_subtest
 
 ts_init_subtest "get-file"
-echo -n | $TS_CMD_PIPESZ --check --get --file "/dev/stdin" >> $TS_OUTPUT 2>> $TS_ERRLOG
+echo -n | $TS_CMD_PIPESZ --check --get --file "/dev/stdin" 2>> $TS_ERRLOG | sed "s/$DEFAULT_PIPE_SIZE/DEFAULT_PIPE_SIZE/g" >> $TS_OUTPUT
 [[ $? -ne 0 ]] && ts_logerr "expected success"
 ts_finalize_subtest
 
@@ -70,4 +74,6 @@ echo this_should_be_output_by_cat | $TS_CMD_PIPESZ --check --stdin cat >> $TS_OU
 [[ $? -ne 0 ]] && ts_logerr "expected success"
 ts_finalize_subtest
 
+set +o pipefail
+
 ts_finalize