-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add initial support for Litani build and dashboard. #389
Conversation
for command in self.spawned_commands.iter_mut() { | ||
command.wait().unwrap(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if they do not terminate? Are we using timeouts when invoking litani?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not running the tests here. We're only adding them as jobs for Litani to run later. This command takes less around 0.1 second. However, the run-build
command after this may not terminate, but that's a good hint that we're missing a --unwind
argument somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a timeout to run-build
then? Litani should have that feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can do. Currently, individual jobs can take a --timeout
flag which is often more useful, but added an issue for this.
src/tools/dashboard/src/litani.rs
Outdated
command.get_envs().filter(|(k, _)| !job_envs.contains_key(k)).fold( | ||
&mut new_envs, | ||
|fmt, (k, v)| { | ||
fmt.write_fmt(format_args!( | ||
"{}=\"{}\" ", | ||
k.to_str().unwrap(), | ||
v.unwrap().to_str().unwrap() | ||
)) | ||
.unwrap(); | ||
fmt | ||
}, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this block of code just pretty-printing a HashMap struct? There must be a more idiomatic way of doing that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm... I haven't found anything online. I could use flat_map
instead of fold
if you prefer that.
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
//! The types and procedures in this modules are similar to the ones in | ||
//! `compiletest`. Consider using `Litani` to run the test suites. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should import these types and procedures instead. Or add them here and import in compiletest
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened an issue for this.
/// A buffer of the `spawn`ed Litani jobs so far. `Litani` takes some time | ||
/// to execute each `add-job` command and executing thousands of them | ||
/// sequentially takes a considerable amount of time. To speed up the | ||
/// execution of those commands, we spawn those commands sequentially (as | ||
/// normal). However, instead of `wait`ing for each process to terminate, | ||
/// we add its handle to a buffer of the `spawn`ed processes and continue | ||
/// with our program. Once we are done adding jobs, we wait for all of them | ||
/// to terminate before we run the `run-build` command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just say that we spawn all litani asynchronously and wait for them to terminate.
/// we add its handle to a buffer of the `spawn`ed processes and continue | ||
/// with our program. Once we are done adding jobs, we wait for all of them | ||
/// to terminate before we run the `run-build` command. | ||
spawned_commands: Vec<Child>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually safe to run multiple litani add-job
in parallel. Have you considered doing something like that? If there's a way in rust to launch some kind of thread pool, you could have a bunch of worker threads that all call litani add-job
concurrently. We do this in other projects, but using python.
No need to do this for this PR, it could be something we do later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what spawned_commands
is for 🙂. We spawn the litani add-job
processes sequentially. But the processes themselves run concurrently. I experimented with spawning those processes concurrently, but did not see any performance improvements as it takes much longer to execute and terminate litani add-job
processes concurrently than it takes spawn them and parse all tests sequentially (it's Rust after all 😉).
for command in self.spawned_commands.iter_mut() { | ||
command.wait().unwrap(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can do. Currently, individual jobs can take a --timeout
flag which is often more useful, but added an issue for this.
fmt | ||
}); | ||
job.args([ | ||
"add-job", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're using inputs and outputs as I suggest below, I suggest also passing in --phony-outputs
; this is available in the develop branch of Litani, we'll release it probably next week
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's SO COOOL!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to insert links instead of referencing issue numbers. This way developers can just click on them.
src/tools/dashboard/src/litani.rs
Outdated
"--ok-returns", | ||
&exit_status.to_string(), | ||
"--timeout", | ||
"10", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid hard-coding here by making timeout a parameter of add_job
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Changed the timeout value for check
and codegen
steps to 1 sec.
* Add initial support for Litani build and dashboard. * Add panic message and issue numbers. * Add a timeout for Litani jobs. * Add depencies between jobs. * Add links to issues. Co-authored-by: Adrian Palacios <[email protected]>
* Add initial support for Litani build and dashboard. * Add panic message and issue numbers. * Add a timeout for Litani jobs. * Add depencies between jobs. * Add links to issues. Co-authored-by: Adrian Palacios <[email protected]>
* Add initial support for Litani build and dashboard. * Add panic message and issue numbers. * Add a timeout for Litani jobs. * Add depencies between jobs. * Add links to issues. Co-authored-by: Adrian Palacios <[email protected]>
* Add initial support for Litani build and dashboard. * Add panic message and issue numbers. * Add a timeout for Litani jobs. * Add depencies between jobs. * Add links to issues. Co-authored-by: Adrian Palacios <[email protected]>
* Add initial support for Litani build and dashboard. * Add panic message and issue numbers. * Add a timeout for Litani jobs. * Add depencies between jobs. * Add links to issues. Co-authored-by: Adrian Palacios <[email protected]>
* Add initial support for Litani build and dashboard. * Add panic message and issue numbers. * Add a timeout for Litani jobs. * Add depencies between jobs. * Add links to issues. Co-authored-by: Adrian Palacios <[email protected]>
Description of changes:
This PR adds initial support for Litani build. We use Litani to run RMC on the examples and generate an HTML dashboard with the results.
Resolved issues:
Resolves #384 & #392
Call-outs:
src/tools/dashboard/src/util.rs
contains a lot of duplicated code fromcompiletest
. Consider reconciling withcompiletest
or porting all of our test suites toLitani
.run.json
to generate the terminal dashboard.build
,test
, andreport
) does not match with our stages (check
,codegen
,verification
). Switch to custom stage names when Litani adds support for that.Testing:
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.