Skip to content

Commit 4c83fd4

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 c7437a3 commit 4c83fd4

File tree

17 files changed

+48
-66
lines changed

17 files changed

+48
-66
lines changed

.github/Dockerfile-crux-mir

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ 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+
# Define `CRUX_RUST_LIBRARY_PATH` this for the benefit of
45+
# `crux v2-test crux-mir` below.
46+
ENV CRUX_RUST_LIBRARY_PATH=$(pwd)/rlibs
4347

4448
RUN mkdir -p /crux-mir/rootfs/usr/local/bin
4549
WORKDIR /crux-mir/rootfs/usr/local/bin
@@ -59,8 +63,6 @@ RUN mkdir -p /home/crux-mir/.ghcup && \
5963
ghcup install ghc 9.4.8 && \
6064
ghcup set ghc 9.4.8
6165

62-
WORKDIR ${CRUX_BUILD_DIR}/crux-mir
63-
RUN ./translate_libs.sh
6466
WORKDIR ${CRUX_BUILD_DIR}
6567
RUN cabal v2-update && \
6668
cabal v2-build --only-dependencies crux-mir && \
@@ -82,7 +84,7 @@ RUN apt-get update && \
8284
COPY --from=build /home/crux-mir/.cargo/bin /home/crux-mir/.cargo/bin
8385
COPY --from=build /home/crux-mir/.rustup /home/crux-mir/.rustup
8486
COPY --from=build /crux-mir/rootfs /
85-
COPY --from=build ${CRUX_BUILD_DIR}/crux-mir/rlibs /crux-mir/rlibs
87+
COPY --from=build ${CRUX_BUILD_DIR}/dependencies/mir-json/rlibs /crux-mir/rlibs
8688

8789
RUN useradd -m crux-mir && chown -R crux-mir:crux-mir /crux-mir /home/crux-mir
8890
USER crux-mir

.github/ci.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,6 @@ bundle_crux_mir_files() {
158158
setup_dist
159159
extract_exe crux-mir dist/bin
160160
cp crux-mir/README.md dist/doc
161-
# rlibs is a symlink into rlibs_real; we can't just copy the symlink
162-
# though because (currently at least) it's an absolute path that
163-
# won't work in the output artefact.
164-
#
165-
# Use tar to copy (not cp -r, which isn't very safe) and descend
166-
# into rlibs explicitly first as a cheap way to follow that symlink.
167-
mkdir dist/rlibs
168-
(cd crux-mir/rlibs && tar -cf - .) | (cd dist/rlibs && tar -xvf -)
169161
# It's less fragile to have users install mir-json themselves
170162
# (cd dependencies/mir-json && cargo install --locked --force --root ../../dist)
171163
VERSION=${VERSION:-$DATE}

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,13 @@ jobs:
129129
BUILD_TARGET_OS: ${{ matrix.os }}
130130
BUILD_TARGET_ARCH: ${{ runner.arch }}
131131

132-
- shell: bash
133-
run: cd dependencies/mir-json && cargo install --locked --force
132+
- name: Install mir-json
133+
shell: bash
134+
working-directory: dependencies/mir-json
135+
run: |
136+
cargo install --locked --force
137+
bash ./translate_libs.sh
138+
echo "CRUX_RUST_LIBRARY_PATH=$(pwd)/rlibs" >> $GITHUB_ENV
134139
135140
- shell: bash
136141
run: .github/ci.sh configure
@@ -147,9 +152,6 @@ jobs:
147152
# See Note [--disable-documentation] in `crucible-go-build.yml`.
148153
run: cabal v2-haddock --disable-documentation crucible-syntax crucible-concurrency crux-mir
149154

150-
- shell: bash
151-
run: cd crux-mir && bash ./translate_libs.sh
152-
153155
- shell: bash
154156
run: .github/ci.sh test crux-mir
155157

crux-mir/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# next
22

3-
Nothing yet.
3+
* The modified copies of the Rust standard libraries that `mir-json` depends on
4+
(and `crux-mir` therefore ingests) now live in the `mir-json` repo rather
5+
than in the `crucible` repo. See the [`mir-json`
6+
README](https://github.com/GaloisInc/mir-json/blob/master/README.md) for
7+
details.
48

59
# 0.10 -- 2025-03-21
610

crux-mir/README.md

Lines changed: 11 additions & 29 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

@@ -81,7 +67,7 @@ and asserting properties about them.
8167
Set the `CRUX_RUST_LIBRARY_PATH` environment variable to the path to the
8268
translated libraries:
8369

84-
$ export CRUX_RUST_LIBRARY_PATH=.../crux-mir/rlibs
70+
$ export CRUX_RUST_LIBRARY_PATH=<mir-json checkout>/rlibs
8571

8672
In the directory of a Cargo project (such as the [find-first-set
8773
example](example/ffs)), run the project's symbolic tests:
@@ -120,14 +106,10 @@ To run `crux-mir`'s test suite:
120106

121107
$ cabal v2-test
122108

123-
You need to have built and installed the mir-json tool such that it
124-
can be found on your $PATH.
125-
You also need translated libraries for the Rust target architecture
126-
you're testing on.
127-
Make sure that the `rlibs` symlink exists and points to the right
128-
architecture's libraries.
129-
If not, run the `translate_libs.sh` script as described above under
130-
Installation.
109+
You need to have built and installed the mir-json tool such that it can be
110+
found on your $PATH. You also need translated libraries for the Rust target
111+
architecture you're testing on. See the "Preliminaries" section above for more
112+
details.
131113

132114
### Expected Failures
133115

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

0 commit comments

Comments
 (0)