Ensure your system has all requirements installed before proceeding with the steps below.
First initialize and update submodules:
git submodule update --initTo build the Docker container:
make docker-buildTo generate specs with an LLM, you first need to put your API key in a .env file.
echo "LLM_API_KEY=<your key here>" > models/.envThen run the Python script
make run
# Inside the container:
./main.py --input-path data/qsort.cFor a more complex example, we include the Zopfli compression library as a submodule in our data directory. It consists of over 3000 lines of C code across multiple files.
To run specification generation on a project with multiple files, one first needs to generate a JSON compilation database. If your project uses make, a simple way to generate a compilation database is to use bear. Again from inside the container, run:
# To generate a compile_commands.json compilation database
cd /app/data/zopfli && make clean && bear -- makeVerify that compile_commands.json now exists at /app/data/zopfli. Now generate specifications:
cd /app
./main.py --input-path data/zopfliTODO
Using any off-the-shelf translator.
Kani is installed in the Docker container. Here is an example of how to run it.
make run
# Inside the container:
cd data/rust_qsort
cargo kani -Z function-contractsThe Kani specifications in data/rust_qsort/main.rs are incomplete and currently do not compile. This needs work.
Run unit tests:
make unit-testRun integration tests (i.e., test the system end-to-end with stubbed-out LLM calls):
make integration-testAdd the following to your .vscode/launch.json configuration,
or check that it already exists:
{
"name": "Python: Attach to Docker",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/app"
}
],
"justMyCode": true
}To debug a specification generation run (e.g., for data/qsort.c),
first run the following command:
% bash run.sh python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:5678 --wait-for-client ./main.py data/qsort.cThis effectively starts the container, port-forwards it to 5678, and suspends execution until the debugger is attached.
Once you have executed the command above, select "Python: Attach to Docker" from the "Run and Debug" sidebar.
My local runs of
make checksare inconsistent with those on CI, what's going on?
This is usually due to inconsistencies between your local development dependencies, and those on GitHub CI. Run the following command (periodically, if the issue persists) to update your local dependencies:
% make plume-scripts-update