chibicc/test/driver.sh

26 lines
407 B
Bash
Executable File

#!/bin/bash
tmp=`mktemp -d /tmp/chibicc-test-XXXXXX`
trap 'rm -rf $tmp' INT TERM HUP EXIT
echo > $tmp/empty.c
check() {
if [ $? -eq 0 ]; then
echo "testing $1 ... passed"
else
echo "testing $1 ... failed"
exit 1
fi
}
# -o
rm -f $tmp/out
./chibicc -o $tmp/out $tmp/empty.c
[ -f $tmp/out ]
check -o
# --help
./chibicc --help 2>&1 | grep -q chibicc
check --help
echo OK