aboutsummaryrefslogtreecommitdiff
path: root/verif/tosa_verif_build_tests.py
diff options
context:
space:
mode:
authorMatthew Haddon <matthew.haddon@arm.com>2021-10-01 15:51:03 +0100
committerEric Kunze <eric.kunze@arm.com>2021-10-07 14:58:22 +0000
commit1c00b71c44c80b2433e1837af204317636a69f95 (patch)
tree1fe59b4c8d4c154d0ebb59b28fbd7df27ec76247 /verif/tosa_verif_build_tests.py
parent960985a8c6aac1a5b0822a97fe222c2b441acda1 (diff)
downloadreference_model-1c00b71c44c80b2433e1837af204317636a69f95.tar.gz
Separate positive and negative test generation and refactor
* Positive and negative tests are now produced entirely in isolation, if 'both' test types are chosen all positive tests are generated, then all the negative tests are generated, without combining the two * Moved tensor generation out of serialize test and into it's own function Signed-off-by: Matthew Haddon <matthew.haddon@arm.com> Change-Id: Id8e9023d2c2966a0b14ae83d2d848a66cb125fcb
Diffstat (limited to 'verif/tosa_verif_build_tests.py')
-rwxr-xr-xverif/tosa_verif_build_tests.py54
1 files changed, 30 insertions, 24 deletions
diff --git a/verif/tosa_verif_build_tests.py b/verif/tosa_verif_build_tests.py
index 040481b..c667e79 100755
--- a/verif/tosa_verif_build_tests.py
+++ b/verif/tosa_verif_build_tests.py
@@ -220,32 +220,38 @@ def main():
ttg = TosaTestGen(args)
- testList = []
- for op in ttg.TOSA_OP_LIST:
- if re.match(args.filter + ".*", op):
- testList.extend(
- ttg.genOpTestList(
- op,
- shapeFilter=args.target_shapes,
- rankFilter=args.target_ranks,
- dtypeFilter=args.target_dtypes,
- testType=args.test_type
+ if args.test_type == 'both':
+ testType = ['positive', 'negative']
+ else:
+ testType = [args.test_type]
+ results = []
+ for test_type in testType:
+ testList = []
+ for op in ttg.TOSA_OP_LIST:
+ if re.match(args.filter + ".*", op):
+ testList.extend(
+ ttg.genOpTestList(
+ op,
+ shapeFilter=args.target_shapes,
+ rankFilter=args.target_ranks,
+ dtypeFilter=args.target_dtypes,
+ testType=test_type
+ )
)
- )
- print("{} matching tests".format(len(testList)))
- results = []
- testStrings = []
- for opName, testStr, dtype, error, shapeList, testArgs in testList:
- # Check for and skip duplicate tests
- if testStr in testStrings:
- continue
- else:
- testStrings.append(testStr)
-
- if args.verbose:
- print(testStr)
- results.append(ttg.serializeTest(opName, testStr, dtype, error, shapeList, testArgs))
+ print("{} matching {} tests".format(len(testList), test_type))
+
+ testStrings = []
+ for opName, testStr, dtype, error, shapeList, testArgs in testList:
+ # Check for and skip duplicate tests
+ if testStr in testStrings:
+ continue
+ else:
+ testStrings.append(testStr)
+
+ if args.verbose:
+ print(testStr)
+ results.append(ttg.serializeTest(opName, testStr, dtype, error, shapeList, testArgs))
print(f"Done creating {len(results)} tests")