summaryrefslogtreecommitdiff
path: root/tests/split
diff options
context:
space:
mode:
Diffstat (limited to 'tests/split')
-rwxr-xr-xtests/split/filter.sh12
-rwxr-xr-xtests/split/l-chunk.sh12
2 files changed, 14 insertions, 10 deletions
diff --git a/tests/split/filter.sh b/tests/split/filter.sh
index e4e4dca3b..a93008bb7 100755
--- a/tests/split/filter.sh
+++ b/tests/split/filter.sh
@@ -18,6 +18,8 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ split
+require_sparse_support_ # for 'truncate --size=$OFF_T_MAX'
+eval $(getlimits) # for OFF_T limits
xz --version || skip_ "xz (better than gzip/bzip2) required"
for total_n_lines in 5 3000 20000; do
@@ -41,7 +43,7 @@ done
# split does not run the command (and effectively elides the file)
# only when the output to that command would have been empty.
split -e -n 10 --filter='xz > $FILE.xz' /dev/null || fail=1
-stat x?? 2>/dev/null && fail=1
+returns_ 1 stat x?? 2>/dev/null || fail=1
# Ensure this invalid combination is flagged
returns_ 1 split -n 1/2 --filter='true' /dev/null 2>&1 || fail=1
@@ -50,8 +52,10 @@ returns_ 1 split -n 1/2 --filter='true' /dev/null 2>&1 || fail=1
# where they would result in a non zero exit from split.
yes | head -n200K | split -b1G --filter='head -c1 >/dev/null' || fail=1
-# Ensure that endless input is ignored when all filters finish
-timeout 10 yes | split --filter="head -c1 >/dev/null" -n r/1 || fail=1
-timeout 10 split --filter="head -c1 >/dev/null" -n 1 /dev/zero || fail=1
+# Ensure that "endless" input is ignored when all filters finish
+timeout 10 sh -c 'yes | split --filter="head -c1 >/dev/null" -n r/1' || fail=1
+if truncate -s$OFF_T_MAX zero.in; then
+ timeout 10 sh -c 'split --filter="head -c1 >/dev/null" -n 1 zero.in' || fail=1
+fi
Exit $fail
diff --git a/tests/split/l-chunk.sh b/tests/split/l-chunk.sh
index 38297dea1..a7a9395ca 100755
--- a/tests/split/l-chunk.sh
+++ b/tests/split/l-chunk.sh
@@ -21,12 +21,12 @@ print_ver_ split
# invalid number of chunks
echo "split: invalid number of chunks: '1o'" > exp
-split -n l/1o 2>err && fail=1
+returns_ 1 split -n l/1o 2>err || fail=1
compare exp err || fail=1
-echo > exp
-echo | split -n l/1 || fail=1
-compare exp xaa || fail=1
+echo "split: -: cannot determine file size" > exp
+: | returns_ 1 split -n l/1 2>err || fail=1
+compare exp err || fail=1
# N can be greater than the file size
# in which case no data is extracted, or empty files are written
@@ -45,7 +45,7 @@ rm x??
# Ensure --elide-empty-files is honored
split -e -n l/10 /dev/null || fail=1
-stat x?? 2>/dev/null && fail=1
+returns_ 1 stat x?? 2>/dev/null || fail=1
# 80 bytes. ~ transformed to \n below
lines=\
@@ -79,7 +79,7 @@ for ELIDE_EMPTY in '' '-e'; do
if test -z "$ELIDE_EMPTY"; then
split ---io-blksize=$IO_BLKSIZE -n l/2/$N in > chunk.k
- stat x* 2>/dev/null && fail=1
+ returns_ 1 stat x* 2>/dev/null || fail=1
fi
split ---io-blksize=$IO_BLKSIZE $ELIDE_EMPTY -n l/$N in