Description
Description
Running bashcov as non-root with the following command line:
bashcov -- ./main/idmdoctor export -l admin -u http://idmui.vmware:50000 -d ~/tmp/export/
This results in the following error/stacktrace:
#<Thread:0x00005a56a42613a8 /var/lib/gems/3.0.0/gems/bashcov-3.1.3/lib/bashcov/runner.rb:63 run> terminated with exception (report_on_exception is true):
/var/lib/gems/3.0.0/gems/bashcov-3.1.3/lib/bashcov/xtrace.rb:126:in `parse_hit!': expected integer for LINENO, got "\\\\${LINENO-}" (Bashcov::XtraceError)
from /var/lib/gems/3.0.0/gems/bashcov-3.1.3/lib/bashcov/xtrace.rb:96:in `block in read'
from /var/lib/gems/3.0.0/gems/bashcov-3.1.3/lib/bashcov/xtrace.rb:93:in `loop'
from /var/lib/gems/3.0.0/gems/bashcov-3.1.3/lib/bashcov/xtrace.rb:93:in `read'
from /var/lib/gems/3.0.0/gems/bashcov-3.1.3/lib/bashcov/runner.rb:63:in `block (2 levels) in run'
The program under test continues to run and coverage reports are generated, but the resulting bashcov report content is evidently incorrect. From the program under test's MAIN function, coverage is only correct until after the first subfunction call (DO_LOAD_BOOTSTRAP). Everything following this function call is reported as uncovered, which is not plausible.
Here's a screenshot of the coverage report from MAIN:
An interesting side note is that this bug seems to depend on the program under test. In exactly the same environment, when testing a different program, e.g.
bashcov -- ./main/smoke ~/tmp/export/
the exception does not occur and the coverage report looks absolutely plausible.
Environment
Ubuntu 22.04
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu]
bashcov 3.1.3 (via gem install bashcov
)
GNU bash, Version 5.1.16(1)-release (x86_64-pc-linux-gnu)