-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconftest.py
57 lines (46 loc) · 1.38 KB
/
conftest.py
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
56
57
import pytest
from bare68k import *
from bare68k.consts import *
from bare68k.machine import *
@pytest.fixture(params=[M68K_CPU_TYPE_68000, M68K_CPU_TYPE_68020],
ids=["68000", "68020"])
def mach(request):
use_labels = getattr(request.module, "use_labels", False)
if use_labels:
print("Using labels")
cpu = request.param
init(cpu, 4, use_labels)
add_memory(0, 1, MEM_FLAGS_RW | MEM_FLAGS_TRAPS)
pulse_reset()
yield
shutdown()
PROG_BASE = 0x1000
STACK = 0x800
# runtime with labels
@pytest.fixture(params=[M68K_CPU_TYPE_68000, M68K_CPU_TYPE_68020],
ids=["68000", "68020"])
def rt(request):
runtime.log_setup()
cpu_cfg = CPUConfig(request.param)
mem_cfg = MemoryConfig()
mem_cfg.add_ram_range(0, 1)
mem_cfg.add_rom_range(2, 1)
run_cfg = RunConfig()
rt = Runtime(cpu_cfg, mem_cfg, run_cfg)
rt.reset(PROG_BASE, STACK)
yield rt
rt.shutdown()
# runtime without labels
@pytest.fixture(params=[M68K_CPU_TYPE_68000, M68K_CPU_TYPE_68020],
ids=["68000", "68020"])
def rtnl(request):
runtime.log_setup()
cpu_cfg = CPUConfig(request.param)
mem_cfg = MemoryConfig()
mem_cfg.add_ram_range(0, 1)
mem_cfg.add_rom_range(2, 1)
run_cfg = RunConfig(with_labels=False)
rt = Runtime(cpu_cfg, mem_cfg, run_cfg)
rt.reset(PROG_BASE, STACK)
yield rt
rt.shutdown()