Skip to content

Rust Based Regression Tester #188

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
Mar 17, 2018
Merged

Conversation

jamesmunns
Copy link
Member

@jamesmunns jamesmunns commented Mar 6, 2018

In order to make running CI tests easier (and faster), I'd like to show you a bit of a hacky PoC I am working on.

This would replace the Bash based CI scripts with a small Rust program. This is largely to take advantage of rayon, since compilation of crates during CI is generally single-CPU bound when compiling a single large lib.rs generated by svd2rust.

This is not ready to merge, but I am mostly looking for feedback from @japaric and @Emilgardis whether this is something you would consider merging.

@jamesmunns jamesmunns changed the title Initial PoC - Rust based CI testing WIP/PoC - Rust based CI testing Mar 6, 2018
@jamesmunns jamesmunns requested review from Emilgardis and japaric March 6, 2018 08:57
@japaric
Copy link
Member

japaric commented Mar 8, 2018

Seems good to me, in principle.

Replacing the bash script with a Rust program also makes it easier to run the test suite on Windows.

This is largely to take advantage of rayon, since compilation of crates during CI is generally single-CPU bound when compiling a single large lib.rs generated by svd2rust.

The Travis builders have 1 VCPU, though, so this would only make local builds faster.

I think while doing this we could also move from testing a whole vendor in a single CI build to more evenly split all the devices across several CI builds.

I'd like to hear what others think.

@jamesmunns
Copy link
Member Author

re: travis and 1VCPU, I am hoping to later offer my GitLab CI builders, which have 16 VCPUs, so once that is implemented, it should help with those builds. Either way, it definitely could help with local builds, where it is typical to have 2-8+ threads available.

I am really open to other possible options for CI options, including specifying specific targets or vendors, maybe tagging targets (e.g. "these SVDs have clusters, and should be tested when anything regarding clusters is changed").

f.write_all(svd.as_bytes()).unwrap();
}

let output = Command::new("/home/james/personal/svd2rust/target/release/svd2rust")
Copy link
Member

Choose a reason for hiding this comment

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

Use CARGO_MANIFEST_DIR here.

@Emilgardis
Copy link
Member

Seems good. Obviously there needs to be more done but the idea is better imo than having it scripted

@jamesmunns jamesmunns force-pushed the rust-ci branch 2 times, most recently from 3dd2ba6 to 8ef24fb Compare March 13, 2018 09:38
@jamesmunns
Copy link
Member Author

Hey @japaric @Emilgardis @ryankurte, I believe I have a good first effort for this tester. I have not attempted to remove the existing CI, I plan to tackle that in another PR.

Feel free to check out the rendered README.md for more information, and let me know if something is not clear.

This should allow users on any supported rust platform (Linux/OSX/Windows) to run regression tests easily.

@jamesmunns jamesmunns changed the title WIP/PoC - Rust based CI testing Rust Based Regression Tester Mar 13, 2018
let any_fails = AtomicBool::new(false);

// TODO: It would be more efficient to reuse directories, so we don't
// have to rebuild all the deps crates
Copy link
Member

Choose a reason for hiding this comment

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

You can place all the tests in a workplace to fix this.

Copy link
Member Author

Choose a reason for hiding this comment

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

@Emilgardis this would prevent all the tests from running in parallel (as-is), as they would be competing for a single workspace lock.

I also tried putting them in a single workspace and ran a cargo build --all at the workspace level, and that seemed to be possible theoretically, but that caused some spurious failures in my testing (perhaps resource exhaustion?). If you feel strongly about it, I can reinvestigate, though I would probably think we could address this as an improvement in the future.

@jamesmunns
Copy link
Member Author

I may also add one more commit that adds a per-test retry threshold to prevent spurious failures (at an individual crate level) from causing a whole-ci failure. I am open to thoughts on this :)

@jamesmunns
Copy link
Member Author

Also Also here is an example of a full regression test build using my CI servers: https://gitlab.onevariable.com/james/svd2rust/-/jobs/72

@jamesmunns
Copy link
Member Author

It seems that some of my spurious failures (mentioned above) are due to out of memory conditions, as some crates take upward of 3.2G of memory to compile (particularly the freescale chips).

I don't know how to work around this, other than document that the testing will require significant amounts of CPU and memory, and hope that people have swap[file] configured.

@jamesmunns
Copy link
Member Author

Hey all, I'd like to get this merged if possible. Is there anything additional needed before merging this? Should it be mentioned in the main README?

@Emilgardis
Copy link
Member

I think a small mention wouldn't hurt.

@japaric
Copy link
Member

japaric commented Mar 17, 2018

LGTM.

I think a small mention wouldn't hurt.

Yeah, it should be mention that svd2rust-regress can be used to run the test suite faster on a local machine.

@jamesmunns
Copy link
Member Author

@japaric @Emilgardis added a mention in the main README. Okay to merge?

@jamesmunns jamesmunns merged commit 82480fd into rust-embedded:master Mar 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants