Skip to content

Commit cf19bb6

Browse files
authored
Merge pull request #3727 from c1728p9/fix_error_handling
Fix access before variable defined bug in test_api
2 parents e8a7264 + 83e843b commit cf19bb6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tools/test_api.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,12 +2201,16 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
22012201
report[target_name][toolchain_name][test_key] = report_entry[test_key]
22022202

22032203
# Set the overall result to a failure if a build failure occurred
2204-
if not worker_result['result'] and not isinstance(worker_result['reason'], NotSupportedException):
2204+
if ('reason' in worker_result and
2205+
not worker_result['reason'] and
2206+
not isinstance(worker_result['reason'], NotSupportedException)):
22052207
result = False
22062208
break
22072209

22082210
# Adding binary path to test build result
2209-
if worker_result['result'] and 'bin_file' in worker_result:
2211+
if ('result' in worker_result and
2212+
worker_result['result'] and
2213+
'bin_file' in worker_result):
22102214
bin_file = norm_relative_path(worker_result['bin_file'], execution_directory)
22112215

22122216
test_build['tests'][worker_result['kwargs']['project_id']] = {

0 commit comments

Comments
 (0)