• R/O
  • SSH
  • HTTPS

yash: Commit


Commit MetaInfo

Revision3989 (tree)
Time2019-02-11 23:42:09
Authormagicant

Log Message

run-test: Use symlink to invoke testee as sh

We now create a symlink named "sh" that resolves to the testee shell. By
invoking the shell via the symlink, we can invoke the shell as "sh"
without depending on the non-standard "-a" option of the "exec"
built-in.

Change Summary

Incremental Difference

--- yash/trunk/tests/run-test.sh (revision 3988)
+++ yash/trunk/tests/run-test.sh (revision 3989)
@@ -28,7 +28,7 @@
2828 set -Ceu
2929 umask u+rwx
3030
31-# require yash for alias support and extended exec & ulimit built-ins
31+# require yash for alias support and ulimit built-ins
3232 if ! [ "${YASH_VERSION-}" ]; then
3333 eprintf '%s: must be run with yash\n' "$0"
3434 exit 64 # sysexits.h EX_USAGE
@@ -156,14 +156,18 @@
156156 # If the "use_valgrind" variable is true, Valgrind is used to run the testee,
157157 # in which case the testee will ignore argv[0].
158158 testee() (
159+ if [ "${posix:+set}" = set ]; then
160+ testee="$testee_sh"
161+ export TESTEE="$testee"
162+ fi
159163 if ! "$use_valgrind"; then
160- exec ${posix:+-a sh} "$testee" "$@"
164+ exec "$testee" "$@"
161165 else
162166 test -r "$abs_suppressions" || abs_suppressions=
163167 exec valgrind --leak-check=full --vgdb=no --log-fd=17 \
164168 ${abs_suppressions:+--suppressions="$abs_suppressions"} \
165169 --gen-suppressions=all \
166- "$testee" ${posix:+-o posix} "$@" \
170+ "$testee" "$@" \
167171 17>>"${valgrind_file-0.valgrind}"
168172 fi
169173 )
@@ -375,6 +379,8 @@
375379 abs_suppressions="$(absolute valgrind.supp)"
376380 cd "$work_dir"
377381
382+ln -s -- "$testee" sh
383+testee_sh="$(absolute sh)"
378384 export TESTEE="$testee"
379385
380386 . "$abs_test_file"
Show on old repository browser