Fix some environment-dependent tests.

* gash/environment.scm (initial-variables): Add 'SHELL' and 'SHELLOPTS'.
* tests/100-cd.sh, tests/100-cd.stdout: Use '/tmp' instead of '/bin'.
* tests/50-redirect-in-out.sh, tests/50-redirect-space.sh,
tests/50-redirect.sh: Use '/tmp' and PID for temporary files.
* tests/50-redirect-sed.sh: Make sure 'DESTDIR' is unset and use
'/bin/GASH' in place of '/bin/gash'.
* tests/50-redirect-sed.stdout, tests/data/diff.scm: Use '/bin/GASH' in
place of '/bin/gash'.
* Makefile.am (FULL_TESTS): Add tests/50-redirect-sed.sh,
tests/50-redirect-space.sh, and tests/100-cd.sh; remove
tests/50-redirect-merge.sh.
(BROKEN_TESTS): Remove tests/10-if-redirect.sh,
tests/50-redirect-sed.sh, tests/50-redirect-space.sh, and
tests/100-cd.sh; add tests/50-redirect-merge.sh.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
This commit is contained in:
Jan Nieuwenhuizen 2018-12-31 14:49:01 +01:00 committed by Timothy Sample
parent 56610b0669
commit 2e4e078975
10 changed files with 22 additions and 20 deletions

View File

@ -210,7 +210,8 @@ FULL_TESTS = \
tests/50-redirect-in.sh \
tests/50-redirect-append.sh \
tests/50-redirect-pipe.sh \
tests/50-redirect-merge.sh \
tests/50-redirect-sed.sh \
tests/50-redirect-space.sh \
tests/50-redirect-in-out.sh \
tests/60-function.sh \
tests/60-function-at.sh \
@ -223,6 +224,7 @@ FULL_TESTS = \
tests/70-slash.sh \
tests/70-slash-string.sh \
tests/70-slash-string-slash.sh \
tests/100-cd.sh \
tests/100-cd-foo.sh \
tests/100-test.sh \
tests/100-test-file.sh \
@ -247,10 +249,7 @@ XFAIL_TESTS = \
# that pass or fail based on environmental
# factors.
BROKEN_TESTS = \
tests/10-if-redirect.sh \
tests/50-redirect-sed.sh \
tests/50-redirect-space.sh \
tests/100-cd.sh
tests/50-redirect-merge.sh
EXTRA_DIST = \
scripts/gash.in

View File

@ -108,7 +108,9 @@
(alist->hash-table
(map (match-lambda
((name . value) `(,name . ,(vector value #t #f))))
(append `(("PWD" . ,(initial-pwd env)))
(append `(("PWD" . ,(initial-pwd env))
("SHELL" . ,(car (command-line)))
("SHELLOPTS" . ""))
env)))))
(define *variables* (initial-variables))

View File

@ -1,2 +1,2 @@
cd /bin
cd /tmp
pwd

View File

@ -1 +1 @@
/bin
/tmp

View File

@ -1,3 +1,3 @@
cat < tests/data/foo > bar
cat bar
rm bar
cat < tests/data/foo > /tmp/bar$$
cat /tmp/bar$$
rm /tmp/bar$$

View File

@ -1,5 +1,6 @@
unset DESTDIR
sed \
-e "s,^#! /bin/sh,#! /bin/gash," \
-e "s,^#! /bin/sh,#! /bin/GASH," \
tests/data/diff.scm > $DESTDIR/tmp/diff.scm
cat $DESTDIR/tmp/diff.scm
rm $DESTDIR/tmp/diff.scm

View File

@ -1,3 +1,3 @@
#! /bin/gash
#! /bin/GASH
!#

View File

@ -1,3 +1,3 @@
echo foo > bar
cat bar
rm bar
echo foo > /tmp/bar$$
cat /tmp/bar$$
rm /tmp/bar$$

View File

@ -1,3 +1,3 @@
echo foo 1>./bar
cat bar
rm bar
echo foo 1>/tmp/bar$$
cat /tmp/bar$$
rm /tmp/bar$$

View File

@ -1,3 +1,3 @@
#! /bin/sh
#! /bin/GASH
!#