Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --tool=check #42

Merged
merged 1 commit into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
suite_matrix:
strategy:
matrix:
suite: [style, miri, asan, build]
suite: [style, miri, asan, build, check]
runs-on: ubuntu-latest
name: Test ${{ matrix.suite }}
steps:
Expand Down
13 changes: 9 additions & 4 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,16 @@ function run_build {
timed inapty cargo +$TOOLCHAIN test --no-run --target=$HOST $ARGS
}

function run_check {
inapty cargo +$TOOLCHAIN check --target=$HOST $ARGS
}

function run_asan {
timed cargo +$TOOLCHAIN careful test -Zcareful-sanitizer=address --no-run --target=$HOST $ARGS &> /dev/null
timed inapty cargo +$TOOLCHAIN careful test -Zcareful-sanitizer=address --color=always --no-fail-fast --target=$HOST $ARGS
}

function run_miri {
cargo +$TOOLCHAIN miri setup
timed cargo +$TOOLCHAIN miri test --no-run $ARGS &> /dev/null
# rustdoc is already passed --color=always, so adding it to the global MIRIFLAGS is just an error
MIRIFLAGS="$MIRIFLAGS --color=always" timed inapty cargo +$TOOLCHAIN miri nextest run --color=always --no-fail-fast --config-file=/root/.cargo/nextest.toml $ARGS
Expand All @@ -52,14 +55,16 @@ fi

while read crate;
do
cd /root/build
cd /build
# Delete everything in our writable mount points
find /root/build /tmp /root/.cargo/registry -mindepth 1 -delete
if cargo download $crate /root/build; then
find /build /tmp /root/.cargo/registry -mindepth 1 -delete
if cargo download $crate /build; then
ARGS=$(get-args $crate)
cargo +$TOOLCHAIN update &> /dev/null
if [[ $TOOL == "build" ]]; then
run_build
elif [[ $TOOL == "check" ]]; then
run_check
elif [[ $TOOL == "asan" ]]; then
run_asan
elif [[ $TOOL == "miri" ]]; then
Expand Down
4 changes: 2 additions & 2 deletions src/diagnose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ fn diagnose_output(output: &str) -> Vec<Cause> {
for line in &lines[l..] {
if line.contains("inside `") && line.contains(" at ") {
let path = line.split(" at ").nth(1).unwrap();
if path.contains("/root/build") || !path.starts_with('/') {
if path.starts_with("/build") || !path.starts_with('/') {
break;
} else if path.contains("/root/.cargo/registry/src/") {
} else if path.contains(".cargo/registry/src/") {
let crate_name = path.split('/').nth(6).unwrap();
source_crate = Some(crate_name.to_string());
break;
Expand Down
6 changes: 6 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub enum Tool {
Miri,
Asan,
Build,
Check,
}

impl Tool {
Expand All @@ -52,6 +53,7 @@ impl Tool {
Tool::Miri => "miri/raw",
Tool::Asan => "asan/raw",
Tool::Build => "build/raw",
Tool::Check => "check/raw",
}
}

Expand All @@ -64,6 +66,7 @@ impl Tool {
Tool::Miri => "miri/logs",
Tool::Asan => "asan/logs",
Tool::Build => "build/logs",
Tool::Check => "check/logs",
}
}

Expand All @@ -76,6 +79,7 @@ impl Tool {
Tool::Miri => "miri/index.html",
Tool::Asan => "asan/index.html",
Tool::Build => "build/index.html",
Tool::Check => "check/index.html",
}
}
}
Expand All @@ -86,6 +90,7 @@ impl fmt::Display for Tool {
Tool::Miri => "miri",
Tool::Asan => "asan",
Tool::Build => "build",
Tool::Check => "check",
};
f.write_str(s)
}
Expand All @@ -99,6 +104,7 @@ impl FromStr for Tool {
"miri" => Ok(Self::Miri),
"asan" => Ok(Self::Asan),
"build" => Ok(Self::Build),
"check" => Ok(Self::Check),
_ => Err(format!("Invalid tool {}", s)),
}
}
Expand Down
7 changes: 1 addition & 6 deletions src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,18 +191,13 @@ fn spawn_worker(args: &Args, cpu: usize) -> tokio::process::Child {
// We set up our filesystem as read-only, but with 3 exceptions
"--read-only",
// The directory we are building in (not just its target dir!) is all writable
"--tmpfs=/root/build:exec",
"--tmpfs=/build:exec",
// rustdoc tries to write to and executes files in /tmp, odd move but whatever
"--tmpfs=/tmp:exec",
// The default cargo registry location; we download dependences in the sandbox
"--tmpfs=/root/.cargo/registry:exec",
// cargo-miri builds a sysroot under /root/.cache, so why not make it all writeable
"--tmpfs=/root/.cache:exec",
// AWS credentials for sccache
&format!(
"--volume={}/.aws:/root/.aws:ro",
dirs::home_dir().unwrap().display()
),
&format!("--env=TEST_END_DELIMITER={}", *TEST_END_DELIMITER),
&format!("--env=TOOL={}", args.tool),
]);
Expand Down