[PATCH] pipesz: use native PAGE_SIZE in tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reported-by: Anatoly Pugachev <matorola@xxxxxxxxx>
Signed-off-by: Nathan Sharp <nwsharp@xxxxxxxx>
---
 tests/expected/misc/pipesz-get-fd   |  2 +-
 tests/expected/misc/pipesz-get-file |  2 +-
 tests/ts/misc/pipesz                | 10 ++++++++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/tests/expected/misc/pipesz-get-fd b/tests/expected/misc/pipesz-get-fd
index ef103dc9d..aa4cab188 100644
--- a/tests/expected/misc/pipesz-get-fd
+++ b/tests/expected/misc/pipesz-get-fd
@@ -1 +1 @@
-fd 0	65536	0
+fd 0	DEFAULT_PIPE_SIZE	0
diff --git a/tests/expected/misc/pipesz-get-file b/tests/expected/misc/pipesz-get-file
index c1e1a9d78..32dc6bd1d 100644
--- a/tests/expected/misc/pipesz-get-file
+++ b/tests/expected/misc/pipesz-get-file
@@ -1 +1 @@
-/dev/stdin	65536	0
+/dev/stdin	DEFAULT_PIPE_SIZE	0
diff --git a/tests/ts/misc/pipesz b/tests/ts/misc/pipesz
index be5eb45e6..25724cd4c 100755
--- a/tests/ts/misc/pipesz
+++ b/tests/ts/misc/pipesz
@@ -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
-- 
2.35.1




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux