aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Johnson <jeremy.johnson@arm.com>2023-11-27 15:02:04 +0000
committerEric Kunze <eric.kunze@arm.com>2023-12-04 21:09:12 +0000
commit39f343498425dd4a0aa0937692a8e630b535e06b (patch)
tree97a7a7b4575a00537a03cf71ab08681f19acd8ab
parent534923df858de76c6e0b0a2689cc23917e873548 (diff)
downloadreference_model-39f343498425dd4a0aa0937692a8e630b535e06b.tar.gz
Path fixes for ref model and libraries
Support relative desc.json paths in refmodel of just "desc.json". Catch when generate and verify library paths are None and provide help in tosa_verif_check_result. Signed-off-by: Jeremy Johnson <jeremy.johnson@arm.com> Change-Id: Ie52ac399ea002e5fcdcc1eec3d9df6153a778e88
-rw-r--r--reference_model/src/main.cpp11
-rw-r--r--verif/checker/tosa_result_checker.py21
-rw-r--r--verif/checker/verifier.py2
-rw-r--r--verif/generator/datagenerator.py2
4 files changed, 27 insertions, 9 deletions
diff --git a/reference_model/src/main.cpp b/reference_model/src/main.cpp
index 24784b5..8539a0b 100644
--- a/reference_model/src/main.cpp
+++ b/reference_model/src/main.cpp
@@ -625,7 +625,16 @@ int initTestDesc(json& test_desc)
// Overwrite flatbuffer_dir/output_dir with dirname(g_func_config.test_desc) if it's not specified.
if (g_func_config.flatbuffer_dir.empty() || g_func_config.output_dir.empty())
{
- std::string test_dir = g_func_config.test_desc.substr(0, g_func_config.test_desc.find_last_of("/\\"));
+ auto slash_pos = g_func_config.test_desc.find_last_of("/\\");
+ std::string test_dir;
+ if (slash_pos != std::string::npos)
+ {
+ test_dir = g_func_config.test_desc.substr(0, slash_pos);
+ }
+ else
+ {
+ test_dir = std::string(".");
+ }
if (g_func_config.flatbuffer_dir.empty())
{
g_func_config.flatbuffer_dir = test_dir;
diff --git a/verif/checker/tosa_result_checker.py b/verif/checker/tosa_result_checker.py
index 8c7e432..6948378 100644
--- a/verif/checker/tosa_result_checker.py
+++ b/verif/checker/tosa_result_checker.py
@@ -63,18 +63,25 @@ def compliance_check(
ofm_name,
verify_lib_path,
):
- try:
- vlib = VerifierLibrary(verify_lib_path)
- except VerifierError as e:
+ if verify_lib_path is None:
+ error = "Please supply --verify-lib-path"
+ else:
+ error = None
+ try:
+ vlib = VerifierLibrary(verify_lib_path)
+ except VerifierError as e:
+ error = str(e)
+
+ if error is not None:
_print_result(LogColors.RED, f"INTERNAL ERROR {test_name}")
- msg = f"Could not load verfier library: {str(e)}"
+ msg = f"Could not load verfier library: {error}"
return (TestResult.INTERNAL_ERROR, 0.0, msg)
success = vlib.verify_data(
ofm_name, compliance_config, imp_result_path, ref_result_path, bnd_result_path
)
if success:
- _print_result(LogColors.GREEN, f"Results PASS {test_name}")
+ _print_result(LogColors.GREEN, f"Compliance Results PASS {test_name}")
return (TestResult.PASS, 0.0, "")
else:
_print_result(LogColors.RED, f"Results NON-COMPLIANT {test_name}")
@@ -279,8 +286,10 @@ def main(argv=None):
"--fp-tolerance", type=float, default=DEFAULT_FP_TOLERANCE, help="FP tolerance"
)
parser.add_argument(
- "--test_path", type=Path, help="path to the test that produced the results"
+ "--test-path", type=Path, help="path to the test that produced the results"
)
+ # Deprecate the incorrectly formatted option by hiding it
+ parser.add_argument("--test_path", type=Path, help=argparse.SUPPRESS)
parser.add_argument(
"--bnd-result-path",
type=Path,
diff --git a/verif/checker/verifier.py b/verif/checker/verifier.py
index 684bea3..839aec2 100644
--- a/verif/checker/verifier.py
+++ b/verif/checker/verifier.py
@@ -48,7 +48,7 @@ class VerifierLibrary:
def __init__(self, verify_lib_path):
"""Find the library and set up the interface."""
self.lib_path = verify_lib_path
- if not self.lib_path.is_file():
+ if self.lib_path is None or not self.lib_path.is_file():
raise VerifierError(f"Could not find verify library - {self.lib_path}")
self.lib = ct.cdll.LoadLibrary(self.lib_path)
diff --git a/verif/generator/datagenerator.py b/verif/generator/datagenerator.py
index 9de421b..0dd60e5 100644
--- a/verif/generator/datagenerator.py
+++ b/verif/generator/datagenerator.py
@@ -27,7 +27,7 @@ class GenerateLibrary:
def __init__(self, generate_lib_path):
"""Find the library and set up the interface."""
self.lib_path = generate_lib_path
- if not self.lib_path.is_file():
+ if self.lib_path is None or not self.lib_path.is_file():
raise GenerateError(f"Could not find generate library - {self.lib_path}")
self.schema_validator = sch.TestDescSchemaValidator()