blob: cab195cd545d0f53050e946c06a84266db3277a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# file : test/test_run.py
# project : Salis-VM
# author : Paul Oliver <contact@pauloliver.dev>
# 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())
|