Skip to content

Only return positive return codes #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/mbed-greentea/mbed_greentea/mbed_greentea_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@
run_test_thread,
)

RET_NO_DEVICES = 1001
RET_YOTTA_BUILD_FAIL = -1
LOCAL_HOST_TESTS_DIR = './test/host_tests' # Used by mbedhtrun -e <dir>


Expand Down Expand Up @@ -339,7 +337,7 @@ def main():
except KeyboardInterrupt:
greentea_clean_kettle(gt_instance_uuid)
gt_logger.gt_log_err("ctrl+c keyboard interrupt!")
return(-2) # Keyboard interrupt
return 1 # Keyboard interrupt
except:
greentea_clean_kettle(gt_instance_uuid)
gt_logger.gt_log_err("unexpected error:")
Expand All @@ -353,7 +351,7 @@ def main():
cli_ret = main_cli(opts, args)
except KeyboardInterrupt:
gt_logger.gt_log_err("ctrl+c keyboard interrupt!")
return(-2) # Keyboard interrupt
return 1 # Keyboard interrupt
except Exception as e:
gt_logger.gt_log_err("unexpected error:")
gt_logger.gt_log_tab(str(e))
Expand All @@ -364,6 +362,8 @@ def main():
gt_logger.gt_log("completed in %.2f sec"% delta)

if cli_ret:
if cli_ret < 0 or cli_ret > 255:
cli_ret = 1
gt_logger.gt_log_err("exited with code %d"% cli_ret)

return(cli_ret)
Expand Down
7 changes: 5 additions & 2 deletions packages/mbed-host-tests/mbed_host_tests/mbedhtrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@ def main():
2. Call default test execution function run() to start test instrumentation
"""
freeze_support()
result = -2
result = 1
test_selector = DefaultTestSelector(init_host_test_cli_params())
try:
result = test_selector.execute()
except (KeyboardInterrupt, SystemExit):
test_selector.finish()
result = -3
raise
else:
test_selector.finish()

# Ensure we don't return a negative value
if result < 0 or result > 255:
result = 1

return result
2 changes: 1 addition & 1 deletion packages/mbed-ls/mbed_lstools/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def mbedls_main():

if mbeds is None:
logger.critical('This platform is not supported! Pull requests welcome at github.com/ARMmbed/mbed-ls')
sys.exit(-1)
sys.exit(1)

ret_code = args.command(mbeds, args)
if not ret_code:
Expand Down