-
Notifications
You must be signed in to change notification settings - Fork 305
transpile: tests: Run test_translator.py from cargo nextest with the currently built transpiler path
#1731
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
base: master
Are you sure you want to change the base?
transpile: tests: Run test_translator.py from cargo nextest with the currently built transpiler path
#1731
Changes from 6 commits
a7542ec
99d6bab
6db274d
55ccd9d
49b4237
92c3e84
7cce002
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| use std::process::Command; | ||
|
|
||
| #[test] | ||
| fn test_translator() { | ||
| let transpile_path = env!("CARGO_BIN_EXE_c2rust-transpile"); | ||
|
|
||
| let mut cmd = Command::new("../scripts/test_translator.py"); | ||
| cmd.args(["../tests/unit", "--transpiler", transpile_path]); | ||
|
|
||
| // `test_translator.py` needs to be able to re-select the toolchain for different editions. | ||
| cmd.env_remove("RUSTUP_TOOLCHAIN"); | ||
|
|
||
| let status = cmd | ||
| .status() | ||
| .unwrap_or_else(|e| panic!("{cmd:?} failed: {e}")); | ||
|
|
||
| assert!(status.success(), "{cmd:?} failed with {status}"); | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -89,6 +89,8 @@ More details about tests can be found in the [tests folder](../tests/). | |||||||||||||||
| *Note*: These run integration tests that invoke `c2rust transpile`. | ||||||||||||||||
| `cargo test` only runs unit tests and doc tests as of now. | ||||||||||||||||
|
|
||||||||||||||||
| *Note*: The tests executed by `test_translator.py` can also be invoked simply by running `cargo nextest run` in the main c2rust workspace. `cargo nextest run` even ensures that the repo tests use the latest version of `c2rust-transpile` binary. | ||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
which includes running the ./scripts/test_translator.py tests/unitwhich also allows you to run with other options. The # Needs to be run from `tests/integration/` (or further inside)
# to correctly load the `pyproject.toml`.
cargo build --release
(export PATH=$PWD/target/release:$PATH && export C2RUST_DIR=$PWD && cd tests/integration && ./test.py curl json-c lua nginx zstd li
bxml2 python2 libmcs)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have changed the Kindly re-review the same. Would really appreciate if this could now be merged into the master branch. |
||||||||||||||||
|
|
||||||||||||||||
| ## Documentation | ||||||||||||||||
|
|
||||||||||||||||
| Local documentation can be built with the normal `cargo doc` and `cargo doc --open`. | ||||||||||||||||
|
|
||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.