Skip to content
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

Feature/exit status #5

Merged
merged 2 commits into from
Feb 5, 2024
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
1 change: 1 addition & 0 deletions CARLOS_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
### Minor changes

* Small fix related to CARLA autopilot
* Modified `scenario_runner.py` to return the result of scenario execution as exit code
6 changes: 3 additions & 3 deletions scenario_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,12 @@ def _analyze_scenario(self, config):

if not self.manager.analyze_scenario(self._args.output, filename, junit_filename, json_filename):
print("All scenario tests were passed successfully!")
return True
else:
print("Not all scenario tests were successful")
if not (self._args.output or filename or junit_filename):
print("Please run with --output for further information")
return False

def _record_criteria(self, criteria, name):
"""
Expand Down Expand Up @@ -427,16 +429,14 @@ def _load_and_run_scenario(self, config):
self.manager.run_scenario()

# Provide outputs if required
self._analyze_scenario(config)
result = self._analyze_scenario(config)

# Remove all actors, stop the recorder and save all criterias (if needed)
scenario.remove_all_actors()
if self._args.record:
self.client.stop_recorder()
self._record_criteria(self.manager.scenario.get_criteria(), recorder_name)

result = True

except Exception as e: # pylint: disable=broad-except
traceback.print_exc()
print(e)
Expand Down
Loading