diff --git a/python/inet/common/task.py b/python/inet/common/task.py index 808797bc3f1..c3022176d27 100644 --- a/python/inet/common/task.py +++ b/python/inet/common/task.py @@ -42,7 +42,7 @@ class TaskResult: result are the result, reason and error_message. """ - def __init__(self, task=None, result="DONE", expected_result="DONE", reason=None, error_message=None, exception=None, store_complete_binary_hash=False, store_complete_source_hash=False, store_partial_binary_hash=False, store_partial_source_hash=False, elapsed_wall_time=None, possible_results=["DONE", "SKIP", "CANCEL", "ERROR"], possible_result_colors=[COLOR_GREEN, COLOR_CYAN, COLOR_CYAN, COLOR_RED], **kwargs): + def __init__(self, task=None, result="DONE", expected_result="DONE", reason=None, stdout=None, stderr=None, error_message=None, exception=None, store_complete_binary_hash=False, store_complete_source_hash=False, store_partial_binary_hash=False, store_partial_source_hash=False, elapsed_wall_time=None, possible_results=["DONE", "SKIP", "CANCEL", "ERROR"], possible_result_colors=[COLOR_GREEN, COLOR_CYAN, COLOR_CYAN, COLOR_RED], **kwargs): """ Initializes a new task result object. @@ -96,6 +96,8 @@ def __init__(self, task=None, result="DONE", expected_result="DONE", reason=None self.expected_result = expected_result self.expected = expected_result == result self.reason = reason + self.stdout = stdout + self.stderr = stderr self.error_message = error_message self.exception = exception self.elapsed_wall_time = elapsed_wall_time diff --git a/python/inet/test/opp.py b/python/inet/test/opp.py index be389506f5b..096f3aca0ca 100644 --- a/python/inet/test/opp.py +++ b/python/inet/test/opp.py @@ -34,13 +34,14 @@ def run_protected(self, capture_output=True, **kwargs): args = [executable, "runtest", self.test_file_name] subprocess_result = subprocess.run(args, cwd=self.working_directory, capture_output=capture_output, env=self.simulation_project.get_env()) stdout = subprocess_result.stdout.decode("utf-8") + stderr = subprocess_result.stderr.decode("utf-8") match = re.search(r"Aggregate result: (\w+)", stdout) if subprocess_result.returncode == signal.SIGINT.value or subprocess_result.returncode == -signal.SIGINT.value: return self.task_result_class(self, result="CANCEL", reason="Cancel by user") elif match and subprocess_result.returncode == 0: return self.task_result_class(self, result=match.group(1)) else: - return self.task_result_class(self, result="FAIL", reason=f"Non-zero exit code: {subprocess_result.returncode}") + return self.task_result_class(self, result="FAIL", reason=f"Non-zero exit code: {subprocess_result.returncode}", stdout=stdout, stderr=stderr) def get_opp_test_tasks(test_folder, simulation_project=None, filter=".*", full_match=False, **kwargs): """