summaryrefslogtreecommitdiff
path: root/test/test_run.py
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2026-07-31 00:06:20 +0200
committerPaul Oliver <contact@pauloliver.dev>2026-07-31 00:11:33 +0200
commit8a4563d6d0c9e81fdaa42f6f760cae2b49cad431 (patch)
tree868a54949ed79b3c1e585365f4f3385bb6bee12f /test/test_run.py
parentf2c34b1d2c18270a0327fb4896fa307fae098770 (diff)
Adds unit test framework
Diffstat (limited to 'test/test_run.py')
-rw-r--r--test/test_run.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/test_run.py b/test/test_run.py
new file mode 100644
index 0000000..cab195c
--- /dev/null
+++ b/test/test_run.py
@@ -0,0 +1,55 @@
+# file : test/test_run.py
+# project : Salis-VM
+# author : Paul Oliver <contact@pauloliver.dev>
+
+# index:
+# [section] imports
+# [section] constants
+# [section] command lists
+# [section] file lists
+# [section] tests null
+
+# ------------------------------------------------------------------------------
+# [section] imports
+# ------------------------------------------------------------------------------
+from test_general import SalisTest
+
+class TestRun(SalisTest):
+ # --------------------------------------------------------------------------
+ # [section] constants
+ # --------------------------------------------------------------------------
+ SIM_NAME = "test-run.sim"
+ PUSH_POW = 8
+
+ # --------------------------------------------------------------------------
+ # [section] command lists
+ # --------------------------------------------------------------------------
+ def commands(self, anc, arch):
+ return [
+ (
+ f"./salis.py new -a{anc} -d{self.PUSH_POW} -f -g{compiler} -H{self.tempdir.name} -n{self.SIM_NAME} {optimized} -s{seed} -upush -Utest/ui/ -v{arch} -y{self.PUSH_POW}",
+ f"./salis.py load -g{compiler} -H{self.tempdir.name} -n{self.SIM_NAME} {optimized} -upush -Utest/ui/",
+ )
+ for compiler in ["clang", "gcc", "tcc"]
+ for optimized in ["", "-o"]
+ for seed in [-1, 0, 1234]
+ ]
+
+ # --------------------------------------------------------------------------
+ # [section] file lists
+ # --------------------------------------------------------------------------
+ def files_on_first_push(self):
+ return [*self.files_on_new(self.SIM_NAME), f"{self.tempdir.name}/{self.SIM_NAME}/evas/evas-{2 ** self.PUSH_POW:016x}"]
+
+ def files_on_second_push(self):
+ return [*self.files_on_first_push(), f"{self.tempdir.name}/{self.SIM_NAME}/evas/evas-{2 * (2 ** self.PUSH_POW):016x}"]
+
+ # --------------------------------------------------------------------------
+ # [section] tests null
+ # --------------------------------------------------------------------------
+ def test_null(self):
+ for command in self.commands("0123", "null"):
+ self.run_subprocess(command[0])
+ self.assert_files_exist(self.files_on_first_push())
+ self.run_subprocess(command[1])
+ self.assert_files_exist(self.files_on_second_push())