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

@ -39,6 +39,7 @@ trap 'cd / && rm -rf "$tmp"' EXIT
builtin getconf
bincat=$(PATH=$(getconf PATH) whence -p cat)
binecho=$(PATH=$(getconf PATH) whence -p echo)
z=()
z.foo=( [one]=hello [two]=(x=3 y=4) [three]=hi)
@ -466,9 +467,9 @@ exp=ok
got=$($SHELL -c "$cmd" 2>&1)
[[ $got == "$exp" ]] || err_exit "'$cmd' failed -- expected '$exp', got '$got'"
cmd='eval "for i in 1 2; do eval /bin/echo x; done"'
cmd='eval '\''for i in 1 2; do eval "\"\$binecho\" x"; done'\'
exp=$'x\nx'
got=$($SHELL -c "$cmd")
got=$(export binecho; $SHELL -c "$cmd")
if [[ $got != "$exp" ]]
then EXP=$(printf %q "$exp")
GOT=$(printf %q "$got")
@ -482,7 +483,7 @@ $SHELL -c 'sleep 20 & pid=$!; { x=$( ( seq 60000 ) );kill -9 $pid;}&;wait $pid'
(.sh.foo=foobar)
[[ ${.sh.foo} == foobar ]] && err_exit '.sh subvariables in subshells remain set'
[[ $($SHELL -c 'print 1 | : "$(/bin/cat <(/bin/cat))"') ]] && err_exit 'process substitution not working correctly in subshells'
[[ $($SHELL -c 'print 1 | : "$("$bincat" <("$bincat"))"') ]] && err_exit 'process substitution not working correctly in subshells'
# config hang bug
integer i