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