mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-05-31 06:46:37 +02:00
tests: install: check the behavior when standard input is the source
* tests/install/stdin.sh: New file. * tests/local.mk: Add the new test.
This commit is contained in:
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
# Test 'install' when the source is standard input.
|
||||
|
||||
# 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_ ginstall
|
||||
|
||||
# work around a dash bug when redirecting
|
||||
# from symlinked ttys in the background
|
||||
tty=$(readlink -f /dev/stdin)
|
||||
|
||||
test -r "$tty" 2>&1 \
|
||||
|| skip_ '/dev/stdin is not readable'
|
||||
|
||||
echo a >a || framework_failure_
|
||||
echo b >b || framework_failure_
|
||||
|
||||
# Test the behavior when the source is a pipe and the destination does
|
||||
# not exist.
|
||||
cat a | ginstall /dev/stdin file1 >out 2>err || fail=1
|
||||
compare a file1 || fail=1
|
||||
compare /dev/null out || fail=1
|
||||
compare /dev/null err || fail=1
|
||||
|
||||
# Test the behavior when the source is a file and the destination does
|
||||
# not exist.
|
||||
ginstall /dev/stdin file2 <b >out 2>err || fail=1
|
||||
compare b file2 || fail=1
|
||||
compare /dev/null out || fail=1
|
||||
compare /dev/null err || fail=1
|
||||
|
||||
# Test the behavior when the source is a file and the destination exists.
|
||||
ginstall /dev/stdin file1 <file2 >out 2>err || fail=1
|
||||
compare b file1 || fail=1
|
||||
compare /dev/null out || fail=1
|
||||
compare /dev/null err || fail=1
|
||||
|
||||
# Test the behavior when the source is a pipe and the destination exists.
|
||||
cat b | ginstall /dev/stdin file1 >out 2>err || fail=1
|
||||
compare b file1 || fail=1
|
||||
compare /dev/null out || fail=1
|
||||
compare /dev/null err || fail=1
|
||||
|
||||
Exit $fail
|
||||
@@ -679,6 +679,7 @@ all_tests = \
|
||||
tests/install/install-C.sh \
|
||||
tests/install/install-C-selinux.sh \
|
||||
tests/install/install-Z-selinux.sh \
|
||||
tests/install/stdin.sh \
|
||||
tests/install/strip-program.sh \
|
||||
tests/install/trap.sh \
|
||||
tests/ln/backup-1.sh \
|
||||
|
||||
Reference in New Issue
Block a user