Data generator library python interface added

Added support for using generate library in tosa_verif_build_tests
and tosa_verif_run_tests tosa tool scripts.
Reduced scope of compliance test creation and verification to
the supported type of FP32.
Fix missing virtual destructor warning in generate_dot_product.h and
add config file for generate library.
Simple pytests included to check python interface.

Signed-off-by: Jeremy Johnson <jeremy.johnson@arm.com>
Change-Id: I6cdad9b00660d6ddc8bd07fdea813937fb48626a
diff --git a/verif/runner/tosa_test_runner.py b/verif/runner/tosa_test_runner.py
index b348f50..984b2d9 100644
--- a/verif/runner/tosa_test_runner.py
+++ b/verif/runner/tosa_test_runner.py
@@ -10,7 +10,9 @@
 from checker.color_print import set_print_in_color
 from checker.tosa_result_checker import set_print_result
 from checker.tosa_result_checker import test_check
+from generator.datagenerator import GenerateLibrary
 from json2fbbin import json2fbbin
+from json2numpy import json2numpy
 from runner.tosa_test_presets import TOSA_REFCOMPLIANCE_RUNNER
 
 
@@ -71,6 +73,7 @@
         self.testDirPath = testDirPath
         self.testName = self.testDirPath.name
         self.verify_lib_path = args.verify_lib_path
+        self.generate_lib_path = args.generate_lib_path
 
         set_print_in_color(not args.no_color)
         # Stop the result checker printing anything - we will do it
@@ -135,6 +138,33 @@
                 return True, "non-{} profile".format(self.args.profile)
         return False, ""
 
+    def _ready_file(self, dataFile, jsonOnly=False):
+        """Convert/create any data file that is missing."""
+        dataPath = self.testDirPath / dataFile
+        if not dataPath.is_file():
+            jsonPath = dataPath.with_suffix(".json")
+            if jsonPath.is_file():
+                # Data files stored as JSON
+                if self.args.verbose:
+                    print(f"Readying data file: {dataPath}")
+                json2numpy.json_to_npy(jsonPath)
+            elif not jsonOnly:
+                # Use data generator for all data files
+                if self.args.verbose:
+                    print("Readying all data input files")
+                dgl = GenerateLibrary(self.generate_lib_path)
+                dgl.set_config(self.testDesc)
+                dgl.write_numpy_files(self.testDirPath)
+
+    def readyDataFiles(self):
+        """Check that the data files have been created/converted."""
+        for dataFile in self.testDesc["ifm_file"]:
+            self._ready_file(dataFile)
+        # Convert expected result if any
+        if "expected_result_file" in self.testDesc:
+            for dataFile in self.testDesc["expected_result_file"]:
+                self._ready_file(dataFile, jsonOnly=True)
+
     def runTestGraph(self):
         """Override with function that calls system under test."""
         pass