summaryrefslogtreecommitdiff
path: root/test/test_build.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_build.py
parentf2c34b1d2c18270a0327fb4896fa307fae098770 (diff)
Adds unit test framework
Diffstat (limited to 'test/test_build.py')
-rw-r--r--test/test_build.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/test_build.py b/test/test_build.py
new file mode 100644
index 0000000..7c0126a
--- /dev/null
+++ b/test/test_build.py
@@ -0,0 +1,56 @@
+# file : test/test_build.py
+# project : Salis-VM
+# author : Paul Oliver <contact@pauloliver.dev>
+
+# index:
+# [section] imports
+# [section] constants
+# [section] command lists
+# [section] tests null
+
+# ------------------------------------------------------------------------------
+# [section] imports
+# ------------------------------------------------------------------------------
+from test_general import SalisTest
+
+class TestBuild(SalisTest):
+ # --------------------------------------------------------------------------
+ # [section] constants
+ # --------------------------------------------------------------------------
+ SIM_NAME = "test-build.sim"
+
+ # --------------------------------------------------------------------------
+ # [section] command lists
+ # --------------------------------------------------------------------------
+ def commands_new(self, anc, arch):
+ return [
+ f"./salis.py new -a{anc} -b -f -g{compiler} -H{self.tempdir.name} -n{self.SIM_NAME} {optimized} -s{seed} -u{ui} -v{arch}"
+ for compiler in ["clang", "gcc", "tcc"]
+ for optimized in ["", "-o"]
+ for seed in [-1, 0, 1234]
+ for ui in ["daemon"]
+ ]
+
+ def commands_load(self):
+ return [
+ f"./salis.py load -b -g{compiler} -H{self.tempdir.name} -n{self.SIM_NAME} {optimized} -u{ui}"
+ for compiler in ["clang", "gcc", "tcc"]
+ for optimized in ["", "-o"]
+ for ui in ["daemon"]
+ ]
+
+ # --------------------------------------------------------------------------
+ # [section] tests null
+ # --------------------------------------------------------------------------
+ def test_null_new(self):
+ for command in self.commands_new("0123", "null"):
+ self.run_subprocess(command)
+ self.assert_files_exist([f"{self.tempdir.name}/{self.SIM_NAME}/opts.json"])
+
+ def test_null_load(self):
+ self.run_subprocess(self.commands_new("0123", "null")[0])
+ self.assert_files_exist([f"{self.tempdir.name}/{self.SIM_NAME}/opts.json"])
+
+ for command in self.commands_load():
+ self.run_subprocess(command)
+ self.assert_files_exist([f"{self.tempdir.name}/{self.SIM_NAME}/opts.json"])