mirror of
https://github.com/RRZE-HPC/OSACA.git
synced 2025-12-16 00:50:06 +01:00
added test to check all micro-archs
This commit is contained in:
@@ -17,6 +17,7 @@ MODULE_DATA_DIR = os.path.join(
|
||||
)
|
||||
LOCAL_OSACA_DIR = os.path.join(os.path.expanduser('~') + '/.osaca/')
|
||||
DATA_DIR = os.path.join(LOCAL_OSACA_DIR, 'data/')
|
||||
SUPPORTED_ARCHS = ['SNB', 'IVB', 'HSW', 'BDW', 'SKX', 'CSX', 'ZEN1', 'ZEN2', 'TX2']
|
||||
|
||||
|
||||
# Stolen from pip
|
||||
@@ -141,10 +142,9 @@ def check_arguments(args, parser):
|
||||
:param args: arguments given from :class:`~argparse.ArgumentParser` after parsing
|
||||
:param parser: :class:`~argparse.ArgumentParser` object
|
||||
"""
|
||||
supported_archs = ['SNB', 'IVB', 'HSW', 'BDW', 'SKX', 'CSX', 'ZEN1', 'ZEN2', 'TX2']
|
||||
supported_import_files = ['ibench', 'asmbench']
|
||||
|
||||
if 'arch' in args and (args.arch is None or args.arch.upper() not in supported_archs):
|
||||
if 'arch' in args and (args.arch is None or args.arch.upper() not in SUPPORTED_ARCHS):
|
||||
parser.error(
|
||||
'Microarchitecture not supported. Please see --help for all valid architecture codes.'
|
||||
)
|
||||
|
||||
@@ -12,6 +12,7 @@ from unittest.mock import patch
|
||||
|
||||
import osaca.osaca as osaca
|
||||
from osaca.parser import ParserAArch64v81, ParserX86ATT
|
||||
from osaca.semantics import MachineModel
|
||||
|
||||
|
||||
class ErrorRaisingArgumentParser(argparse.ArgumentParser):
|
||||
@@ -138,6 +139,20 @@ class TestCLI(unittest.TestCase):
|
||||
osaca.run(args, output_file=output)
|
||||
self.assertTrue('WARNING' not in output.getvalue())
|
||||
|
||||
def test_architectures(self):
|
||||
parser = osaca.create_parser()
|
||||
# Run the test kernel for all architectures
|
||||
archs = osaca.SUPPORTED_ARCHS
|
||||
for arch in archs:
|
||||
with self.subTest(micro_arch=arch):
|
||||
isa = MachineModel.get_isa_for_arch(arch)
|
||||
kernel = 'kernel_{}.s'.format(isa)
|
||||
args = parser.parse_args(
|
||||
['--arch', arch, self._find_test_file(kernel)]
|
||||
)
|
||||
output = StringIO()
|
||||
osaca.run(args, output_file=output)
|
||||
|
||||
##################
|
||||
# Helper functions
|
||||
##################
|
||||
|
||||
Reference in New Issue
Block a user