From 31ad011daf24ed4bd32a1ea349042596b22b956a Mon Sep 17 00:00:00 2001 From: arty Date: Thu, 14 Sep 2023 11:29:04 -0700 Subject: [PATCH 1/2] Fix rename error which caused clvm ops and callables to be renamed --- src/compiler/rename.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/compiler/rename.rs b/src/compiler/rename.rs index 833706754..ca47292e5 100644 --- a/src/compiler/rename.rs +++ b/src/compiler/rename.rs @@ -234,12 +234,18 @@ fn rename_in_bodyform( }, BodyForm::Call(l, vs, tail) => { - let new_vs = map_m( + let mut new_vs = map_m( &|x: &Rc| -> Result, CompileErr> { Ok(Rc::new(rename_in_bodyform(namemap, x.clone())?)) }, vs, )?; + // Ensure that we haven't renamed the 0th element of a call + // They exist in a separate (global) namespace of callables + // and aren't in the variable scope stack. + if !vs.is_empty() { + new_vs[0] = vs[0].clone(); + } let new_tail = if let Some(t) = tail.as_ref() { Some(Rc::new(rename_in_bodyform(namemap, t.clone())?)) } else { From 2a7902dfc4be6b76dcea47eb8539f7caa695bd01 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Tue, 19 Sep 2023 20:25:23 +0100 Subject: [PATCH 2/2] Opt for source-based code coverage. --- .github/workflows/build-test.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 02c61ab73..409609482 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -337,11 +337,26 @@ jobs: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: - toolchain: nightly - - name: Install tarpaulin - run: cargo +nightly install cargo-tarpaulin - - name: Run tarpaulin - run: cargo tarpaulin --no-dead-code --engine llvm --workspace --all-features --ignore-panics --out Lcov + toolchain: stable + - name: Run for coverage + run: | + sudo apt-get update + sudo apt-get install lcov -y + rustup component add llvm-tools-preview + cargo install grcov + export RUSTFLAGS="-Cinstrument-coverage" + export LLVM_PROFILE_FILE=$(pwd)/target/clvm_tools_rs-%p-%m.profraw + export CARGO_TARGET_DIR=$(pwd)/target + cargo test --release --workspace + python -m venv venv + source venv/bin/activate + git clone https://github.com/Chia-Network/clvm_tools.git --branch=main --single-branch + pip install ./clvm_tools + pip install maturin pytest + maturin develop --release + (cd resources/tests/cmdline/tests && pytest) + grcov . --binary-path target -s . --branch --ignore-not-existing --ignore='*/.cargo/*' --ignore='*/tests/*' -o rust_cov.info + python -c 'with open("rust_cov.info") as f: lines = [l for l in f if not (l.startswith("DA:") and int(l.split(",")[1].strip()) >= 2**63)]; open("lcov.info", "w").writelines(lines)' - name: Upload to Coveralls uses: coverallsapp/github-action@v2 if: always()