Skip to content

Commit

Permalink
chore(ci): Re-enable code coverage reporting (#99)
Browse files Browse the repository at this point in the history
* chore(ci): Re-enable code coverage reporting

* upgrade llvm

* upgrade llvm

* fix

* fix lints
  • Loading branch information
tibordp authored Aug 24, 2024
1 parent 7c0d2e7 commit 35a1b6a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ jobs:
code-coverage:
name: Collect code coverage
runs-on: ubuntu-latest
# Temporarily disabled due to clang miscompilation?
if: false
steps:
- uses: actions/checkout@v2
- name: Install Rust
Expand All @@ -109,7 +107,10 @@ jobs:

- name: Install LLVM
run: |
sudo apt-get install -y llvm
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
sudo apt-get install -y llvm-18 llvm-18-dev clang-tools-18
- name: Install Tree-sitter (with runtime)
run: |
Expand All @@ -125,7 +126,7 @@ jobs:

- name: Build dist-check with coverage
timeout-minutes: 10
run: make coverage -j8
run: CC=clang-18 LLVM_SUFFIX=-18 make coverage -j8

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ else ifdef FAST_DEBUG
CFLAGS += -g0
ALUMINA_FLAGS += --debug
else ifdef COVERAGE
CC = clang
CC ?= clang
BUILD_DIR = $(BUILD_ROOT)/coverage
CARGO_FLAGS += --profile coverage
CARGO_TARGET_DIR = target/coverage
Expand Down Expand Up @@ -326,18 +326,18 @@ coverage:
COVERAGE=1 CACHE_AST=1 $(MAKE) all-tests-with-coverage

all-tests-with-coverage: test test-docs test-libraries test-diag examples
llvm-profdata merge \
llvm-profdata$(LLVM_SUFFIX) merge \
-sparse \
$(BUILD_DIR)/profiles/* \
-o $(BUILD_DIR)/profiles/merged.profdata

llvm-cov export \
llvm-cov$(LLVM_SUFFIX) export \
-Xdemangler=rustfilt \
-format=lcov \
-instr-profile=$(BUILD_DIR)/profiles/merged.profdata $(ALUMINA_BOOT) \
$(BOOTSTRAP_SOURCES) > $(BUILD_DIR)/coverage.txt

llvm-cov show \
llvm-cov$(LLVM_SUFFIX) show \
-Xdemangler=rustfilt \
-format=html \
-instr-profile=$(BUILD_DIR)/profiles/merged.profdata $(ALUMINA_BOOT) \
Expand Down
8 changes: 4 additions & 4 deletions src/alumina-boot-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ pub fn ast_serializable(input: TokenStream) -> TokenStream {
}
});

let deserialize_fields = variant.fields.iter().enumerate()
.map(|(_i, f)| {
let deserialize_fields = variant.fields.iter()
.map(|f| {
let ty = &f.ty;
quote! {
<#ty as #module_path::AstSerializable<#lifetime>>::deserialize(deserializer)?
Expand Down Expand Up @@ -167,8 +167,8 @@ pub fn ast_serializable(input: TokenStream) -> TokenStream {
}
});

let deserialize_fields = r#struct.fields.iter().enumerate()
.map(|(_i, f)| {
let deserialize_fields = r#struct.fields.iter()
.map(|f| {
let ty = &f.ty;
if let Some(field) = &f.ident {
quote! {
Expand Down
1 change: 1 addition & 0 deletions src/alumina-boot/src/ast/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ impl<'ast> DeserializeContext<'ast> {
}

pub struct AstDeserializer<'ast, R: std::io::Read> {
#[allow(dead_code)]
pub global_ctx: GlobalCtx,
pub ast: &'ast AstCtx<'ast>,
context: DeserializeContext<'ast>,
Expand Down
3 changes: 3 additions & 0 deletions src/alumina-boot/src/ir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ pub struct StructLike<'ir> {
pub attributes: &'ir [Attribute<'ir>],
pub fields: &'ir [Field<'ir>],
pub is_union: bool,
#[allow(dead_code)]
pub span: Option<Span>,
}

Expand Down Expand Up @@ -321,6 +322,7 @@ pub struct Closure<'ir> {
pub struct Protocol<'ir> {
pub name: Option<&'ir str>,
pub methods: &'ir [ProtocolFunction<'ir>],
#[allow(dead_code)]
pub span: Option<Span>,
}

Expand Down Expand Up @@ -348,6 +350,7 @@ pub struct Enum<'ir> {
pub name: Option<&'ir str>,
pub underlying_type: TyP<'ir>,
pub members: &'ir [EnumMember<'ir>],
#[allow(dead_code)]
pub span: Option<Span>,
}

Expand Down

0 comments on commit 35a1b6a

Please sign in to comment.