https://github.com/immunant/c2rust-testsuite
https://github.com/immunant/c2rust-testsuite
c2rust integration-testing test-automation
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/immunant/c2rust-testsuite
- Owner: immunant
- Created: 2019-04-20T00:31:02.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-04-12T02:42:45.000Z (about 4 years ago)
- Last Synced: 2024-12-28T10:33:03.515Z (over 1 year ago)
- Topics: c2rust, integration-testing, test-automation
- Language: Python
- Size: 108 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# C2Rust testsuite
## Prerequisites
- `c2rust` binary in path
- python 3.6 or later.
- `intercept-build` in path. installing:
- `pip3 install -r requirements.txt`
- any other packages and binaries required by the tests themselves
- captured in `**/requirements.yml`
## Command line interface
$ ./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
## Adding new tests as git submodules
$ 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
## Adding test steps
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:
```yaml
transpile:
autogen: true
cargo:
autogen: true
```
Unlike 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`.
# Controlling test steps via environment variables
Use the following optional variables to control test steps:
- `EXTRA_CFLAGS` passes extra flags to the compiler when transpiling
- `EXTRA_TFLAGS` passes extra flags to the transpiler itself
- `TOOLCHAIN` controls which toolchain `cargo build`s the transpiled code (must
start with a + character)
- `C2RUST_DIR` is 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.
# TODOs
- [ ] check requirements on macOS
- allow cargo build and transpile steps w/o scripts
- [ ] warn if `compile_commands.json` is empty
- [ ] add provision.py driven by `**/conf.yml`
- [ ] add option to run `c2rust transpile` under `rust-gdb`