Skip to content

Commit

Permalink
python: Changed PacketTestTask to directly call make and then the pac…
Browse files Browse the repository at this point in the history
…ket_test_dbg executable.
  • Loading branch information
levy committed Oct 29, 2024
1 parent 5c10a67 commit 1bc5135
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions python/inet/test/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ def get_parameters_string(self, **kwargs):
return self.name

def run_protected(self, **kwargs):
executable = "./runtest"
args = ["make", "-s", "MODE=debug", "-j", str(multiprocessing.cpu_count())]
working_directory = self.simulation_project.get_full_path("tests/packet")
args = [executable, "-s"]
subprocess_result = subprocess.run(args, cwd=working_directory)
if subprocess_result.returncode != 0:
raise Exception(f"Build {simulation_project.get_name()} failed")
args = [f"./packet_test_dbg", "-s", "-u", "Cmdenv", "-c", "UnitTest"]
_logger.debug(args)
subprocess_result = subprocess.run(args, cwd=working_directory, capture_output=True, env=self.simulation_project.get_env())
stdout = subprocess_result.stdout.decode("utf-8")
match = re.search(r"Packet unit test: (\w+)", stdout)
return self.task_result_class(self, result=match.group(1) if match and subprocess_result.returncode == 0 else "FAIL")
return self.task_result_class(self, result="PASS" if subprocess_result.returncode == 0 else "FAIL")

def get_packet_test_tasks(filter=None, working_directory_filter=None, ini_file_filter=None, config_filter=None, run_filter=None, **kwargs):
if filter or (working_directory_filter and not os.path.abspath("tests/packet").startswith(os.path.abspath(working_directory_filter))) or ini_file_filter or config_filter or run_filter:
Expand Down

0 comments on commit 1bc5135

Please sign in to comment.