Skip to content

Commit 5e7095c

Browse files
authored
Integrate latest s2n-quic proofs in Kani CI (rust-lang#1862)
1 parent 328e49c commit 5e7095c

File tree

7 files changed

+16
-46
lines changed

7 files changed

+16
-46
lines changed

scripts/kani-perf.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ for overlay_dir in ${PERF_DIR}/overlays/*/; do
2525
done
2626

2727
suite="perf"
28-
mode="cargo-kani"
28+
mode="cargo-kani-test"
2929
echo "Check compiletest suite=$suite mode=$mode"
3030
cargo run -p compiletest -- --suite $suite --mode $mode
3131
exit_code=$?
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
successfully verified harnesses, 0 failures

tests/perf/overlays/s2n-quic/quic/s2n-quic-core/vectored_copy_fuzz_test.expected

Lines changed: 0 additions & 22 deletions
This file was deleted.

tests/perf/s2n-quic

Submodule s2n-quic updated 484 files

tools/compiletest/src/common.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub enum Mode {
1818
Kani,
1919
KaniFixme,
2020
CargoKani,
21+
CargoKaniTest, // `cargo kani --tests`. This is temporary and should be removed when s2n-quic moves --tests to `Cargo.toml`.
2122
Expected,
2223
Stub,
2324
}
@@ -29,6 +30,7 @@ impl FromStr for Mode {
2930
"kani" => Ok(Kani),
3031
"kani-fixme" => Ok(KaniFixme),
3132
"cargo-kani" => Ok(CargoKani),
33+
"cargo-kani-test" => Ok(CargoKaniTest),
3234
"expected" => Ok(Expected),
3335
"stub-tests" => Ok(Stub),
3436
_ => Err(()),
@@ -42,6 +44,7 @@ impl fmt::Display for Mode {
4244
Kani => "kani",
4345
KaniFixme => "kani-fixme",
4446
CargoKani => "cargo-kani",
47+
CargoKaniTest => "cargo-kani-test",
4548
Expected => "expected",
4649
Stub => "stub-tests",
4750
};
@@ -131,11 +134,6 @@ pub struct Config {
131134

132135
/// Whether we will run the tests or not.
133136
pub dry_run: bool,
134-
135-
/// Allow us to run the regression with the mir linker enabled by default. For that, set
136-
/// `RUSTFLAGS=--cfg=mir_linker` while compiling `compiletest`.
137-
/// Remove this as part of <https://github.com/model-checking/kani/issues/1677>
138-
pub mir_linker: bool,
139137
}
140138

141139
#[derive(Debug, Clone)]

tools/compiletest/src/main.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ pub fn parse_config(args: Vec<String>) -> Config {
157157
color,
158158
edition: matches.opt_str("edition"),
159159
force_rerun: matches.opt_present("force-rerun"),
160-
mir_linker: cfg!(mir_linker),
161160
dry_run: matches.opt_present("dry-run"),
162161
timeout,
163162
}
@@ -176,7 +175,6 @@ pub fn log_config(config: &Config) {
176175
logv(c, format!("host: {}", config.host));
177176
logv(c, format!("verbose: {}", config.verbose));
178177
logv(c, format!("quiet: {}", config.quiet));
179-
logv(c, format!("mir_linker: {}", config.mir_linker));
180178
logv(c, format!("timeout: {:?}", config.timeout));
181179
logv(
182180
c,
@@ -329,7 +327,7 @@ fn collect_tests_from_dir(
329327
tests: &mut Vec<test::TestDescAndFn>,
330328
) -> io::Result<()> {
331329
match config.mode {
332-
Mode::CargoKani => {
330+
Mode::CargoKani | Mode::CargoKaniTest => {
333331
collect_expected_tests_from_dir(config, dir, relative_dir_path, inputs, tests)
334332
}
335333
_ => collect_rs_tests_from_dir(config, dir, relative_dir_path, inputs, tests),
@@ -357,7 +355,7 @@ fn collect_expected_tests_from_dir(
357355
// output directory corresponding to each to avoid race conditions during
358356
// the testing phase. We immediately return after adding the tests to avoid
359357
// treating `*.rs` files as tests.
360-
assert_eq!(config.mode, Mode::CargoKani);
358+
assert!(config.mode == Mode::CargoKani || config.mode == Mode::CargoKaniTest);
361359

362360
let has_cargo_toml = dir.join("Cargo.toml").exists();
363361
for file in fs::read_dir(dir)? {

tools/compiletest/src/runtest.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
use crate::common::KaniFailStep;
99
use crate::common::{output_base_dir, output_base_name};
10-
use crate::common::{CargoKani, Expected, Kani, KaniFixme, Stub};
10+
use crate::common::{CargoKani, CargoKaniTest, Expected, Kani, KaniFixme, Stub};
1111
use crate::common::{Config, TestPaths};
1212
use crate::header::TestProps;
1313
use crate::json;
@@ -63,7 +63,8 @@ impl<'test> TestCx<'test> {
6363
match self.config.mode {
6464
Kani => self.run_kani_test(),
6565
KaniFixme => self.run_kani_test(),
66-
CargoKani => self.run_cargo_kani_test(),
66+
CargoKani => self.run_cargo_kani_test(false),
67+
CargoKaniTest => self.run_cargo_kani_test(true),
6768
Expected => self.run_expected_test(),
6869
Stub => self.run_stub_test(),
6970
}
@@ -291,9 +292,10 @@ impl<'test> TestCx<'test> {
291292
}
292293

293294
/// Runs cargo-kani on the function specified by the stem of `self.testpaths.file`.
295+
/// The `test` parameter controls whether to specify `--tests` to `cargo kani`.
294296
/// An error message is printed to stdout if verification output does not
295297
/// contain the expected output in `self.testpaths.file`.
296-
fn run_cargo_kani_test(&self) {
298+
fn run_cargo_kani_test(&self, test: bool) {
297299
// We create our own command for the same reasons listed in `run_kani_test` method.
298300
let mut cargo = Command::new("cargo");
299301
// We run `cargo` on the directory where we found the `*.expected` file
@@ -305,15 +307,13 @@ impl<'test> TestCx<'test> {
305307
.arg("--target-dir")
306308
.arg(self.output_base_dir().join("target"))
307309
.current_dir(&parent_dir);
310+
if test {
311+
cargo.arg("--tests");
312+
}
308313
if "expected" != self.testpaths.file.file_name().unwrap() {
309314
cargo.args(["--harness", function_name]);
310315
}
311316

312-
if self.config.mir_linker {
313-
// Allow us to run the regression with the mir linker enabled by default.
314-
cargo.arg("--enable-unstable").arg("--mir-linker");
315-
}
316-
317317
let proc_res = self.compose_and_run(cargo);
318318
let expected = fs::read_to_string(self.testpaths.file.clone()).unwrap();
319319
self.verify_output(&proc_res, &expected);
@@ -334,11 +334,6 @@ impl<'test> TestCx<'test> {
334334
kani.env("RUSTFLAGS", self.props.compile_flags.join(" "));
335335
}
336336

337-
if self.config.mir_linker {
338-
// Allow us to run the regression with the mir linker enabled by default.
339-
kani.arg("--enable-unstable").arg("--mir-linker");
340-
}
341-
342337
// Pass the test path along with Kani and CBMC flags parsed from comments at the top of the test file.
343338
kani.arg(&self.testpaths.file).args(&self.props.kani_flags);
344339

0 commit comments

Comments
 (0)