Replace serialization/ and verif/ with MLPlatform's serialization_lib submodule
- Remove Usage and Format
- Run black on verif/*.py scripts
Signed-off-by: Kevin Cheng <kevin.cheng@arm.com>
Change-Id: Ie81515891eb0039540f614894f4b6b0e0e78ba74
diff --git a/verif/tosa_test_runner.py b/verif/tosa_test_runner.py
index 6549192..82d447e 100644
--- a/verif/tosa_test_runner.py
+++ b/verif/tosa_test_runner.py
@@ -19,29 +19,34 @@
import subprocess
from enum import IntEnum, unique
+
def run_sh_command(args, full_cmd, capture_output=False):
- '''Utility function to run an external command. Optionally return captured stdout/stderr'''
+ """Utility function to run an external command. Optionally return captured stdout/stderr"""
# Quote the command line for printing
- full_cmd_esc = [ shlex.quote(x) for x in full_cmd ]
+ full_cmd_esc = [shlex.quote(x) for x in full_cmd]
if args.verbose:
- print('### Running {}'.format(' '.join(full_cmd_esc)))
+ print("### Running {}".format(" ".join(full_cmd_esc)))
if capture_output:
rc = subprocess.run(full_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if rc.returncode != 0:
- print(rc.stdout.decode('utf-8'))
- print(rc.stderr.decode('utf-8'))
- raise Exception('Error running command: {}.\n{}'.format(' '.join(full_cmd_esc), rc.stderr.decode('utf-8')))
+ print(rc.stdout.decode("utf-8"))
+ print(rc.stderr.decode("utf-8"))
+ raise Exception(
+ "Error running command: {}.\n{}".format(
+ " ".join(full_cmd_esc), rc.stderr.decode("utf-8")
+ )
+ )
return (rc.stdout, rc.stderr)
else:
rc = subprocess.run(full_cmd)
if rc.returncode != 0:
- raise Exception('Error running command: {}'.format(' '.join(full_cmd_esc)))
+ raise Exception("Error running command: {}".format(" ".join(full_cmd_esc)))
+
class TosaTestRunner:
-
def __init__(self, args, runnerArgs, testDir):
self.args = args
@@ -49,7 +54,7 @@
self.testDir = testDir
# Load the json test file
- with open(os.path.join(testDir, 'desc.json'), 'r') as fd:
+ with open(os.path.join(testDir, "desc.json"), "r") as fd:
self.testDesc = json.load(fd)
def runModel(self):