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

simulation: fix expect script; add failure string #342

Merged
merged 1 commit into from
Mar 16, 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
2 changes: 1 addition & 1 deletion camkes-vm/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def run_build(manifest_dir: str, build: Build):
]

if plat.has_simulation and plat.name != 'PC99':
script.append(sim_script(build.success))
script.append(sim_script(build.success, failure=build.error))

return run_build_script(manifest_dir, build, script)

Expand Down
9 changes: 6 additions & 3 deletions seL4-platforms/builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,14 @@ def summarise_junit(file_path: str) -> Tuple[int, List[str]]:
"-q", junit_results, parsed_junit_results]


def sim_script(success: str, timeout=1200):
def sim_script(success: str, failure=None, timeout=1200):
"""Return a script to run a simulation with timeout and expected success string.
Abort early on expected failure string."""
fail_str = "%s {exit 1}" % failure if failure else ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding some docs.

return [
"expect", "-c",
'spawn ./simulate; set timeout %d; expect { "%s" {exit 0} timeout {exit 1} }' %
(timeout, success)
'spawn ./simulate; set timeout %d; expect "%s" {exit 0} %s timeout {exit 1}' %
(timeout, fail_str, success)
]


Expand Down
2 changes: 1 addition & 1 deletion sel4test-sim/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
def run_simulation(manifest_dir: str, build: Build):
"""Run one simulation build and test."""

expect = '{ "%s" {exit 0} timeout {exit 1} }' % build.success
expect = '"%s" {exit 0} timeout {exit 1}' % build.success

script = [
["../init-build.sh"] + build.settings_args(),
Expand Down
Loading