-
Notifications
You must be signed in to change notification settings - Fork 136
/
Copy pathtest_sparc_toolchain.py
45 lines (35 loc) · 1.44 KB
/
test_sparc_toolchain.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
import pytest
import platform
from ofrak_patch_maker.toolchain.gnu_bcc_sparc import GNU_BCC_SPARC_Toolchain
from ofrak_patch_maker_test import ToolchainUnderTest
from ofrak_patch_maker_test.toolchain_asm import run_monkey_patch_test
from ofrak_patch_maker_test.toolchain_c import run_bounds_check_test, run_hello_world_test
from ofrak_type import ArchInfo, InstructionSet, BitWidth, Endianness
SPARC_EXTENSION = ".sparc"
@pytest.fixture(
params=[
ToolchainUnderTest(
GNU_BCC_SPARC_Toolchain,
ArchInfo(
InstructionSet.SPARC,
None,
BitWidth.BIT_32,
Endianness.BIG_ENDIAN,
None,
),
SPARC_EXTENSION,
),
]
)
def toolchain_under_test(request) -> ToolchainUnderTest:
return request.param
@pytest.mark.skipif(platform.machine() != "x86_64", reason="Test only supported on x86_64")
def test_monkey_patch(toolchain_under_test: ToolchainUnderTest):
run_monkey_patch_test(toolchain_under_test)
# C Tests
@pytest.mark.skipif(platform.machine() != "x86_64", reason="Test only supported on x86_64")
def test_bounds_check(toolchain_under_test: ToolchainUnderTest):
run_bounds_check_test(toolchain_under_test)
@pytest.mark.skipif(platform.machine() != "x86_64", reason="Test only supported on x86_64")
def test_hello_world(toolchain_under_test: ToolchainUnderTest):
run_hello_world_test(toolchain_under_test)