diff options
author | Pádraig Brady <P@draigBrady.com> | 2016-02-12 20:15:51 -0800 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2016-02-15 22:03:15 -0800 |
commit | f91f2bf951de16553ffdf88c116e722809341b5c (patch) | |
tree | 50a247b390d6ccf6c4377668511c72eeb529bd7a /tests/split/filter.sh | |
parent | 222e83056d46593431b7a1be323d884032199cd7 (diff) | |
download | coreutils-f91f2bf951de16553ffdf88c116e722809341b5c.tar.xz |
split: adjust recent --number changes
* src/split.c (lines_rr): Reinstate the conditional
setting of the WROTE boolean, as otherwise split -n r/1 would
consume all input when all --filter commands are stopped.
There was a test in place to check for this, but
it was incorrect as detailed below.
(input_file_size): Immediately disallow --number with
non seekable inputs, as such an invocation is not currently
generally supported and will fail as the data overflows
the internal buffer.
* tests/split/l-chunk.sh: Adjust to again disallow -n /dev/zero.
Also change all '&& fail=1' checks to use the 'returns_ 1' form.
* tests/split/filter.sh: Change the no longer supported /dev/zero
case to a regular $OFF_T_MAX file (supported on XFS for example).
Also fix the timeout(1) commands so they're not subject to
pipefail issues.
Diffstat (limited to 'tests/split/filter.sh')
-rwxr-xr-x | tests/split/filter.sh | 12 |
1 files changed, 8 insertions, 4 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 |