aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2021-10-18 17:05:46 +0100
committerYann Herklotz <git@yannherklotz.com>2021-10-18 17:05:46 +0100
commitfbfa988072ce2eba808b9a6631af5f8e86cd9df0 (patch)
tree5146e558d5c9c6e9a399225eed0784b8dc12558f /test
parent603768a49eac2005729dd03e723ff6c5a6b292f7 (diff)
parentfe06668f0de56635efe55310d7a64289a37c1d90 (diff)
downloadvericert-dev/michalis.tar.gz
vericert-dev/michalis.zip
Merge branch 'master' into dev/michalisdev/michalis
Diffstat (limited to 'test')
-rw-r--r--test/Makefile34
-rwxr-xr-xtest/test_all.sh4
2 files changed, 37 insertions, 1 deletions
diff --git a/test/Makefile b/test/Makefile
new file mode 100644
index 0000000..9413c70
--- /dev/null
+++ b/test/Makefile
@@ -0,0 +1,34 @@
+CC ?= gcc
+VERICERT ?= vericert
+VERICERT_OPTS ?= -fschedule
+IVERILOG ?= iverilog
+IVERILOG_OPTS ?=
+
+TESTS := $(patsubst %.c,%.check,$(wildcard *.c))
+
+all: $(TESTS)
+
+%.gcc.out: %.gcc
+ @./$< ; echo "$$?" >$@
+
+%.o: %.c
+ @$(CC) $(CFLAGS) -c -o $@ $<
+
+%.gcc: %.o
+ @$(CC) $(CFLAGS) -o $@ $<
+
+%.v: %.c
+ @$(VERICERT) $(VERICERT_OPTS) -o $@ $<
+
+%.iver: %.v
+ @$(IVERILOG) $(IVERILOG_OPTS) -o $@ -- $<
+
+%.veri.out: %.iver
+ @./$< | tail -n1 | sed -r -e 's/[^0-9]*([0-9]+)/\1/' >$@
+
+%.check: %.gcc.out %.veri.out
+ @diff $^ >$@
+ @printf "\033[0;36mOK\033[0m\t$(patsubst %.check,%,$@)\n"
+
+clean:
+ rm -f *.check *.gcc *.gcc.out *.o *.v *.iver *.veri.out
diff --git a/test/test_all.sh b/test/test_all.sh
index f072eba..f2b045b 100755
--- a/test/test_all.sh
+++ b/test/test_all.sh
@@ -1,3 +1,5 @@
+#!/bin/bash
+
mytmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')
echo "--------------------------------------------------"
echo "Created working directory: $mytmpdir"
@@ -31,7 +33,7 @@ for cfile in $test_dir/*.c; do
gcc -o $outbase.gcc $cfile >/dev/null 2>&1
$outbase.gcc
expected=$?
- vericert -drtl -o $outbase.v $cfile >/dev/null 2>&1
+ vericert -fschedule -drtl -o $outbase.v $cfile >/dev/null 2>&1
if [[ ! -f $outbase.v ]]; then
echo "ERROR"
continue