()
| 223 | return 0 |
| 224 | |
| 225 | def main(): |
| 226 | if sys.version_info[0] < 3: |
| 227 | logging.critical ("Python 3 or a more recent version is required.") |
| 228 | |
| 229 | if (len(sys.argv) < 3): |
| 230 | logging.critical ("usage: %s <PerformanceTests.json> <output_folder>" % (sys.argv[0])) |
| 231 | |
| 232 | json_path = sys.argv[1] |
| 233 | output_binary_path = sys.argv[2] |
| 234 | |
| 235 | try: |
| 236 | with open(json_path) as json_file: |
| 237 | json_text = json_file.read() |
| 238 | except IOError: |
| 239 | logging.error("IOError!") |
| 240 | return 1 |
| 241 | |
| 242 | try: |
| 243 | json_data = json.loads(json_text) |
| 244 | if not isinstance(json_data, dict): |
| 245 | raise TypeError('JSON data must be a dict') |
| 246 | |
| 247 | return parse_json_data(json_path, os.path.basename(json_path), json_data, output_binary_path) |
| 248 | |
| 249 | except ValueError as ve: |
| 250 | logging.error(f'JSON error: {ve}') |
| 251 | |
| 252 | return 1 |
| 253 | |
| 254 | return 0 |
| 255 | |
| 256 | if __name__ == "__main__": |
| 257 | # execute only if run as a script |
no test coverage detected