# file : test/test_build.py # project : Salis-VM # author : Paul Oliver # 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"])