Skip to content

Add support for manually passing options to examples.#409

Merged
bdalrhm merged 4 commits intomodel-checking:main-154-2021-08-06from
bdalrhm:man-configs
Aug 10, 2021
Merged

Add support for manually passing options to examples.#409
bdalrhm merged 4 commits intomodel-checking:main-154-2021-08-06from
bdalrhm:man-configs

Conversation

@bdalrhm
Copy link
Copy Markdown
Contributor

@bdalrhm bdalrhm commented Aug 9, 2021

Description of changes:

This PR adds support for manually passing options to examples in the Rust books. The dashboard now looks for configuration files under src/tools/dashboard/configs and prepends the specified options in those files to the top of the extracted examples. With this PR, the number of failing tests drops from 19 to 16.

Resolved issues:

Resolves #407

Call-outs:

This PR also fixes two encountered bugs where tests were not failing for the appropriate reasons:

  • 1 test was failing because of a timeout in the codegen step. Fix: increase timeout from 1 to 5 secs for the check and codegen steps.
  • 2 tests were failing because some command-line arguments were passed in the wrong order. Fix: reorder the arguments.

Testing:

  • How is this change tested?
    • The number of failing tests drop.
  • Is this a refactor change?
    • No.

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@bdalrhm bdalrhm self-assigned this Aug 9, 2021
@bdalrhm bdalrhm requested a review from tedinski August 10, 2021 13:45
let config_dir: PathBuf = ["src", "tools", "dashboard", "configs"].iter().collect();
let mut config_paths = HashSet::new();
let mut stack = vec![config_dir];
while !stack.is_empty() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There's a walkdir crate and https://doc.rust-lang.org/1.2.0/std/fs/fn.walk_dir.html which seems to be marked unstable... are we able to use these? (Maybe the answer is no)

Copy link
Copy Markdown
Contributor Author

@bdalrhm bdalrhm Aug 10, 2021

Choose a reason for hiding this comment

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

It looks like fs::walk_dir got deprecated in favor of the crate. Replaced the code with the crate. Thanks!

Comment on lines +250 to +251
the latest versions of the Rust books. Please update the line \
numbers of the config files and rerun the program.",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Have you chatted with the group about this? Sounds like this approach might be quite flaky?

I don't have any alternative ideas off the top of my head, though. Other than trying to find some git-fu that could automatically update the line numbers somehow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. We talked about this in a previous Deep Dive. We considered automatically updating the line number, but that can introduce silent success/failure if the code-blocks change too. Nathan approved of this as a temporary solution for now, though it adds to the list of problems Adrian has to deal with in his weekly rebases.

@bdalrhm bdalrhm merged commit 9241f70 into model-checking:main-154-2021-08-06 Aug 10, 2021
adpaco-aws pushed a commit that referenced this pull request Aug 17, 2021
* Add support for manually passing options to examples.

* Ignore files with `.props` extension.

* Use `WalkDir` instead of manually reading sub-directories.
adpaco-aws pushed a commit that referenced this pull request Aug 24, 2021
* Add support for manually passing options to examples.

* Ignore files with `.props` extension.

* Use `WalkDir` instead of manually reading sub-directories.
tedinski pushed a commit to tedinski/rmc that referenced this pull request Apr 26, 2022
…#409)

* Add support for manually passing options to examples.

* Ignore files with `.props` extension.

* Use `WalkDir` instead of manually reading sub-directories.
tedinski pushed a commit that referenced this pull request Apr 27, 2022
* Add support for manually passing options to examples.

* Ignore files with `.props` extension.

* Use `WalkDir` instead of manually reading sub-directories.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Look for custom configs in cases where the extracted annotations are not enough (e.g., unwind flag and codegen fail step).

2 participants