aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2020-10-23 13:24:42 +0100
committerYann Herklotz <git@yannherklotz.com>2020-10-23 13:24:42 +0100
commit65d1b8ad3f5991561a7b9a633459d2b6950b4c8a (patch)
tree14e14c022ed4490078f4b41a3a2b34a95c8414a4 /test
parent91e9202e6317ab3edd22562d659255d63a3fe65d (diff)
downloadvericert-65d1b8ad3f5991561a7b9a633459d2b6950b4c8a.tar.gz
vericert-65d1b8ad3f5991561a7b9a633459d2b6950b4c8a.zip
Improve test script
Diffstat (limited to 'test')
-rw-r--r--test/array.c6
-rwxr-xr-xtest/test_all.sh8
2 files changed, 9 insertions, 5 deletions
diff --git a/test/array.c b/test/array.c
index 5c80694..0f23cc8 100644
--- a/test/array.c
+++ b/test/array.c
@@ -1,7 +1,7 @@
int main() {
int x[3] = {1, 2, 3};
- int sum = 0, incr = 1;
- for (int i = 0; i < 3; i=i+incr)
- sum = sum + i;
+ int sum = 0;
+ for (int i = 0; i < 3; i++)
+ sum = x[i];
return sum;
}
diff --git a/test/test_all.sh b/test/test_all.sh
index d43e2ac..92d3967 100755
--- a/test/test_all.sh
+++ b/test/test_all.sh
@@ -27,10 +27,14 @@ echo "--------------------------------------------------"
for cfile in $test_dir/*.c; do
echo "Testing $cfile"
outbase=$mytmpdir/$(basename $cfile)
- gcc -o $outbase.gcc $cfile
+ gcc -o $outbase.gcc $cfile >/dev/null 2>&1
$outbase.gcc
expected=$?
- ./bin/vericert -drtl -o $outbase.v $cfile
+ ./bin/vericert -drtl -o $outbase.v $cfile >/dev/null 2>&1
+ if [[ ! -f $outbase.v ]]; then
+ echo "ERROR"
+ continue
+ fi
iverilog -o $outbase.iverilog $outbase.v
actual=$($outbase.iverilog | sed -E -e 's/[^0-9]+([0-9]+)/\1/')
if [[ $expected = $actual ]]; then