transpile: tests: Run test_translator.py from cargo nextest with the currently built transpiler path#1731
Conversation
…rust-transpile's debug build.
test_translator.py from cargo nextest with the currently built transpiler path
kkysen
left a comment
There was a problem hiding this comment.
Thanks for this! A few other things:
We use cargo nextest run instead of cargo test, so run that locally instead.
Can you update the README and anywhere else that references test_translator.py to say you can also just run cargo nextest run?
I have updated README and other files where |
| *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. |
There was a problem hiding this comment.
| *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. | |
| Most tests are found in the [`tests`](../tests/) folder. | |
| Most tests can also be run with | |
| ```sh | |
| cargo nextest run |
which includes running the tests/unit tests.
The tests/unit tests can also be run manually using
./scripts/test_translator.py tests/unitwhich also allows you to run with other options.
The tests/integration tests
aren't run automatically by cargo nextest run.
To run them, run
# 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)There was a problem hiding this comment.
I have changed the docs/README-developers.md as per the said changes in the latest commit.
Kindly re-review the same. Would really appreciate if this could now be merged into the master branch.
When running the tests,
test_translator.pycould end up using a stalec2rust/c2rust-transpilebinary unlesscargo build --releasehad been run manually beforehand.This change updates the test flow so repo tests use the latest version of
c2rust-transpilebinary built bycargo nextest run, by passing the current transpiler path intotest_translator.pyand overriding the configured transpiler path for that test run.This removes the manual pre-build requirement and makes local test execution less error-prone.
Testing:
cargo nextest runlocallytest_translator.pywas invoked, and it received the expectedc2rust-transpilepathcargo build --release