move-language / move

Apache License 2.0
2.25k stars 679 forks source link

[Bug][Move CLI] move test crashes when --coverage is specified with no test cases being executed #968

Open rahxephon89 opened 1 year ago

rahxephon89 commented 1 year ago

🐛 Bug

In the move cli, we can specify test cases to run by executing move test MODULE_TO_TEST. However, if there is no test to be executed, move cli will panic when the option --coverage is attached probably because no coverage trace file is generated.

To reproduce

Inside language/move-stdlib, executing move test 0x1::vector_tests --coverage will lead to panic with the error message:

thread 'main' panicked at 'Unable to open coverage trace file '"./.trace"'', .../language/tools/movecoverage/src/coverage_map.rs:67:33

Expected Behavior

Better error message instead of panic

rahxephon89 commented 1 year ago

Hi, @tnowacki @tzakian, I am wondering whether the panic described in this issue is intentional or not? If not, could you give me some direction on how to fix it? Thanks