Skip to content

Commit 783b063

Browse files
committed
Test all supported LLVM versions at once
Previously, testing all supported configurations required installing many different versions of rustc manually. Now, it only requires running `cargo test --all-features`. This introduces a dependency on `rustup`. It also introduces a dependency on `cargo-binutils` with 166 merged. Note that PR has not yet been merged at time of writing. By default, this only tests LLVM 20, which is the latest version currently available on stable rust.
1 parent c0ead61 commit 783b063

6 files changed

Lines changed: 172 additions & 103 deletions

File tree

.github/workflows/ci.yml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
version:
14-
- 1.82.0
15-
- stable
16-
- beta
17-
- nightly
1813
target:
1914
- x86_64-unknown-linux-gnu
2015
- x86_64-unknown-linux-musl
@@ -23,7 +18,7 @@ jobs:
2318
- uses: actions/checkout@v2
2419
- uses: actions-rs/toolchain@v1
2520
with:
26-
toolchain: ${{ matrix.version }}
21+
toolchain: "1.90"
2722
override: true
2823
components: rustfmt, llvm-tools-preview
2924
- name: build
@@ -32,17 +27,15 @@ jobs:
3227
cargo check --all-features
3328
- name: test
3429
run: |
35-
cargo install cargo-binutils@0.3.6
36-
cargo test
30+
# TODO: switch this to a published version after the next release
31+
cargo install --git https://github.com/rust-embedded/cargo-binutils/ --rev 7fc23414305df173dc46a5fa4b98ab2bcd3d21e1
32+
cargo test --all-features
3733
- name: check formatting
3834
run: cargo fmt -- --check
3935
windows:
4036
runs-on: windows-latest
4137
strategy:
4238
matrix:
43-
version:
44-
- stable
45-
- nightly
4639
target:
4740
- x86_64-pc-windows-gnu
4841
- x86_64-pc-windows-msvc
@@ -51,31 +44,34 @@ jobs:
5144
- uses: actions/checkout@v2
5245
- uses: actions-rs/toolchain@v1
5346
with:
54-
toolchain: ${{ matrix.version }}
47+
toolchain: "1.90"
5548
override: true
5649
components: llvm-tools-preview
5750
- name: test
5851
run: |
5952
cargo install cargo-binutils@0.3.6
53+
# NOTE: only tests default features
6054
cargo test
6155
mac:
6256
runs-on: macos-latest
6357
strategy:
6458
matrix:
65-
version:
66-
- stable
67-
- nightly
6859
target:
69-
- x86_64-apple-darwin
60+
- x86_64-apple-darwin
61+
- aarch64-apple-darwin
7062
fail-fast: false
7163
steps:
7264
- uses: actions/checkout@v2
7365
- uses: actions-rs/toolchain@v1
7466
with:
75-
toolchain: ${{ matrix.version }}
67+
toolchain: "1.90"
7668
override: true
7769
components: llvm-tools-preview
7870
- name: test
7971
run: |
8072
cargo install cargo-binutils@0.3.6
73+
# NOTE: only tests default features
8174
cargo test
75+
# we run the nightly test here to distribute CPU time away from the linux runner
76+
# we only run `profdata` because some ignored tests in `cov` fail
77+
cargo test --test profdata -- --ignored

Cargo.toml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,28 @@ license = "Apache-2.0"
1010
categories = ["encoding"]
1111
keywords = ["coverage", "llvm"]
1212
exclude = ["tests/*", ".github/*", "benches/*"]
13-
build = "build.rs"
1413
rust-version = "1.80.0"
1514

1615
[features]
17-
default = ["cli"]
16+
default = ["cli", "__llvm_20"]
1817
cli = ["structopt", "tracing-subscriber"]
1918

19+
# for testing
20+
# to run all tests, run `cargo test --all-features`.
21+
# to run a specific version, run `cargo test --no-default-features --featurs __llvm_XX`.
22+
# by default, only runs tests again llvm 20
23+
__llvm_11 = []
24+
__llvm_12 = []
25+
__llvm_13 = []
26+
__llvm_14 = []
27+
__llvm_15 = []
28+
__llvm_16 = []
29+
__llvm_17 = []
30+
__llvm_18 = []
31+
__llvm_19 = []
32+
__llvm_20 = []
33+
__llvm_21 = []
34+
2035
[dependencies]
2136
anyhow = "1.0.65"
2237
flate2 = "1.0"

build.rs

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

src/bin/profparser.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,12 @@ impl ShowCommand {
284284
}
285285
}
286286
if profile.get_level() == InstrumentationLevel::Ir {
287-
// This is just to enable same printout in older versions with llvm 11
288-
#[cfg(not(llvm_11))]
289287
println!(
290288
"Instrumentation level: {} entry_first = {}",
291289
profile.get_level(),
290+
// NOTE: in llvm 11 this is always false
292291
profile.is_entry_first() as usize
293292
);
294-
#[cfg(llvm_11)]
295-
println!("Instrumentation level: {}", profile.get_level());
296293
} else {
297294
println!("Instrumentation level: {}", profile.get_level());
298295
}

src/instrumentation_profile/text_profile.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ impl InstrProfReader for TextInstrProf {
267267
} else if check_tag(name, ENTRY_TAG) {
268268
entry_first = true;
269269
} else if !check_tag(name, FE_TAG) {
270-
// return Err(Err::Failure(Error::new(bytes, ErrorKind::Tag)));
271270
return Err(Err::Failure(VerboseError::from_error_kind(
272271
bytes,
273272
ErrorKind::Tag,

0 commit comments

Comments
 (0)