aboutsummaryrefslogtreecommitdiff
path: root/verif
diff options
context:
space:
mode:
authorJeremy Johnson <jeremy.johnson@arm.com>2021-12-14 16:34:05 +0000
committerJeremy Johnson <jeremy.johnson@arm.com>2022-01-06 11:38:19 +0000
commit2ec3494060ffdafec072fe1b2099a8177b8eca6a (patch)
treefbe9d2dfdc4abeff9ba374a90065b7ed98e97509 /verif
parenta1d49853082f5454144209c1d95dc9203f510746 (diff)
downloadreference_model-2ec3494060ffdafec072fe1b2099a8177b8eca6a.tar.gz
Reorganize verif and create packages
Split generator and runner scripts Add package setup Add py-dev-env.sh/.bash to allow editing source files during dev Update README.md with installation info Signed-off-by: Jeremy Johnson <jeremy.johnson@arm.com> Change-Id: I172fe426d99e2e9aeeacedc8b8f3b6a79c8bd39d
Diffstat (limited to 'verif')
-rw-r--r--verif/generator/__init__.py3
-rw-r--r--verif/generator/tosa_error_if.py (renamed from verif/tosa_error_if.py)0
-rw-r--r--verif/generator/tosa_test_gen.py (renamed from verif/tosa_test_gen.py)16
-rw-r--r--[-rwxr-xr-x]verif/generator/tosa_verif_build_tests.py (renamed from verif/tosa_verif_build_tests.py)21
-rw-r--r--verif/runner/__init__.py3
-rw-r--r--verif/runner/tosa_ref_run.py (renamed from verif/tosa_ref_run.py)2
-rw-r--r--verif/runner/tosa_test_runner.py (renamed from verif/tosa_test_runner.py)0
-rw-r--r--[-rwxr-xr-x]verif/runner/tosa_verif_run_ref.py (renamed from verif/tosa_verif_run_ref.py)22
8 files changed, 19 insertions, 48 deletions
diff --git a/verif/generator/__init__.py b/verif/generator/__init__.py
new file mode 100644
index 0000000..39e9ecc
--- /dev/null
+++ b/verif/generator/__init__.py
@@ -0,0 +1,3 @@
+"""Namespace."""
+# Copyright (c) 2021-2022 Arm Limited.
+# SPDX-License-Identifier: Apache-2.0
diff --git a/verif/tosa_error_if.py b/verif/generator/tosa_error_if.py
index 7c162be..7c162be 100644
--- a/verif/tosa_error_if.py
+++ b/verif/generator/tosa_error_if.py
diff --git a/verif/tosa_test_gen.py b/verif/generator/tosa_test_gen.py
index 0d29704..0d5a881 100644
--- a/verif/tosa_test_gen.py
+++ b/verif/generator/tosa_test_gen.py
@@ -32,17 +32,11 @@ import itertools
from copy import deepcopy
from enum import IntEnum, Enum, unique
-from tosa_ref_run import TosaReturnCode
-
-# Include the ../thirdparty/serialization_lib/python directory in PYTHONPATH
-parent_dir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(
- os.path.join(parent_dir, "..", "thirdparty", "serialization_lib", "python")
-)
-import tosa_serializer as ts
-from tosa_serializer import *
+
+import serializer.tosa_serializer as ts
+from serializer.tosa_serializer import *
import tosa
-from tosa_error_if import ErrorIf
+from generator.tosa_error_if import ErrorIf
# Convenience variables to the flatc-generated types that should be enums, but aren't
from tosa.DType import DType
@@ -1587,7 +1581,7 @@ class TosaErrorValidator:
overall_result &= expected_result
if expected_result and error_result:
- serializer.setExpectedReturnCode(2, error_reason)
+ serializer.setExpectedReturnCode(2, True, desc=error_reason)
elif error_result: # and not expected_result
print(f"Unexpected ERROR_IF: Op: {valueToName(Op, kwargs['op']['op'])}"
f" Expected: {error_name}, Got: {validator_name}")
diff --git a/verif/tosa_verif_build_tests.py b/verif/generator/tosa_verif_build_tests.py
index c667e79..09ee238 100755..100644
--- a/verif/tosa_verif_build_tests.py
+++ b/verif/generator/tosa_verif_build_tests.py
@@ -1,6 +1,4 @@
-#!/usr/bin/env python3
-
-# Copyright (c) 2020, ARM Limited.
+# Copyright (c) 2020-2021, ARM Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -32,21 +30,8 @@ import traceback
from enum import IntEnum, Enum, unique
from datetime import datetime
-# Include the ../scripts and ../scripts/xunit directory in PYTHONPATH
-parent_dir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(parent_dir, "..", "scripts"))
-sys.path.append(os.path.join(parent_dir, "..", "scripts", "xunit"))
-
-import xunit
-
-# Include the ../thirdparty/serialization_lib/python directory in PYTHONPATH
-parent_dir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(
- os.path.join(parent_dir, "..", "thirdparty", "serialization_lib", "python")
-)
-from tosa_serializer import *
-from tosa_test_gen import TosaTestGen
-import tosa
+from generator.tosa_test_gen import TosaTestGen
+from serializer.tosa_serializer import dtype_str_to_val
# Used for parsing a comma-separated list of integers in a string
# to an actual list of integers
diff --git a/verif/runner/__init__.py b/verif/runner/__init__.py
new file mode 100644
index 0000000..39e9ecc
--- /dev/null
+++ b/verif/runner/__init__.py
@@ -0,0 +1,3 @@
+"""Namespace."""
+# Copyright (c) 2021-2022 Arm Limited.
+# SPDX-License-Identifier: Apache-2.0
diff --git a/verif/tosa_ref_run.py b/verif/runner/tosa_ref_run.py
index de35d93..c1d5e79 100644
--- a/verif/tosa_ref_run.py
+++ b/verif/runner/tosa_ref_run.py
@@ -17,7 +17,7 @@ import json
import shlex
import subprocess
from enum import Enum, IntEnum, unique
-from tosa_test_runner import TosaTestRunner, run_sh_command
+from runner.tosa_test_runner import TosaTestRunner, run_sh_command
@unique
diff --git a/verif/tosa_test_runner.py b/verif/runner/tosa_test_runner.py
index e8f921d..e8f921d 100644
--- a/verif/tosa_test_runner.py
+++ b/verif/runner/tosa_test_runner.py
diff --git a/verif/tosa_verif_run_ref.py b/verif/runner/tosa_verif_run_ref.py
index 0bfca0f..626819f 100755..100644
--- a/verif/tosa_verif_run_ref.py
+++ b/verif/runner/tosa_verif_run_ref.py
@@ -1,6 +1,4 @@
-#!/usr/bin/env python3
-
-# Copyright (c) 2020, ARM Limited.
+# Copyright (c) 2020-2021, ARM Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -33,21 +31,9 @@ import importlib
from enum import IntEnum, Enum, unique
from datetime import datetime
-# Include the ../scripts and ../scripts/xunit directory in PYTHONPATH
-parent_dir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(parent_dir, "..", "scripts"))
-sys.path.append(os.path.join(parent_dir, "..", "scripts", "xunit"))
-
-import xunit
+from xunit import xunit
-# Include the ../thirdparty/serialization_lib/python directory in PYTHONPATH
-parent_dir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(
- os.path.join(parent_dir, "..", "thirdparty", "serialization_lib", "python")
-)
-import tosa
-from tosa_test_gen import TosaTestGen
-from tosa_test_runner import TosaTestRunner
+from runner.tosa_test_runner import TosaTestRunner
no_color_printing = False
# from run_tf_unit_test import LogColors, print_color, run_sh_command
@@ -105,7 +91,7 @@ def parseArgs():
dest="sut_module",
type=str,
nargs="+",
- default=["tosa_ref_run"],
+ default=["runner.tosa_ref_run"],
help="System under test module to load (derives from TosaTestRunner). May be repeated",
)
parser.add_argument(