Neels Hofmeyr has submitted this change and it was merged. Change subject: fix: exception outside of trial run should be logged and cause nonzero rc ......................................................................
fix: exception outside of trial run should be logged and cause nonzero rc >From an earlier stage of the code, there was still an exception catcher that makes no sense. Remove it. Change-Id: I8085318c91b06a3e8f7d3f8cfdd15a99650666e2 --- M src/osmo-gsm-tester.py 1 file changed, 13 insertions(+), 6 deletions(-) Approvals: Pau Espin Pedrol: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/osmo-gsm-tester.py b/src/osmo-gsm-tester.py index 2d02021..7adb2c5 100755 --- a/src/osmo-gsm-tester.py +++ b/src/osmo-gsm-tester.py @@ -70,7 +70,7 @@ from osmo_gsm_tester import __version__ from osmo_gsm_tester import trial, suite, log, config -if __name__ == '__main__': +def main(): import argparse parser = argparse.ArgumentParser(epilog=__doc__, formatter_class=argparse.RawTextHelpFormatter) @@ -166,11 +166,8 @@ trials = [] for trial_package in args.trial_package: t = trial.Trial(trial_package) - try: - t.verify() - trials.append(t) - except: - t.log_exn() + t.verify() + trials.append(t) trials_passed = [] trials_failed = [] @@ -212,4 +209,14 @@ print(' FAIL:', suite) exit(1) +if __name__ == '__main__': + try: + main() + except: + # Tell the log to show the exception, then terminate the program with the exception anyway. + # Since exceptions within test runs should be caught and evaluated, this is basically about + # exceptions during command line parsing and such, so it's appropriate to abort immediately. + log.log_exn() + raise + # vim: expandtab tabstop=4 shiftwidth=4 -- To view, visit https://gerrit.osmocom.org/2604 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8085318c91b06a3e8f7d3f8cfdd15a99650666e2 Gerrit-PatchSet: 3 Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de> Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de>