From 44d7d540c79f57e39e9842e6b99477633278e07f Mon Sep 17 00:00:00 2001 From: Viktor-Lake Date: Wed, 20 Nov 2024 17:17:00 -0300 Subject: [PATCH] Start coding test runner --- test_runner/file.py | 8 +++++--- test_runner/verificator.py | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) mode change 100644 => 100755 test_runner/file.py mode change 100644 => 100755 test_runner/verificator.py diff --git a/test_runner/file.py b/test_runner/file.py old mode 100644 new mode 100755 index d12a49a..bac3809 --- a/test_runner/file.py +++ b/test_runner/file.py @@ -14,7 +14,9 @@ def read_file(name): def read_files_in_dir(path): try: - return [read_file(file) for file in glob.glob(f"{path}/*.hex", recursive=True)] + file = [read_file(file) for file in glob.glob(f"{path}/*.hex", recursive=True)] + file.append(path) + return file except FileNotFoundError: print(f"Error: The directory '{path}' was not found.") return [] @@ -25,7 +27,7 @@ def read_files_in_dir(path): # return a list of all the paths with a directory named 'memory' in the path def list_find_paths(path): - return [ + return { os.path.dirname(file) for file in glob.glob(f"{path}/**/memory/*.hex", recursive=True) - ] + } diff --git a/test_runner/verificator.py b/test_runner/verificator.py old mode 100644 new mode 100755 index b7d9831..8432204 --- a/test_runner/verificator.py +++ b/test_runner/verificator.py @@ -3,24 +3,31 @@ # of the tests in that folder the XML files are saved in the test-reports directory with the name # results_{test_path_name}_{timestamp}.xml +#test_extensão_tipo_timestamp.xml + import os -from processor_ci_communication.core.serial import ProcessorCIInterface -import test_runner.file as f +import file as f + class Verificator: def __init__(self, path): self.path = path - self.interface = ProcessorCIInterface() - self.interface.open() + #self.interface = ProcessorCIInterface() + #self.interface.open() + def run_tests(self): - paths = f.get_all_test_paths(self.path) + tests = [] + paths = f.list_find_paths(self.path) print(paths) + for path in paths: + tests.append(f.read_files_in_dir(path)) + print(tests) def main(): - verifier = Verificator("C:/Users/Usuario/Documents/processor-ci-tests/test_runner") + verifier = Verificator("/eda/processor-ci-tests/test_runner/testing_testes") verifier.run_tests() return 0