Skip to content

Commit 8bb14d2

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 f355495 commit 8bb14d2

6 files changed

Lines changed: 134 additions & 98 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 15 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
30+
# TODO: use a published version, or at least a merged branch
31+
cargo install --git https://github.com/jyn514/cargo-binutils/ --branch metadata
3632
cargo test
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,7 +44,7 @@ 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
@@ -62,17 +55,15 @@ jobs:
6255
runs-on: macos-latest
6356
strategy:
6457
matrix:
65-
version:
66-
- stable
67-
- nightly
6858
target:
6959
- x86_64-apple-darwin
60+
- aarch64-apple-darwin
7061
fail-fast: false
7162
steps:
7263
- uses: actions/checkout@v2
7364
- uses: actions-rs/toolchain@v1
7465
with:
75-
toolchain: ${{ matrix.version }}
66+
toolchain: "1.90"
7667
override: true
7768
components: llvm-tools-preview
7869
- name: test

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)