diff options
Diffstat (limited to 'test/test_build.py')
| -rw-r--r-- | test/test_build.py | 56 |
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"]) |
