summaryrefslogtreecommitdiff
path: root/tests/Makefile
diff options
context:
space:
mode:
authorNicolas Schodet2024-03-27 18:05:39 +0100
committerNicolas Schodet2024-03-27 21:26:23 +0100
commitf3a482d683cdbefeaa15ce6781cd44d226722a12 (patch)
treef23795746e5babbe07f7aaf72fb4d3928b80c45d /tests/Makefile
parent109e9777bb91360fee67d20263886d14cb97b23a (diff)
Add a test suite
The test suite runs program(s) on the NXT brick and compare the output with the expected output. This can be run against NXT Improved Firmware, or other firmwares for comparison. It depends on NXC and NXT-Python.
Diffstat (limited to 'tests/Makefile')
-rw-r--r--tests/Makefile34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 0000000..9e7d788
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,34 @@
+NBC = nbc
+OPTIMIZE = -Z2
+FIRMWARE =
+PYTHON = python3
+# or PYTHON = poetry -C path/to/nxt-python run python
+
+TESTS = float
+
+tests: $(TESTS:%=%.diff)
+
+%.rxe: %.nxc
+ $(NBC) $(OPTIMIZE) $(FIRMWARE) -O=$@ $<
+
+%.load: %.rxe
+ $(NBC) $(OPTIMIZE) $(FIRMWARE) -d -b $<
+
+%.out: %.load
+ $(PYTHON) term.py -qos $* > $@
+
+%.diff: %.out %.expect
+ diff $^ > $@
+
+%.S: %.nxc
+ $(NBC) $(OPTIMIZE) $(FIRMWARE) -nbc=$@ $<
+
+clean-out:
+ rm -f $(TESTS:%=%.out) $(TESTS:%=%.diff)
+
+clean: clean-out
+ rm -f $(TESTS:%=%.rxe)
+
+.SECONDARY:
+
+.DELETE_ON_ERROR: