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

fix: rust coverage test meets compile error for missing debuginfo #1740

Merged
merged 9 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
29 changes: 29 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -609,3 +609,32 @@ jobs:
${SCCACHE_PATH} --show-stats

${SCCACHE_PATH} --show-stats | grep -e "Cache hits\s*[1-9]"

issues-1652:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please rename the test for something more explicit?

Copy link
Contributor Author

@yihau yihau Apr 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you have any prefer name? is missing-debug-info a good name?

runs-on: ubuntu-latest
needs: build

strategy:
fail-fast: false
matrix:
version: [nightly-2023-02-08, nightly-2023-02-09]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to hard-coded the date?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found it's broken since the version nightly-2023-02-09 so I choose those two version to test.

steps:
- uses: actions/download-artifact@v3
with:
name: integration-tests
path: /home/runner/.cargo/bin/
- name: Chmod for binary
run: chmod +x ${SCCACHE_PATH}

- name: Coverage test
run: |
rustup toolchain install ${{ matrix.version }}
cargo new hello
cd hello
echo "serde = { version = \"1.0\", features = [\"derive\"] }" >> Cargo.toml
cargo +${{ matrix.version }} test
env:
RUSTC_WRAPPER: /home/runner/.cargo/bin/sccache
CARGO_INCREMENTAL: "0"
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
RUSTDOCFLAGS: "-Cpanic=abort"
34 changes: 26 additions & 8 deletions src/compiler/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
use crate::cache::FileObjectSource;
use crate::compiler::args::*;
use crate::compiler::{
Cacheable, ColorMode, Compilation, CompileCommand, Compiler, CompilerArguments, CompilerHasher,
CompilerKind, CompilerProxy, HashResult,
c::ArtifactDescriptor, Cacheable, ColorMode, Compilation, CompileCommand, Compiler,
CompilerArguments, CompilerHasher, CompilerKind, CompilerProxy, HashResult,
};
#[cfg(feature = "dist-client")]
use crate::compiler::{DistPackagers, OutputsRewriter};
Expand Down Expand Up @@ -186,7 +186,7 @@ pub struct RustCompilation {
/// The compiler inputs.
inputs: Vec<PathBuf>,
/// The compiler outputs.
outputs: HashMap<String, PathBuf>,
outputs: HashMap<String, ArtifactDescriptor>,
Xuanwo marked this conversation as resolved.
Show resolved Hide resolved
/// The directories searched for rlibs
crate_link_paths: Vec<PathBuf>,
/// The crate name being compiled.
Expand Down Expand Up @@ -1513,19 +1513,37 @@ where
.into_iter()
.map(|o| {
let p = output_dir.join(&o);
(o, p)
(
o,
ArtifactDescriptor {
path: p,
optional: false,
},
)
})
.collect::<HashMap<_, _>>();
let dep_info = if let Some(dep_info) = dep_info {
let p = output_dir.join(&dep_info);
outputs.insert(dep_info.to_string_lossy().into_owned(), p.clone());
outputs.insert(
dep_info.to_string_lossy().into_owned(),
ArtifactDescriptor {
path: p.clone(),
optional: false,
},
);
Some(p)
} else {
None
};
if let Some(gcno) = gcno {
let p = output_dir.join(&gcno);
outputs.insert(gcno.to_string_lossy().into_owned(), p);
outputs.insert(
gcno.to_string_lossy().into_owned(),
ArtifactDescriptor {
path: p,
optional: true,
},
);
}
let mut arguments = arguments;
// Request color output unless json was requested. The client will strip colors if needed.
Expand Down Expand Up @@ -1761,8 +1779,8 @@ impl Compilation for RustCompilation {
fn outputs<'a>(&'a self) -> Box<dyn Iterator<Item = FileObjectSource> + 'a> {
Box::new(self.outputs.iter().map(|(k, v)| FileObjectSource {
key: k.to_string(),
path: v.clone(),
optional: false,
path: v.path.clone(),
optional: v.optional,
}))
}
}
Expand Down