test: Updates.

This commit is contained in:
Jan Nieuwenhuizen 2018-07-03 21:49:55 +02:00
parent 61ee206b8d
commit 503be95f97
24 changed files with 41 additions and 6 deletions

2
configure vendored
View File

@ -9,6 +9,7 @@ if [ -z "$PREFIX" ]; then
PREFIX=/usr/local
fi
BASH=$(command -v bash)
GUILE=$(command -v guile)
GUILE_TOOLS=$(command -v guile-tools)
GUILE_SITE_DIR=$PREFIX/share/guile/site/$GUILE_EFFECTIVE_VERSION
@ -22,6 +23,7 @@ sed \
bin/gash.in > bin/gash
chmod +x bin/gash
cat > .config.make <<EOF
BASH=$BASH
GUILE=$GUILE
GUILE_TOOLS=$GUILE_TOOLS
PREFIX=$PREFIX

View File

@ -1,4 +1,4 @@
.PHONY: all all-go clean install
.PHONY: all all-go check clean install
-include .config.make
default: all
@ -20,8 +20,15 @@ clean:
clean-go:
rm -f $(shell find . -name '*.go')
check: all
echo TODO
check: all check-bash check-gash
check-bash: all
ifneq ($(BASH),)
SHELL=$(BASH) ./test.sh
endif
check-gash: all
./test.sh
install: all
mkdir -p $(DESTDIR)$(BINDIR)
@ -40,6 +47,7 @@ Usage: make [OPTION]... [TARGET]...
Targets:
all update everything
all-go update .go files
check run ./test.sh
clean run git clean -dfx
clean-go clean .go files
install install in $(PREFIX)
@ -48,8 +56,10 @@ export HELP_TOP
help:
@echo "$$HELP_TOP"
export BUILD_DEBUG
export GUILE
export GUILE_TOOLS
export GUILE_LOAD_PATH
export GUILE_LOAD_COMPILED_PATH

18
test.sh
View File

@ -1 +1,17 @@
for f in test/*; do echo $f ":"; bin/gash $f; echo; done
if [ -n "$BUILD_DEBUG" ]; then
set -x
fi
SHELL=${SHELL-bin/gash}
for f in test/*.sh; do
echo -n "$f: "
b=test/$(basename $f .sh)
$SHELL $f
r=$?
if [ -f $b.exit ]; then
e=$(cat $b.exit)
else
e=0
fi
[ $r = $e ] || exit 1
echo pass
done

1
test/00-exit.sh Normal file
View File

@ -0,0 +1 @@
exit

1
test/01-exit-0.sh Normal file
View File

@ -0,0 +1 @@
exit 0

1
test/02-exit-1.exit Normal file
View File

@ -0,0 +1 @@
1

1
test/02-exit-1.sh Normal file
View File

@ -0,0 +1 @@
exit 1

1
test/03-echo.sh Normal file
View File

@ -0,0 +1 @@
echo

1
test/04-echo-var.sh Normal file
View File

@ -0,0 +1 @@
echo $SHELL

View File

@ -0,0 +1,2 @@
SHELL=/bin/bash
echo $SHELL

View File

@ -1 +0,0 @@
for f in *; do echo "$f:" | grep c; done

1
test/for.sh Normal file
View File

@ -0,0 +1 @@
for f in test/*.sh; do echo "$f:" | grep '.sh' ; done

View File

View File

@ -1 +0,0 @@
echo $SHELL