mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
tests: tail: check output appended to the input stops at its end
* tests/tail/append-to-input.sh: New test. * tests/local.mk (all_tests): Reference it. https://github.com/uutils/coreutils/pull/15066 Link: https://github.com/coreutils/coreutils/pull/455
This commit is contained in:
1 parent
a041593749
commit
f5ded57fbd
2 files changed
+43
No files matched your search
@@ -195,6 +195,7 @@ all_tests = \
|
||||
tests/misc/uname-labeled.sh \
|
||||
tests/misc/warning-errors.sh \
|
||||
tests/misc/write-errors.sh \
|
||||
tests/tail/append-to-input.sh \
|
||||
tests/tail/basic-seek.sh \
|
||||
tests/tail/inotify-hash-abuse.sh \
|
||||
tests/tail/inotify-hash-abuse2.sh \
|
||||
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
# Ensure tail stops at the original end of a file appended to its output
|
||||
|
||||
# Copyright (C) 2026 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
print_ver_ tail seq
|
||||
|
||||
# Cap the file size so a runaway tail cannot fill the file system.
|
||||
(ulimit -f 10000) 2>/dev/null || skip_ 'unable to limit file size'
|
||||
|
||||
# A file larger than a buffer, read from the end.
|
||||
for opt in -n1 -c4; do
|
||||
seq 100000 > in || framework_failure_
|
||||
cp in exp || framework_failure_
|
||||
tail $opt in >> exp || framework_failure_
|
||||
(ulimit -f 10000; timeout 10 tail $opt in >> in) || fail=1
|
||||
compare exp in || fail=1
|
||||
done
|
||||
|
||||
# A small file, read from the start.
|
||||
for opt in -n+2 -c+3; do
|
||||
printf 'a\nb\nc\n' > in || framework_failure_
|
||||
printf 'a\nb\nc\nb\nc\n' > exp || framework_failure_
|
||||
(ulimit -f 10000; timeout 10 tail $opt in >> in) || fail=1
|
||||
compare exp in || fail=1
|
||||
done
|
||||
|
||||
Exit $fail
|
||||
Reference in new issue
Block a user