3636MAX_REFACTORING_ITERATIONS = 5
3737MAX_UNIT_TEST_RENDER_RETRIES = 2
3838
39+ UNRECOVERABLE_ERROR_EXIT_CODES = [69 ]
40+ TIMEOUT_ERROR_EXIT_CODE = 124
41+
3942
4043class InvalidFridArgument (Exception ):
4144 pass
@@ -106,10 +109,7 @@ def execute_test_script(test_script, scripts_args, verbose, test_type):
106109 else :
107110 console .info (f"[b]All { test_type } tests passed successfully.[/b]\n " )
108111
109- # Return the output of the test script if it failed
110- if result .returncode != 0 :
111- return result .stdout
112- return None
112+ return result .returncode , result .stdout
113113 except subprocess .TimeoutExpired as e :
114114 # Store timeout output in a temporary file
115115 if verbose :
@@ -125,7 +125,7 @@ def execute_test_script(test_script, scripts_args, verbose, test_type):
125125 f"The { test_type } test timed out after { TEST_SCRIPT_EXECUTION_TIMEOUT } seconds. Test output stored in: { temp_file_path } \n "
126126 )
127127
128- return f"Tests did not finish in { TEST_SCRIPT_EXECUTION_TIMEOUT } seconds."
128+ return TIMEOUT_ERROR_EXIT_CODE , f"Tests did not finish in { TEST_SCRIPT_EXECUTION_TIMEOUT } seconds."
129129
130130
131131def run_unittests (
@@ -146,10 +146,17 @@ def run_unittests(
146146 if args .verbose :
147147 console .info (f"Running unit tests attempt { unit_test_run_count } ." )
148148
149- unittests_issue = execute_test_script (args .unittests_script , [args .build_folder ], args .verbose , "unit" )
149+ exit_code , unittests_issue = execute_test_script (
150+ args .unittests_script , [args .build_folder ], args .verbose , "unit"
151+ )
150152
151- if not unittests_issue :
153+ if exit_code == 0 :
152154 return existing_files , changed_files , True
155+ elif exit_code in UNRECOVERABLE_ERROR_EXIT_CODES :
156+ console .error (unittests_issue )
157+ exit_with_error (
158+ "Unit tests script failed due to problems in the environment setup. Please check the your environment or update the script for running unittests." ,
159+ )
153160
154161 existing_files_content = file_utils .get_existing_files_content (args .build_folder , existing_files )
155162
@@ -315,16 +322,22 @@ def run_conformance_tests( # noqa: C901
315322 f"\n [b]Running conformance tests script { args .conformance_tests_script } for { conformance_tests_folder_name } (functional requirement { functional_requirement_id } , attempt: { conformance_test_fix_count } ).[/b]"
316323 )
317324
318- conformance_tests_issue = execute_test_script (
325+ exit_code , conformance_tests_issue = execute_test_script (
319326 args .conformance_tests_script ,
320327 [args .build_folder , conformance_tests_folder_name ],
321328 args .verbose ,
322329 "conformance" ,
323330 )
324331
325- if not conformance_tests_issue :
332+ if exit_code == 0 :
326333 break
327334
335+ elif exit_code in UNRECOVERABLE_ERROR_EXIT_CODES :
336+ console .error (conformance_tests_issue )
337+ exit_with_error (
338+ "Conformance tests script failed due to problems in the envronment setup. Please check the your environment or update the script for running conformance tests." ,
339+ )
340+
328341 if conformance_test_fix_count > MAX_CONFORMANCE_TEST_FIX_ATTEMPTS :
329342 console .info (
330343 f"Conformance tests script { args .conformance_tests_script } for { conformance_tests_folder_name } still failed after { conformance_test_fix_count - 1 } attempts at fixing issues."
0 commit comments