diff options
| author | Paul Oliver <contact@pauloliver.dev> | 2026-06-18 00:08:54 +0200 |
|---|---|---|
| committer | Paul Oliver <contact@pauloliver.dev> | 2026-06-25 00:15:17 +0200 |
| commit | 0f5581f53f73a92d33826c4771553a9683376e67 (patch) | |
| tree | eab8172d21dc4a0b36714af541d22a82cec858f3 /test/test_build.py | |
| parent | 00a0cb3821ce2bd0fc589ae64ed9cbb791ce44bb (diff) | |
Adds unit testing scaffold and build tests
Diffstat (limited to 'test/test_build.py')
| -rw-r--r-- | test/test_build.py | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/test/test_build.py b/test/test_build.py new file mode 100644 index 0000000..e0fecef --- /dev/null +++ b/test/test_build.py @@ -0,0 +1,80 @@ +import signal + +from test_general import SalisTest + +class TestBuild(SalisTest): + def cmds_new(self, anc, arch): + return ( + f"./salis.py new -a{anc} -b -f -g{compiler} -H{self.tempdir.name} {optimized} -s{seed} -u{ui} -v{arch}" + for compiler in ["clang", "gcc"] + for optimized in ["", "-o"] + for seed in [-1, 0, 1234] + for ui in ["curses", "daemon"] + ) + + def cmds_new_dummy(self): + return self.cmds_new("0123", "dummy") + + def cmds_new_v1(self): + return self.cmds_new("55a", "v1") + + def cmds_load(self): + return ( + f"./salis.py load -b -g{compiler} -H{self.tempdir.name} {optimized} -u{ui}" + for compiler in ["clang", "gcc"] + for optimized in ["", "-o"] + for ui in ["curses", "daemon"] + ) + + def cmds_server(self): + return ( + f"./salis.py server -b -g{compiler} -H{self.tempdir.name} {optimized}" + for compiler in ["clang", "gcc"] + for optimized in ["", "-o"] + ) + + def cmds_client(self): + return ( + f"./salis.py client -b -g{c_compiler} {optimized} -x{cxx_compiler}" + for c_compiler in ["clang", "gcc"] + for cxx_compiler in ["clang", "gcc"] + for optimized in ["", "-o"] + ) + + def test_dummy_new(self): + for cmd in self.cmds_new_dummy(): + SalisTest.run_subprocess(cmd) + + def test_v1_new(self): + for cmd in self.cmds_new_v1(): + SalisTest.run_subprocess(cmd) + + def test_dummy_load(self): + SalisTest.run_subprocess(next(self.cmds_new_dummy())) + + for cmd in self.cmds_load(): + SalisTest.run_subprocess(cmd) + + def test_v1_load(self): + SalisTest.run_subprocess(next(self.cmds_new_v1())) + + for cmd in self.cmds_load(): + SalisTest.run_subprocess(cmd) + + def test_server(self): + SalisTest.run_subprocess(next(self.cmds_new_dummy())) + + for cmd in self.cmds_server(): + SalisTest.run_subprocess(cmd) + + @SalisTest.run_ui_test(anc="0123", anc_path="anc", name="def.sim", ui="null", ui_path="test/ui", vm_arch="dummy") + def test_client(self): + with SalisTest.run_pipe(f"./salis.py server -H{self.tempdir.name}") as server_proc: + for line in server_proc.stdout: + if "Listening..." in line: + break + + for cmd in self.cmds_client(): + SalisTest.run_subprocess(cmd) + + server_proc.send_signal(signal.SIGINT) |
