mirror of
https://github.com/RRZE-HPC/OSACA.git
synced 2025-07-20 20:21:05 +02:00
added tests for asmbench import
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
ignore:
|
||||
- "tests/**/*" # ignore test folder and all its contents
|
||||
- "tests" # ignore test folder and all its contents
|
||||
- "**/__init__.py" # ignore init files
|
||||
|
@@ -16,7 +16,7 @@ class TestBaseParser(unittest.TestCase):
|
||||
self.parser = BaseParser()
|
||||
except NotImplementedError:
|
||||
pass
|
||||
with open(self._find_file('triad-x86-iaca.s')) as f:
|
||||
with open(self._find_file('triad_x86_iaca.s')) as f:
|
||||
self.triad_code = f.read()
|
||||
|
||||
##################
|
||||
|
@@ -85,13 +85,32 @@ class TestDBInterface(unittest.TestCase):
|
||||
def test_ibench_import(self):
|
||||
# only check import without dumping the DB file (takes too much time)
|
||||
with open(self._find_file('ibench_import_x86.dat')) as input_file:
|
||||
entries = dbi._get_ibench_output(input_file, 'x86')
|
||||
input_data = input_file.readlines()
|
||||
entries = dbi._get_ibench_output(input_data, 'x86')
|
||||
self.assertEqual(len(entries), 3)
|
||||
for _, e in entries.items():
|
||||
self.assertIsNotNone(e['throughput'])
|
||||
self.assertIsNotNone(e['latency'])
|
||||
with open(self._find_file('ibench_import_aarch64.dat')) as input_file:
|
||||
entries = dbi._get_ibench_output(input_file, 'aarch64')
|
||||
input_data = input_file.readlines()
|
||||
entries = dbi._get_ibench_output(input_data, 'aarch64')
|
||||
self.assertEqual(len(entries), 4)
|
||||
for _, e in entries.items():
|
||||
self.assertIsNotNone(e['throughput'])
|
||||
self.assertIsNotNone(e['latency'])
|
||||
|
||||
def test_asmbench_import(self):
|
||||
# only check import without dumping the DB file (takes too much time)
|
||||
with open(self._find_file('asmbench_import_x86.dat')) as input_file:
|
||||
input_data = input_file.readlines()
|
||||
entries = dbi._get_asmbench_output(input_data, 'x86')
|
||||
self.assertEqual(len(entries), 3)
|
||||
for _, e in entries.items():
|
||||
self.assertIsNotNone(e['throughput'])
|
||||
self.assertIsNotNone(e['latency'])
|
||||
with open(self._find_file('asmbench_import_aarch64.dat')) as input_file:
|
||||
input_data = input_file.readlines()
|
||||
entries = dbi._get_asmbench_output(input_data, 'aarch64')
|
||||
self.assertEqual(len(entries), 4)
|
||||
for _, e in entries.items():
|
||||
self.assertIsNotNone(e['throughput'])
|
||||
|
16
tests/test_files/asmbench_import_aarch64.dat
Normal file
16
tests/test_files/asmbench_import_aarch64.dat
Normal file
@@ -0,0 +1,16 @@
|
||||
testinstr-i_d_v
|
||||
Latency: 4.013 cy
|
||||
Throughput: 0.501 cy
|
||||
|
||||
testinstr2-mboi_v
|
||||
Latency: 4.013 cy
|
||||
Throughput: 0.501 cy
|
||||
|
||||
testinstr3-mbisr_v
|
||||
Latency: 4.013 cy
|
||||
Throughput: 0.501 cy
|
||||
|
||||
testinstr3-mboisp_v
|
||||
Latency: 4.013 cy
|
||||
Throughput: 0.501 cy
|
||||
|
12
tests/test_files/asmbench_import_x86.dat
Normal file
12
tests/test_files/asmbench_import_x86.dat
Normal file
@@ -0,0 +1,12 @@
|
||||
testinstr-i_r_x
|
||||
Latency: 4.013 cy
|
||||
Throughput: 0.251 cy
|
||||
|
||||
testinstr2-mboi_x
|
||||
Latency: 8.010 cy
|
||||
Throughput: 0.501 cy
|
||||
|
||||
testinstr3-mbis_y
|
||||
Latency: 8.010 cy
|
||||
Throughput: 0.334 cy
|
||||
|
@@ -21,9 +21,9 @@ class TestFrontend(unittest.TestCase):
|
||||
# set up parser and kernels
|
||||
self.parser_x86 = ParserX86ATT()
|
||||
self.parser_AArch64 = ParserAArch64v81()
|
||||
with open(self._find_file('kernel-x86.s')) as f:
|
||||
with open(self._find_file('kernel_x86.s')) as f:
|
||||
code_x86 = f.read()
|
||||
with open(self._find_file('kernel-AArch64.s')) as f:
|
||||
with open(self._find_file('kernel_aarch64.s')) as f:
|
||||
code_AArch64 = f.read()
|
||||
self.kernel_x86 = self.parser_x86.parse_file(code_x86)
|
||||
self.kernel_AArch64 = self.parser_AArch64.parse_file(code_AArch64)
|
||||
|
@@ -16,9 +16,9 @@ class TestMarkerUtils(unittest.TestCase):
|
||||
def setUpClass(self):
|
||||
self.parser_AArch = ParserAArch64v81()
|
||||
self.parser_x86 = ParserX86ATT()
|
||||
with open(self._find_file('triad-arm-iaca.s')) as f:
|
||||
with open(self._find_file('triad_arm_iaca.s')) as f:
|
||||
triad_code_arm = f.read()
|
||||
with open(self._find_file('triad-x86-iaca.s')) as f:
|
||||
with open(self._find_file('triad_x86_iaca.s')) as f:
|
||||
triad_code_x86 = f.read()
|
||||
self.parsed_AArch = self.parser_AArch.parse_file(triad_code_arm)
|
||||
self.parsed_x86 = self.parser_x86.parse_file(triad_code_x86)
|
||||
|
@@ -15,7 +15,7 @@ class TestParserAArch64v81(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(self):
|
||||
self.parser = ParserAArch64v81()
|
||||
with open(self._find_file('triad-arm-iaca.s')) as f:
|
||||
with open(self._find_file('triad_arm_iaca.s')) as f:
|
||||
self.triad_code = f.read()
|
||||
|
||||
##################
|
||||
|
@@ -15,7 +15,7 @@ class TestParserX86ATT(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(self):
|
||||
self.parser = ParserX86ATT()
|
||||
with open(self._find_file('triad-x86-iaca.s')) as f:
|
||||
with open(self._find_file('triad_x86_iaca.s')) as f:
|
||||
self.triad_code = f.read()
|
||||
|
||||
##################
|
||||
|
@@ -29,9 +29,9 @@ class TestSemanticTools(unittest.TestCase):
|
||||
# set up parser and kernels
|
||||
self.parser_x86 = ParserX86ATT()
|
||||
self.parser_AArch64 = ParserAArch64v81()
|
||||
with open(self._find_file('kernel-x86.s')) as f:
|
||||
with open(self._find_file('kernel_x86.s')) as f:
|
||||
self.code_x86 = f.read()
|
||||
with open(self._find_file('kernel-AArch64.s')) as f:
|
||||
with open(self._find_file('kernel_aarch64.s')) as f:
|
||||
self.code_AArch64 = f.read()
|
||||
self.kernel_x86 = self.parser_x86.parse_file(self.code_x86)
|
||||
self.kernel_AArch64 = self.parser_AArch64.parse_file(self.code_AArch64)
|
||||
|
Reference in New Issue
Block a user