aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/test_example.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_example.sh')
-rw-r--r--tests/test_example.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_example.sh b/tests/test_example.sh
new file mode 100644
index 0000000..d5feaab
--- /dev/null
+++ b/tests/test_example.sh
@@ -0,0 +1,19 @@
+filename="../../../examples/$1.c"
+
+"$ducc" "$filename" > main.s
+if [[ $? -ne 0 ]]; then
+ exit 1
+fi
+gcc -Wl,-z,noexecstack -o a.out main.s
+if [[ ! -f input ]]; then
+ touch input
+fi
+./a.out "$@" < input > output
+exit_code=$?
+
+if [[ $exit_code -ne 0 ]]; then
+ echo "invalid exit code: $exit_code" >&2
+ exit 1
+fi
+
+diff -u expected output