Skip to content

Commit 45e64ea

Browse files
committed
measure test coverage and post to coveralls
1 parent cdce076 commit 45e64ea

File tree

2 files changed

+77
-8
lines changed

2 files changed

+77
-8
lines changed

.github/workflows/coverage.yml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
2+
name: Test Coverage
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
- dev
9+
tags:
10+
- '**'
11+
pull_request:
12+
branches:
13+
- '**'
14+
15+
jobs:
16+
coverage:
17+
name: Test Coverage
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
with:
23+
fetch-depth: 1
24+
25+
- uses: actions/setup-python@v2
26+
name: Install Python 3.9
27+
with:
28+
python-version: 3.9
29+
30+
- name: Update pip
31+
run: |
32+
python -m pip install --upgrade pip
33+
34+
- name: Set up rust
35+
uses: actions-rs/toolchain@v1
36+
with:
37+
toolchain: nightly
38+
default: true
39+
profile: minimal
40+
components: llvm-tools-preview
41+
42+
- name: Install dependencies
43+
run: |
44+
python -m venv venv
45+
ln -s venv/bin/activate
46+
. ./activate
47+
48+
git clone https://github.com/Chia-Network/clvm_tools.git --branch=develop --single-branch
49+
git clone https://github.com/Chia-Network/clvm.git --branch=develop --single-branch
50+
python -m pip install ./clvm_tools
51+
python -m pip install ./clvm
52+
python -m pip install colorama
53+
python -m pip install maturin
54+
python -m pip install pytest
55+
56+
rustup target add x86_64-unknown-linux-musl
57+
cargo install grcov
58+
cargo install cargo-binutils
59+
60+
- name: Build
61+
run: |
62+
. ./activate
63+
RUSTFLAGS="-Zinstrument-coverage" maturin develop
64+
65+
- name: Run tests
66+
run: |
67+
. ./activate
68+
LLVM_PROFILE_FILE="pytest.profraw" pytest clvm/tests
69+
LLVM_PROFILE_FILE="unittest.profraw" RUSTFLAGS="-Zinstrument-coverage" cargo test --no-default-features
70+
grcov . -s . --binary-path ./venv/lib/python3.9/site-packages/ -t lcov --branch --ignore-not-existing -o lcov.info
71+
72+
- name: Coveralls
73+
uses: coverallsapp/github-action@master
74+
with:
75+
path-to-lcov: ./lcov.info
76+
github-token: ${{ secrets.GITHUB_TOKEN }}
77+

src/number.rs

-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::allocator::Allocator;
2-
use crate::node::Node;
32
use crate::reduction::EvalErr;
43

54
use num_bigint::BigInt;
@@ -22,13 +21,6 @@ pub fn ptr_from_number<T: Allocator>(
2221
allocator.new_atom(&slice)
2322
}
2423

25-
impl<T: Allocator> From<&Node<'_, T>> for Option<Number> {
26-
fn from(item: &Node<T>) -> Self {
27-
let v: &[u8] = &item.atom()?;
28-
Some(number_from_u8(v))
29-
}
30-
}
31-
3224
pub fn number_from_u8(v: &[u8]) -> Number {
3325
let len = v.len();
3426
if len == 0 {

0 commit comments

Comments
 (0)