diff options
author | Jeremy Johnson <jeremy.johnson@arm.com> | 2023-09-27 16:10:59 +0100 |
---|---|---|
committer | Eric Kunze <eric.kunze@arm.com> | 2023-09-28 18:27:41 +0000 |
commit | f0348ea4206a7e02497515ffb6d88546e0121cc7 (patch) | |
tree | 35a003fdff5208864b6b85dff005ce0127ff649a /verif/runner | |
parent | f9c0ceea99e197ab14f779eb51c5e1479dbeb4dd (diff) | |
download | reference_model-f0348ea4206a7e02497515ffb6d88546e0121cc7.tar.gz |
Refactor path arguments to tosa-tools
tosa_verif_conformance_generator
- Move to using ref-model-path instead of ref-model-dir
- Add schema-path and flatc-path
- Add model_files module to locate default places for files
convert2conformance
- Remove default paths
verifier
- Switch to using exact path of verifier library
tosa_verif_run_tests
- Use conformance model_files to locate defaults
Change-Id: Ieca3b164670e2a7dcb047743667cc4e8317daa97
Signed-off-by: Josef Malmström <josef.malmstrom@arm.com>
Signed-off-by: Jeremy Johnson <jeremy.johnson@arm.com>
Diffstat (limited to 'verif/runner')
-rw-r--r-- | verif/runner/tosa_refmodel_sut_run.py | 10 | ||||
-rw-r--r-- | verif/runner/tosa_test_runner.py | 7 | ||||
-rw-r--r-- | verif/runner/tosa_verif_run_tests.py | 54 |
3 files changed, 42 insertions, 29 deletions
diff --git a/verif/runner/tosa_refmodel_sut_run.py b/verif/runner/tosa_refmodel_sut_run.py index 7b129da..419f87b 100644 --- a/verif/runner/tosa_refmodel_sut_run.py +++ b/verif/runner/tosa_refmodel_sut_run.py @@ -1,5 +1,5 @@ """TOSA test runner module for the Reference Model.""" -# Copyright (c) 2020-2022, ARM Limited. +# Copyright (c) 2020-2023, ARM Limited. # SPDX-License-Identifier: Apache-2.0 from enum import IntEnum from enum import unique @@ -33,10 +33,10 @@ class TosaSUTRunner(TosaTestRunner): # Call Reference model with description file to provide all file details cmd = [ - args.ref_model_path, - "--tosa_level={}".format(args.tosa_level), - "--operator_fbs={}".format(args.operator_fbs), - "--test_desc={}".format(self.descFile), + str(args.ref_model_path), + f"--tosa_level={args.tosa_level}", + f"--operator_fbs={str(args.schema_path)}", + f"--test_desc={self.descFile}", ] # Specific debug options for reference model diff --git a/verif/runner/tosa_test_runner.py b/verif/runner/tosa_test_runner.py index d8c2a87..579dd60 100644 --- a/verif/runner/tosa_test_runner.py +++ b/verif/runner/tosa_test_runner.py @@ -1,9 +1,8 @@ """Template test runner class for running TOSA tests.""" -# Copyright (c) 2020-2022, ARM Limited. +# Copyright (c) 2020-2023, ARM Limited. # SPDX-License-Identifier: Apache-2.0 import json from enum import IntEnum -from pathlib import Path from checker.tosa_result_checker import LogColors from checker.tosa_result_checker import print_color @@ -62,8 +61,8 @@ class TosaTestRunner: if args.binary and tosaFilePath.suffix == ".json": # Convert tosa JSON to binary json2fbbin.json_to_fbbin( - Path(args.flatc_path), - Path(args.operator_fbs), + args.flatc_path, + args.schema_path, tosaFilePath, testDirPath, ) diff --git a/verif/runner/tosa_verif_run_tests.py b/verif/runner/tosa_verif_run_tests.py index 814c864..722c0e7 100644 --- a/verif/runner/tosa_verif_run_tests.py +++ b/verif/runner/tosa_verif_run_tests.py @@ -1,5 +1,5 @@ """TOSA verification runner script.""" -# Copyright (c) 2020-2022, ARM Limited. +# Copyright (c) 2020-2023, ARM Limited. # SPDX-License-Identifier: Apache-2.0 import argparse import importlib @@ -10,6 +10,7 @@ import traceback from datetime import datetime from pathlib import Path +import conformance.model_files as cmf from json2numpy import json2numpy from runner.tosa_test_runner import TosaTestInvalid from runner.tosa_test_runner import TosaTestRunner @@ -46,25 +47,29 @@ def parseArgs(argv): help="Recursively search for tests", ) parser.add_argument( - "--operator-fbs", - dest="operator_fbs", - default="conformance_tests/third_party/serialization_lib/schema/tosa.fbs", - type=str, - help="flat buffer syntax file", - ) - parser.add_argument( "--ref-model-path", dest="ref_model_path", - default="reference_model/build/reference_model/tosa_reference_model", - type=str, - help="Path to reference model executable", + type=Path, + help="Path to TOSA reference model executable", + ) + parser.add_argument( + "--operator-fbs", + "--schema-path", + dest="schema_path", + type=Path, + help=( + "Path to TOSA reference model flat buffer schema. Defaults to " + f"`{cmf.DEFAULT_REF_MODEL_SCHEMA_PATH}` in parents parent directory of `ref-model-path`" + ), ) parser.add_argument( "--flatc-path", dest="flatc_path", - default="reference_model/build/thirdparty/serialization_lib/third_party/flatbuffers/flatc", - type=str, - help="Path to flatc compiler executable", + type=Path, + help=( + "Path to flatc executable. Defaults to " + f"`{cmf.DEFAULT_REF_MODEL_BUILD_FLATC_PATH}` in parent directory of `ref-model-path`" + ), ) parser.add_argument( "--ref-debug", @@ -339,13 +344,22 @@ def main(argv=None): """Start worker threads to do the testing and outputs the results.""" args = parseArgs(argv) - if ( - TOSA_REFMODEL_RUNNER in args.sut_module - and not Path(args.ref_model_path).is_file() - ): - print( - "Argument error: Reference Model not found ({})".format(args.ref_model_path) + # Set up some defaults + if args.ref_model_path is None: + args.ref_model_path = cmf.find_tosa_file( + cmf.TosaFileType.REF_MODEL, Path("reference_model"), False ) + if args.flatc_path is None: + args.flatc_path = cmf.find_tosa_file( + cmf.TosaFileType.FLATC, args.ref_model_path + ) + if args.schema_path is None: + args.schema_path = cmf.find_tosa_file( + cmf.TosaFileType.SCHEMA, args.ref_model_path + ) + + if TOSA_REFMODEL_RUNNER in args.sut_module and not args.ref_model_path.is_file(): + print(f"Argument error: Reference Model not found - {str(args.ref_model_path)}") exit(2) if args.test_list_file: |