Skip to content

Commit dbf2ef7

Browse files
authored
Merge pull request #4803 from RalfJung/check_only
add check_only feature for faster check builds
2 parents f65c581 + 0557c75 commit dbf2ef7

9 files changed

Lines changed: 34 additions & 20 deletions

File tree

src/tools/miri/Cargo.lock

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,22 +123,21 @@ dependencies = [
123123

124124
[[package]]
125125
name = "capstone"
126-
version = "0.13.0"
126+
version = "0.14.0"
127127
source = "registry+https://github.com/rust-lang/crates.io-index"
128-
checksum = "015ef5d5ca1743e3f94af9509ba6bd2886523cfee46e48d15c2ef5216fd4ac9a"
128+
checksum = "f442ae0f2f3f1b923334b4a5386c95c69c1cfa072bafa23d6fae6d9682eb1dd4"
129129
dependencies = [
130130
"capstone-sys",
131-
"libc",
131+
"static_assertions",
132132
]
133133

134134
[[package]]
135135
name = "capstone-sys"
136-
version = "0.17.0"
136+
version = "0.18.0"
137137
source = "registry+https://github.com/rust-lang/crates.io-index"
138-
checksum = "2267cb8d16a1e4197863ec4284ffd1aec26fe7e57c58af46b02590a0235809a0"
138+
checksum = "a4e8087cab6731295f5a2a2bd82989ba4f41d3a428aab2e7c98d8f4db38aac05"
139139
dependencies = [
140140
"cc",
141-
"libc",
142141
]
143142

144143
[[package]]
@@ -1404,6 +1403,12 @@ version = "1.2.1"
14041403
source = "registry+https://github.com/rust-lang/crates.io-index"
14051404
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
14061405

1406+
[[package]]
1407+
name = "static_assertions"
1408+
version = "1.1.0"
1409+
source = "registry+https://github.com/rust-lang/crates.io-index"
1410+
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
1411+
14071412
[[package]]
14081413
name = "strsim"
14091414
version = "0.11.1"

src/tools/miri/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ serde = { version = "1.0.219", features = ["derive"], optional = true }
3939
[target.'cfg(target_os = "linux")'.dependencies]
4040
nix = { version = "0.30.1", features = ["mman", "ptrace", "signal"], optional = true }
4141
ipc-channel = { version = "0.20.0", optional = true }
42-
capstone = { version = "0.13", optional = true }
42+
capstone = { version = "0.14", optional = true }
4343

4444
[target.'cfg(all(target_os = "linux", target_pointer_width = "64", target_endian = "little"))'.dependencies]
4545
genmc-sys = { path = "./genmc-sys/", version = "0.1.0", optional = true }
@@ -68,6 +68,7 @@ expensive-consistency-checks = ["stack-cache"]
6868
tracing = ["serde_json"]
6969
native-lib = ["dep:libffi", "dep:libloading", "dep:capstone", "dep:ipc-channel", "dep:nix", "dep:serde"]
7070
jemalloc = []
71+
check_only = ["libffi?/check_only", "capstone?/check_only", "genmc-sys?/check_only"]
7172

7273
[lints.rust.unexpected_cfgs]
7374
level = "warn"

src/tools/miri/ci/ci.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ export CARGO_INCREMENTAL=0
3030
export CARGO_EXTRA_FLAGS="--locked"
3131

3232
# Determine configuration for installed build (used by test-cargo-miri and `./miri bench`).
33+
# We use the default set of features for this.
3334
echo "Installing release version of Miri"
3435
time ./miri install
3536

3637
# Prepare debug build for direct `./miri` invocations.
37-
# We enable all features to make sure the Stacked Borrows consistency check runs.
38+
# Here we enable some more features and checks.
3839
echo "Building debug version of Miri"
39-
export CARGO_EXTRA_FLAGS="$CARGO_EXTRA_FLAGS --all-features"
40-
time ./miri build # the build that all the `./miri test` below will use
40+
export FEATURES="--features=expensive-consistency-checks,genmc"
41+
time ./miri build $FEATURES # the build that all the `./miri test` below will use
4142

4243
endgroup
4344

@@ -63,7 +64,7 @@ function run_tests {
6364
if [ -n "${GC_STRESS-}" ]; then
6465
time MIRIFLAGS="${MIRIFLAGS-} -Zmiri-provenance-gc=1" ./miri test $TARGET_FLAG
6566
else
66-
time ./miri test $TARGET_FLAG
67+
time ./miri test $FEATURES $TARGET_FLAG
6768
fi
6869

6970
## advanced tests
@@ -74,20 +75,20 @@ function run_tests {
7475
# them. Also error locations change so we don't run the failing tests.
7576
# We explicitly enable debug-assertions here, they are disabled by -O but we have tests
7677
# which exist to check that we panic on debug assertion failures.
77-
time MIRIFLAGS="${MIRIFLAGS-} -O -Zmir-opt-level=4 -Cdebug-assertions=yes" MIRI_SKIP_UI_CHECKS=1 ./miri test $TARGET_FLAG tests/{pass,panic}
78+
time MIRIFLAGS="${MIRIFLAGS-} -O -Zmir-opt-level=4 -Cdebug-assertions=yes" MIRI_SKIP_UI_CHECKS=1 ./miri test $FEATURES $TARGET_FLAG tests/{pass,panic}
7879
fi
7980
if [ -n "${MANY_SEEDS-}" ]; then
8081
# Run many-seeds tests. (Also tests `./miri run`.)
8182
time for FILE in tests/many-seeds/*.rs; do
82-
./miri run "-Zmiri-many-seeds=0..$MANY_SEEDS" $TARGET_FLAG "$FILE"
83+
./miri run $FEATURES "-Zmiri-many-seeds=0..$MANY_SEEDS" $TARGET_FLAG "$FILE"
8384
done
85+
# Smoke-test `./miri run --dep`.
86+
./miri run $FEATURES $TARGET_FLAG --dep tests/pass-dep/getrandom.rs
8487
fi
8588
if [ -n "${TEST_BENCH-}" ]; then
8689
# Check that the benchmarks build and run, but only once.
8790
time HYPERFINE="hyperfine -w0 -r1 --show-output" ./miri bench $TARGET_FLAG --no-install
8891
fi
89-
# Smoke-test `./miri run --dep`.
90-
./miri run $TARGET_FLAG --dep tests/pass-dep/getrandom.rs
9192

9293
## test-cargo-miri
9394
# On Windows, there is always "python", not "python3" or "python2".

src/tools/miri/etc/rust_analyzer_helix.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ invocationStrategy = "once"
2727
overrideCommand = [
2828
"./miri",
2929
"check",
30-
"--no-default-features",
3130
"-Zunstable-options",
3231
"--compile-time-deps",
3332
"--message-format=json",

src/tools/miri/etc/rust_analyzer_vscode.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"rust-analyzer.cargo.buildScripts.overrideCommand": [
2222
"./miri",
2323
"check",
24-
"--no-default-features",
2524
"-Zunstable-options",
2625
"--compile-time-deps",
2726
"--message-format=json",

src/tools/miri/etc/rust_analyzer_zed.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"overrideCommand": [
3131
"./miri",
3232
"check",
33-
"--no-default-features",
3433
"-Zunstable-options",
3534
"--compile-time-deps",
3635
"--message-format=json"

src/tools/miri/genmc-sys/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ cc = "1.2.16"
1313
cmake = "0.1.54"
1414
git2 = { version = "0.20.2", default-features = false, features = ["https"] }
1515
cxx-build = { version = "1.0.173", features = ["parallel"] }
16+
17+
[features]
18+
check_only = []

src/tools/miri/genmc-sys/build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,11 @@ fn compile_cpp_dependencies(genmc_path: &Path, always_configure: bool) {
202202
}
203203

204204
fn main() {
205+
// For check-only builds, we don't need to do anything.
206+
if cfg!(feature = "check_only") {
207+
return;
208+
}
209+
205210
// Select which path to use for the GenMC repo:
206211
let (genmc_path, always_configure) = if let Some(genmc_src_path) = option_env!("GENMC_SRC_PATH")
207212
{

src/tools/miri/miri-script/src/commands.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,8 @@ impl Command {
391391
Ok(())
392392
}
393393

394-
fn check(features: Vec<String>, flags: Vec<String>) -> Result<()> {
394+
fn check(mut features: Vec<String>, flags: Vec<String>) -> Result<()> {
395+
features.push("check_only".into());
395396
let e = MiriEnv::new()?;
396397
e.check(".", &features, &flags)?;
397398
e.check("cargo-miri", &[], &flags)?;
@@ -405,7 +406,8 @@ impl Command {
405406
Ok(())
406407
}
407408

408-
fn clippy(features: Vec<String>, flags: Vec<String>) -> Result<()> {
409+
fn clippy(mut features: Vec<String>, flags: Vec<String>) -> Result<()> {
410+
features.push("check_only".into());
409411
let e = MiriEnv::new()?;
410412
e.clippy(".", &features, &flags)?;
411413
e.clippy("cargo-miri", &[], &flags)?;

0 commit comments

Comments
 (0)