Skip to content

Commit 5f5a701

Browse files
Add more documentation on the set up process following CI scripts (strata-org#1122)
*Description of changes:* Added comprehensive set up instructions regarding required and optional dependencies (e.g., cvc5, z3, python strata, Java, ion) according to the CI workflow. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. --------- Co-authored-by: David Deng <htd@amazon.com> Co-authored-by: Michael Tautschnig <mt@debian.org>
1 parent 76bca52 commit 5f5a701

1 file changed

Lines changed: 84 additions & 8 deletions

File tree

README.md

Lines changed: 84 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,70 @@ changes!**
1919

2020
## Prerequisites
2121

22-
1. **Lean4**: Strata is built on Lean4; see the build specified in the
22+
1. **Lean4**: Strata is built on Lean4; see the version specified in the
2323
`lean-toolchain` file.
2424

25-
You can install Lean4 by following the instructions [here](https://lean-lang.org/).
25+
Install Lean4 by following the instructions at [lean-lang.org](https://lean-lang.org/).
2626

27-
2. **SMT Solver**: Analysis tools in Strata use SMT solvers for program
28-
verification.
29-
- Install an SMT solver. You can use any solver you want, but the unit
30-
tests assume `cvc5` is on your `PATH` [cvc5](https://cvc5.github.io/).
27+
2. **SMT Solvers**: The verification pipeline and tests require SMT solvers
28+
(`cvc5` and `z3`). See [Installing dependencies → SMT Solvers](#smt-solvers)
29+
below.
30+
31+
3. **Python 3.11+**: required for Python-related tests and the `strata`
32+
Python tooling. See [Installing dependencies → Python](#python) below.
33+
34+
4. **Java JDK (11 or later)**: required for Java code generation tests.
35+
See [Installing dependencies → Java](#java-for-code-generation-tests) below.
36+
37+
5. **ion-java jar (1.11.11)**: required for the Java/Ion integration test.
38+
See [Installing dependencies → Java](#java-for-code-generation-tests) below.
39+
40+
### Installing dependencies
41+
42+
#### SMT Solvers
43+
44+
Download static builds (single binary, no library dependencies) and
45+
place them on your `PATH`:
46+
47+
- cvc5 releases: https://github.com/cvc5/cvc5/releases
48+
- z3 releases: https://github.com/Z3Prover/z3/releases
49+
50+
```bash
51+
# Download the appropriate static build for your platform from the
52+
# release pages above, then copy the binaries somewhere on your PATH:
53+
cp /path/to/cvc5 /path/to/z3 ~/.local/bin/
54+
# or: sudo cp /path/to/cvc5 /path/to/z3 /usr/local/bin/
55+
```
56+
57+
#### Python
58+
59+
Python 3.11 or later is required. Install the `strata` Python package inside a
60+
virtual environment (recommended; avoids PEP 668's `externally-managed-environment`
61+
error on Debian/Ubuntu 23.04+):
62+
63+
```bash
64+
python3 -m venv .venv
65+
source .venv/bin/activate
66+
pip install ./Tools/Python
67+
```
68+
69+
#### Java (for code generation tests)
70+
71+
A JDK (11+) providing `javac` must be on your `PATH`. For running the
72+
Java/Ion integration test, download the ion-java jar:
73+
74+
```bash
75+
wget -q -O StrataTestExtra/DDM/Integration/Java/testdata/ion-java-1.11.11.jar \
76+
https://github.com/amazon-ion/ion-java/releases/download/v1.11.11/ion-java-1.11.11.jar
77+
```
78+
79+
### Verifying your setup
80+
81+
```bash
82+
cvc5 --version # should print version info
83+
z3 --version # should print version info
84+
python3 --version # should be 3.11+
85+
```
3186

3287
## Build
3388

@@ -45,6 +100,26 @@ To build executable files only and omit proof checks that might take a long time
45100
lake build strata:exe strata StrataToCBMC StrataCoreToGoto
46101
```
47102

103+
### Running specific test subsets
104+
105+
Two kinds of tests coexist in this repo:
106+
107+
- **Elaboration-time tests** (`#guard_msgs`) live under `StrataTest/` and run as
108+
part of `lake build`. No output means they passed.
109+
- **Uncached extra tests** live under `StrataTestExtra/` and run via `lake test`.
110+
These accept prefix filters:
111+
112+
```bash
113+
# Run all extra tests except Python (which requires the Python package)
114+
lake test -- --exclude Languages.Python
115+
116+
# Run only Python extra tests (requires `pip install ./Tools/Python`)
117+
lake test -- Languages.Python
118+
119+
# Run all extra tests (Python tests will fail without the Python package above)
120+
lake test
121+
```
122+
48123
## Running Analyses on Existing Strata Programs
49124

50125
Strata programs use the `.st` file extension, preceded by the dialect name,
@@ -80,12 +155,13 @@ modes.
80155

81156
### When running unit tests: "error: no such file or directory (error code: 2)"
82157

83-
This is likely due to `cvc5` or `z3` not being in the PATH environment variable. Add them and try again.
158+
This is likely due to `cvc5` or `z3` not being in the `PATH` environment
159+
variable. See [Installing dependencies → SMT Solvers](#smt-solvers) for
160+
how to install them.
84161

85162
## License
86163

87164
The contents of this repository are licensed under the terms of either
88165
the Apache-2.0 or MIT license, at your choice. See
89166
[LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) for
90167
details of the two licenses.
91-

0 commit comments

Comments
 (0)