Skip to content

Add exec mode for compiletest - #2102

Merged
adpaco merged 16 commits into
model-checking:mainfrom
adpaco:compiletest-exec-mode
Jan 12, 2023
Merged

adpaco merged 16 commits into
model-checking:mainfrom
adpaco:compiletest-exec-mode

Conversation

@adpaco

@adpaco adpaco commented Jan 11, 2023 •

Copy link
Copy Markdown
Contributor

Description of changes:

This PR adds a new exec mode for compiletest. This mode is useful to execute script-based tests, and allows checking expected output and exit codes at the same time.

Unlike cargo-kani tests, this mode expects a folder with a config.yml file within (not adding one will cause an error). The config.yml file should contain:

  • script: The path to the script to be executed.
  • expected (optional): The path to the .expected file to use for output comparison.
  • exit_code (optional): The exit code to be returned by executing the script (a zero exit code is expected if not specified).

A new test error-code has been added with the purpose of testing the exec mode itself. This PR also migrates the check-output test that used to run at the beginning of our regression. Other scripts can be migrated in subsequent PRs, but I'm not doing it here since it might require some work.

Resolved issues:

Resolves #2059

Call-outs:

  • compiletest actually runs time script, since running script alone didn't seem to be successful. However, many of our existing script-based tests run with time, so I figured that's the best to do there (previously was just running sh script).

Testing:

  • How is this change tested? CI + new tests.

  • 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.

@adpaco
adpaco requested a review from a team as a code owner January 11, 2023 16:11

@zhassan-aws zhassan-aws left a comment

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.

Thanks! I have a few comments. Can we also add this to the documentation?

Comment thread tests/exec-init/check-output/.gitignore Resolved
Comment thread tools/compiletest/src/main.rs Outdated

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.

It is nice to be able to check that newly tests are running, but the inability to add tests under sub-directories could be a bit restrictive.

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, but I wouldn't like to allow tests like these ones (which are quite complex) to be missed. Of course, this can be changed if it becomes too restrictive.

Comment thread tools/compiletest/src/main.rs Resolved
Comment thread tools/compiletest/src/runtest.rs Resolved
Comment thread tools/compiletest/src/runtest.rs Resolved
Comment thread tools/compiletest/src/runtest.rs Resolved
@adpaco

adpaco commented Jan 11, 2023

Copy link
Copy Markdown
Contributor Author

Thanks @zhassan-aws for the review! I'm still working on documentation for this, but feel free to provide more comments in the meantime.

@adpaco
adpaco force-pushed the compiletest-exec-mode branch from 790de42 to 11cacc2 Compare January 11, 2023 21:16
@adpaco

adpaco commented Jan 11, 2023

Copy link
Copy Markdown
Contributor Author

Added some documentation in the "regression testing" section and rebased the PR against main.

Comment thread docs/src/regression-testing.md Resolved
Comment thread docs/src/regression-testing.md Resolved
Comment thread docs/src/regression-testing.md Resolved
Comment thread scripts/kani-regression.sh Resolved
Comment thread tools/compiletest/src/runtest.rs Resolved
Comment thread tools/compiletest/src/runtest.rs Resolved
Comment thread tools/compiletest/src/runtest.rs Resolved
> `exec` mode. The `exec` mode allows us to take advantage of `compiletest`
> features while executing script-based tests (e.g., parallel execution).

### The `exec` mode

@zhassan-aws zhassan-aws Jan 12, 2023 •

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.

Much clearer as a separate section! Thanks!

@adpaco
adpaco merged commit d9a1025 into model-checking:main Jan 12, 2023
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.

Compiletest mode for executing arbitrary commands

2 participants