taiki-e / cargo-llvm-cov

Cargo subcommand to easily use LLVM source-based code coverage (-C instrument-coverage).
Apache License 2.0
933 stars 57 forks source link

[maybe bug] `export CARGO_LLVM_COV_TARGET_DIR="./target"` make coverage dropped to near zero #211

Closed jiangying000 closed 2 years ago

jiangying000 commented 2 years ago

https://github.com/starcoinorg/starcoin/pull/3701/commits/b8896a889322f8ea971560d047b9f2f9d4b37e3a

I added export CARGO_LLVM_COV_TARGET_DIR="./target , want to fix binary path for a test case, but resulting coverage dropped from 55% to 0.5%

the pr is https://github.com/starcoinorg/starcoin/pull/3701, coverage report change https://github.com/starcoinorg/starcoin/runs/8093661553

Is this a bug or I did something wrong ?

thank you

taiki-e commented 2 years ago

I guess you probably need to use the absolute path.

jiangying000 commented 2 years ago

I guess you probably need to use the absolute path.

thanks, I'd try out

jiangying000 commented 2 years ago

I guess you probably need to use the absolute path.

absolute path works, thank you

taiki-e commented 2 years ago

FYI, #218 added warning for CARGO_LLVM_COV_TARGET_DIR with relative path.

$ CARGO_LLVM_COV_TARGET_DIR="./target" cargo llvm-cov 
warning: CARGO_LLVM_COV_TARGET_DIR with relative path may not work properly; consider using absolute path
jiangying000 commented 2 years ago

that's nice

taiki-e commented 2 years ago

CARGO_LLVM_COV_TARGET_DIR with relative path has been supported in 0.5.0.