Fix the tests for install(1): add support for STRIPBIN's -o option.

Reported by:	lwhsu
MFC after:	1 week
This commit is contained in:
Eugene Grosbein 2020-07-10 22:59:26 +00:00
parent 09c4e43d18
commit a0b083fbda
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363088

View file

@ -186,8 +186,12 @@ overwrite_backup_safe_comparing_body() {
setup_stripbin() {
cat <<\STRIPBIN >stripbin
#!/bin/sh
tr z @ <"$1" >"$1.new" && mv -- "$1.new" "$1"
[ "$1" = "-o" ] && dst="$2" && shift 2
[ "$1" = "--" ] && shift
[ -z "$dst" ] && dst="$1"
STRIPBIN
[ "$1" = "true" ] && cmd="cat" || cmd="tr z @"
echo $cmd '<"$1" >"$1.new" && mv -- "$1.new" "$dst"' >>stripbin
chmod 755 stripbin
export STRIPBIN="$PWD/stripbin"
}
@ -253,7 +257,7 @@ strip_changing_overwrite_eq_comparing_body() {
atf_test_case strip_noop
strip_noop_body() {
export STRIPBIN=true
setup_stripbin true
printf 'test\n123\r456\r\n789\0z' >testf
atf_check install -s testf copyf
[ ! testf -nt copyf ] || atf_fail "bad timestamp"