forked from ngless-toolkit/ngless
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-tests.sh
More file actions
executable file
·61 lines (55 loc) · 1.31 KB
/
run-tests.sh
File metadata and controls
executable file
·61 lines (55 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
shopt -s nullglob
ok="yes"
make
if test $? -ne "0"; then
echo "ERROR IN 'make'"
ok=no
fi
make check
if test $? -ne "0"; then
echo "ERROR IN 'make check'"
ok=no
fi
ngless_bin=$PWD/$(stack path --dist-dir)/build/ngless/ngless
if ! test -x $ngless_bin ; then
echo "Could not determine path for ngless (guessed $ngless_bin)"
exit 1
fi
basedir=$PWD
for testdir in tests/*; do
if test -d $testdir; then
echo "Running $testdir"
cd $testdir
mkdir -p temp
$ngless_bin --quiet -t temp *.ngl > output.stdout.txt 2>output.stderr.txt
ngless_exit=$?
if [[ $testdir == tests/error-* ]] ; then
if test $ngless_exit -eq "0"; then
echo "Expected error message in test"
ok=no
fi
else
if test $ngless_exit -ne "0"; then
echo "Error exit in test"
ok=no
fi
fi
for f in expected.*; do
diff -u $f output${f#expected}
if test $? -ne "0"; then
echo "ERROR IN TEST"
ok=no
fi
done
rm -rf temp
rm -rf *.output_ngless
cd $basedir
fi
done
if test $ok = "yes"; then
echo "All done."
else
echo "An error occurred."
exit 1
fi