1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

regress tests: remove use of unportable direct paths to commands

Many tests used direct paths to some commands, mostly /bin/echo and
/bin/cat. This is unportable (breaks on e.g. NixOS).
The correct way is to obtain the direct path using 'whence -p'.

There was also one use of '/usr/bin/pstack' in tests/comvario.sh
that seemed bogus. Apparently this was supposed to analyse a core
file after a crash. Even on Solaris and Linux, where that command
exists, the argument is documented to be a PID, not a core file. If
this ever worked anywhere, then it was system-specific enough to be
useless here, so I've removed it.

(cherry picked from commit 4563b8bc651cd9cb18dc73f56a041f7ac5534395)
This commit is contained in:
Martijn Dekker 2020-06-04 22:49:37 +02:00
parent 3552a2bafd
commit b6b8b522a7
13 changed files with 53 additions and 48 deletions

View file

@ -36,6 +36,7 @@ tmp=$(
exit 1
}
trap 'cd / && rm -rf "$tmp"' EXIT
bincat=$(whence -p cat)
# test shell builtin commands
builtin getconf
@ -101,7 +102,7 @@ hello \
!
[[ $REPLY == 'hello world' ]] || err_exit "read continuation2 failed"
print "one\ntwo" | { read line
print $line | /bin/cat > /dev/null
print $line | "$bincat" > /dev/null
read line
}
read <<\!
@ -559,6 +560,7 @@ builtin cat
out=$tmp/seq.out
for ((i=1; i<=11; i++)); do print "$i"; done >$out
cmp -s <(print -- "$($bincat<( $bincat $out ) )") <(print -- "$(cat <( cat $out ) )") || err_exit "builtin cat differs from $bincat"
builtin -d cat
[[ $($SHELL -c '{ printf %R "["; print ok;}' 2> /dev/null) == ok ]] || err_exit $'\'printf %R "["\' causes shell to abort'