Skip to content

Commit ae7ad66

Browse files
committed
crux-mir: Adjust documentation, CI, and test suite in light of standard library migration
Now that the `mir-json`-specific versions of the Rust standard libraries have been moved to the `mir-json` repo (in GaloisInc/mir-json#85), this patch adjusts the various references to the standard libraries to ensure that `crux-mir`'s documentation, CI, and test suite remain up to date. Towards #1252
1 parent 83071d8 commit ae7ad66

File tree

15 files changed

+36
-48
lines changed

15 files changed

+36
-48
lines changed

.github/Dockerfile-crux-mir

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ ENV LANG=C.UTF-8 \
3939
WORKDIR ${CRUX_BUILD_DIR}/dependencies/mir-json
4040
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --profile minimal --default-toolchain ${RUST_TOOLCHAIN}
4141
RUN rustup component add --toolchain ${RUST_TOOLCHAIN} rustc-dev
42-
RUN cargo install --locked
42+
RUN cargo install --locked && \
43+
./translate_libs.sh
44+
ENV CRUX_RUST_LIBRARY_PATH=$(pwd)/rlibs
4345

4446
RUN mkdir -p /crux-mir/rootfs/usr/local/bin
4547
WORKDIR /crux-mir/rootfs/usr/local/bin
@@ -59,8 +61,6 @@ RUN mkdir -p /home/crux-mir/.ghcup && \
5961
ghcup install ghc 9.4.8 && \
6062
ghcup set ghc 9.4.8
6163

62-
WORKDIR ${CRUX_BUILD_DIR}/crux-mir
63-
RUN ./translate_libs.sh
6464
WORKDIR ${CRUX_BUILD_DIR}
6565
RUN cabal v2-update && \
6666
cabal v2-build --only-dependencies crux-mir && \
@@ -82,7 +82,7 @@ RUN apt-get update && \
8282
COPY --from=build /home/crux-mir/.cargo/bin /home/crux-mir/.cargo/bin
8383
COPY --from=build /home/crux-mir/.rustup /home/crux-mir/.rustup
8484
COPY --from=build /crux-mir/rootfs /
85-
COPY --from=build ${CRUX_BUILD_DIR}/crux-mir/rlibs /crux-mir/rlibs
85+
COPY --from=build ${CRUX_BUILD_DIR}/dependencies/mir-json/rlibs /crux-mir/rlibs
8686

8787
RUN useradd -m crux-mir && chown -R crux-mir:crux-mir /crux-mir /home/crux-mir
8888
USER crux-mir

.github/workflows/crux-mir-build.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,13 @@ jobs:
168168
with_ghc() { $NS -c ${@}; }
169169
(cd crux-mir; with_ghc ghc -o $(setup_bin) $(setup_src) && ./$(setup_bin) clean)
170170
171-
- shell: bash
172-
run: cd dependencies/mir-json && cargo install --locked --force
171+
- name: Install mir-json
172+
shell: bash
173+
working-directory: dependencies/mir-json
174+
run: |
175+
cargo install --locked --force
176+
bash ./translate_libs.sh
177+
echo "CRUX_RUST_LIBRARY_PATH=$(pwd)/rlibs" >> $GITHUB_ENV
173178
174179
- shell: bash
175180
run: .github/ci.sh configure
@@ -185,9 +190,6 @@ jobs:
185190
name: Haddock
186191
run: cabal v2-haddock crucible-syntax crucible-concurrency crux-mir
187192

188-
- shell: bash
189-
run: cd crux-mir && bash ./translate_libs.sh
190-
191193
- shell: bash
192194
run: .github/ci.sh test crux-mir
193195

crux-mir/README.md

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ functionality.
1515

1616
$ git submodule update --init
1717

18-
Next, navigate to the `crucible/dependencies/mir-json` directory and install
19-
`mir-json` according to the instructions in [the `mir-json`
20-
README][mir-json-readme].
18+
Next, navigate to the `crucible/dependencies/mir-json` directory. Install
19+
`mir-json`, translate its standard libraries, and define the
20+
`CRUX_RUST_LIBRARY_PATH` environment variable according to the instructions in
21+
[the `mir-json` README][mir-json-readme].
2122

2223
Currently, `crux-mir` supports [version
2324
1](https://github.com/GaloisInc/mir-json/blob/master/SCHEMA_CHANGELOG.md#1) of
@@ -44,21 +45,6 @@ Use GHC 9.4, 9.6, or 9.8. From the `crux-mir` directory, run:
4445

4546
$ cabal v2-install exe:crux-mir --overwrite-policy=always
4647

47-
Then translate the Rust libraries in `lib/`:
48-
49-
$ ./translate_libs.sh
50-
51-
If you want to cross-compile for a different target, you can optionally set the
52-
environment variable `TARGET` to a [target
53-
triple](https://doc.rust-lang.org/nightly/rustc/platform-support.html) when
54-
running `./translate_libs.sh`. This is experimental and we have only tested
55-
`wasm32-unknown-unknown` to work; you might get build errors for other targets.
56-
57-
$ TARGET=wasm32-unknown-unknown ./translate_libs.sh
58-
59-
When upgrading from a previous version, first install the new `mir-json`
60-
version, then rerun the `cabal v2-install` and `./translate_libs.sh` commands.
61-
6248

6349
## Usage
6450

@@ -71,8 +57,8 @@ compiled by checking for the `crux` configuration predicate using
7157
`#[cfg_attr(crux, crux::test)]`.
7258

7359
Test cases can create and manipulate symbolic values using the functions in the
74-
[`crucible`](lib/crucible) Rust crate. See
75-
[`example/ffs/lib.rs`](example/ffs/lib.rs) or the files in
60+
[`crucible`](https://github.com/GaloisInc/mir-json/tree/master/libs/crucible)
61+
Rust crate. See [`example/ffs/lib.rs`](example/ffs/lib.rs) or the files in
7662
[`test/symb_eval/`](test/symb_eval) for examples of creating symbolic values
7763
and asserting properties about them.
7864

crux-mir/test/symb_eval/concretize/assert.good

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ failures:
44

55
---- assert/<DISAMB>::crux_test[0] counterexamples ----
66
[Crux] Found counterexample for verification goal
7-
[Crux] ./lib/crucible/lib.rs:48:17: 48:82 !test/symb_eval/concretize/assert.rs:10:5: 10:81: error: in assert/<DISAMB>::crux_test[0]
7+
[Crux] ./libs/crucible/lib.rs:48:17: 48:82 !test/symb_eval/concretize/assert.rs:10:5: 10:81: error: in assert/<DISAMB>::crux_test[0]
88
[Crux] MIR assertion at test/symb_eval/concretize/assert.rs:10:5:
99
[Crux] 100 + 157 == 1
1010

crux-mir/test/symb_eval/crux/early_fail.good

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ failures:
1010

1111
---- early_fail/<DISAMB>::fail2[0] counterexamples ----
1212
[Crux] Found counterexample for verification goal
13-
[Crux] ./lib/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crux/early_fail.rs:17:5: 17:29: error: in early_fail/<DISAMB>::fail2[0]
13+
[Crux] ./libs/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crux/early_fail.rs:17:5: 17:29: error: in early_fail/<DISAMB>::fail2[0]
1414
[Crux] MIR assertion at test/symb_eval/crux/early_fail.rs:17:5:
1515
[Crux] x == 0
1616

crux-mir/test/symb_eval/crux/fail_return.good

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ failures:
88
[Crux] test/symb_eval/crux/fail_return.rs:8:22: 8:27: error: in fail_return/<DISAMB>::fail1[0]
99
[Crux] attempt to compute `move _4 + const 1_u8`, which would overflow
1010
[Crux] Found counterexample for verification goal
11-
[Crux] ./lib/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crux/fail_return.rs:8:5: 8:32: error: in fail_return/<DISAMB>::fail1[0]
11+
[Crux] ./libs/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crux/fail_return.rs:8:5: 8:32: error: in fail_return/<DISAMB>::fail1[0]
1212
[Crux] MIR assertion at test/symb_eval/crux/fail_return.rs:8:5:
1313
[Crux] x + 1 > x
1414

@@ -17,7 +17,7 @@ failures:
1717
[Crux] test/symb_eval/crux/fail_return.rs:15:22: 15:27: error: in fail_return/<DISAMB>::fail2[0]
1818
[Crux] attempt to compute `move _5 + const 1_u8`, which would overflow
1919
[Crux] Found counterexample for verification goal
20-
[Crux] ./lib/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crux/fail_return.rs:15:5: 15:32: error: in fail_return/<DISAMB>::fail2[0]
20+
[Crux] ./libs/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crux/fail_return.rs:15:5: 15:32: error: in fail_return/<DISAMB>::fail2[0]
2121
[Crux] MIR assertion at test/symb_eval/crux/fail_return.rs:15:5:
2222
[Crux] x + 1 > x
2323

crux-mir/test/symb_eval/crux/mixed_fail.good

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ failures:
1010
[Crux] test/symb_eval/crux/mixed_fail.rs:8:22: 8:27: error: in mixed_fail/<DISAMB>::fail1[0]
1111
[Crux] attempt to compute `move _5 + const 1_u8`, which would overflow
1212
[Crux] Found counterexample for verification goal
13-
[Crux] ./lib/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crux/mixed_fail.rs:8:5: 8:32: error: in mixed_fail/<DISAMB>::fail1[0]
13+
[Crux] ./libs/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crux/mixed_fail.rs:8:5: 8:32: error: in mixed_fail/<DISAMB>::fail1[0]
1414
[Crux] MIR assertion at test/symb_eval/crux/mixed_fail.rs:8:5:
1515
[Crux] x + 1 > x
1616

@@ -19,7 +19,7 @@ failures:
1919
[Crux] test/symb_eval/crux/mixed_fail.rs:14:22: 14:27: error: in mixed_fail/<DISAMB>::fail2[0]
2020
[Crux] attempt to compute `move _5 + const 2_u8`, which would overflow
2121
[Crux] Found counterexample for verification goal
22-
[Crux] ./lib/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crux/mixed_fail.rs:14:5: 14:32: error: in mixed_fail/<DISAMB>::fail2[0]
22+
[Crux] ./libs/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crux/mixed_fail.rs:14:5: 14:32: error: in mixed_fail/<DISAMB>::fail2[0]
2323
[Crux] MIR assertion at test/symb_eval/crux/mixed_fail.rs:14:5:
2424
[Crux] x + 2 > x
2525

crux-mir/test/symb_eval/crux/multi.good

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ failures:
99
[Crux] test/symb_eval/crux/multi.rs:8:22: 8:27: error: in multi/<DISAMB>::fail1[0]
1010
[Crux] attempt to compute `move _5 + const 1_u8`, which would overflow
1111
[Crux] Found counterexample for verification goal
12-
[Crux] ./lib/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crux/multi.rs:8:5: 8:32: error: in multi/<DISAMB>::fail1[0]
12+
[Crux] ./libs/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crux/multi.rs:8:5: 8:32: error: in multi/<DISAMB>::fail1[0]
1313
[Crux] MIR assertion at test/symb_eval/crux/multi.rs:8:5:
1414
[Crux] x + 1 > x
1515

@@ -20,7 +20,7 @@ failures:
2020

2121
---- multi/<DISAMB>::fail3[0] counterexamples ----
2222
[Crux] Found counterexample for verification goal
23-
[Crux] ./lib/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crux/multi.rs:20:5: 20:29: error: in multi/<DISAMB>::assert_zero[0]
23+
[Crux] ./libs/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crux/multi.rs:20:5: 20:29: error: in multi/<DISAMB>::assert_zero[0]
2424
[Crux] MIR assertion at test/symb_eval/crux/multi.rs:20:5:
2525
[Crux] x == 0
2626

crux-mir/test/symb_eval/crypto/bytes.good

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ failures:
44

55
---- bytes/<DISAMB>::f[0] counterexamples ----
66
[Crux] Found counterexample for verification goal
7-
[Crux] ./lib/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crypto/bytes.rs:85:7: 85:37: error: in bytes/<DISAMB>::f[0]
7+
[Crux] ./libs/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crypto/bytes.rs:85:7: 85:37: error: in bytes/<DISAMB>::f[0]
88
[Crux] MIR assertion at test/symb_eval/crypto/bytes.rs:85:7:
99
[Crux] a[i] == b[i]
1010
[Crux] Found counterexample for verification goal
11-
[Crux] ./lib/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crypto/bytes.rs:85:7: 85:37: error: in bytes/<DISAMB>::f[0]
11+
[Crux] ./libs/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crypto/bytes.rs:85:7: 85:37: error: in bytes/<DISAMB>::f[0]
1212
[Crux] MIR assertion at test/symb_eval/crypto/bytes.rs:85:7:
1313
[Crux] a[i] == b[i]
1414
[Crux] Found counterexample for verification goal
15-
[Crux] ./lib/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crypto/bytes.rs:85:7: 85:37: error: in bytes/<DISAMB>::f[0]
15+
[Crux] ./libs/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crypto/bytes.rs:85:7: 85:37: error: in bytes/<DISAMB>::f[0]
1616
[Crux] MIR assertion at test/symb_eval/crypto/bytes.rs:85:7:
1717
[Crux] a[i] == b[i]
1818
[Crux] Found counterexample for verification goal
19-
[Crux] ./lib/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crypto/bytes.rs:85:7: 85:37: error: in bytes/<DISAMB>::f[0]
19+
[Crux] ./libs/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crypto/bytes.rs:85:7: 85:37: error: in bytes/<DISAMB>::f[0]
2020
[Crux] MIR assertion at test/symb_eval/crypto/bytes.rs:85:7:
2121
[Crux] a[i] == b[i]
2222
[Crux] Found counterexample for verification goal
23-
[Crux] ./lib/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crypto/bytes.rs:85:7: 85:37: error: in bytes/<DISAMB>::f[0]
23+
[Crux] ./libs/crucible/lib.rs:38:41: 38:58 !test/symb_eval/crypto/bytes.rs:85:7: 85:37: error: in bytes/<DISAMB>::f[0]
2424
[Crux] MIR assertion at test/symb_eval/crypto/bytes.rs:85:7:
2525
[Crux] a[i] == b[i]
2626

crux-mir/test/symb_eval/overrides/bad_symb1.good

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ failures:
44

55
---- bad_symb1/<DISAMB>::crux_test[0] counterexamples ----
66
[Crux] Found counterexample for verification goal
7-
[Crux] lib/crucible/symbolic.rs:24:64: 24:68 !lib/crucible/symbolic.rs:30:1: 36:2: error: in crucible/<DISAMB>::symbolic[0]::{impl#1}[0]::symbolic[0]
7+
[Crux] libs/crucible/symbolic.rs:24:64: 24:68 !libs/crucible/symbolic.rs:30:1: 36:2: error: in crucible/<DISAMB>::symbolic[0]::{impl#1}[0]::symbolic[0]
88
[Crux] symbolic variable name must be a concrete string
99

1010
[Crux] Overall status: Invalid.

0 commit comments

Comments
 (0)