- the following binaries in path
uv: https://docs.astral.sh/uv/getting-started/installation/c2rust: https://github.com/immunant/c2rust?tab=readme-ov-file#installationintercept-build:pip3 install -r requirements.txt
- any other packages and binaries required by the tests themselves
- captured in
**/requirements.yml
- captured in
$ ./test.py # test everything
$ ./test.py --verbose # show test output
$ ./test.py lua # run specific project
$ ./test.py lua --stage transpile # run specific stage of project
$ cd path/to/tests/$PROJ
$ git submodule add --depth 10 $PROJ_URL repo
To track a specific branch ($SUBMOD_NAME can be found in .gitmodules):
$ git config -f .gitmodules submodule.$SUBMOD_NAME.branch $BRANCH_NAME
$ git submodule update --remote repo
Each test stage can be controlled with a script (in tests/$PROJ) named as follows:
- autogen stage ->
autogen.sh - configure stage ->
configure.sh - make stage ->
make.sh|cmake.sh - transpile stage ->
transpile.sh|transpile.gen.sh|cmake.sh - cargo build stage ->
cargo.sh|cargo.gen.sh - test stage ->
check.sh|test.sh
note the .gen.sh suffix are used to mark scripts generated automatically. Generation is requested via conf.yml like this:
transpile:
autogen: true
cargo:
autogen: trueUnlike hand-written scripts, autogenerated ones are not version controlled.
Each script is expected to tee its output to a file named $SCRIPT.log. For example, make.sh produces make.sh.log.
Use the following optional variables to control test steps:
EXTRA_CFLAGSpasses extra flags to the compiler when transpilingEXTRA_TFLAGSpasses extra flags to the transpiler itselfTOOLCHAINcontrols which toolchaincargo builds the transpiled code (must start with a + character)C2RUST_DIRis the path to a local checkout of the c2rust sources. Runtime support crates from this checkout will be used instead of pulling them from crates.io.
- check requirements on macOS
- allow cargo build and transpile steps w/o scripts
- warn if
compile_commands.jsonis empty - add provision.py driven by
**/conf.yml - add option to run
c2rust transpileunderrust-gdb