bashcov
bashcov copied to clipboard
bashcov used with shunit2
when running bashcov with shunit2 test case, i got "bashcov: warning: encountered an error parsing Bash's output (error was: expected integer for LINENO, got ""). This can occur if your script or its path contains the sequence "\u001E", or if your script unsets LINENO. Aborting early; coverage report will be incomplete. Coverage report generated for bashcov 1.6.0 (bash 4.3) to /home/XXXX/installation/unit-test/coverage. 0 / 986 LOC (0.0%) covered."
Could someone here help on this ?
Could you help? @infertux thanks very much
As the error message suggests, can you double check that:
- your script doesn't mess with
$LINENO
- you don't have this Unicode character in your script or path
Does the issue occur if you run shunit2 tests one at a time?
Hi @infertux : Thanks for your comments.
- My script doesn't mess with $LINENO
- Do not have the Unicode character It even happens when i run this simple test script. You could try it by running bashcov ./test_set_trace_level.sh Besides, what is the mechanism that bashcov used for coverage checking? bashcov-test.tar.gz
bashcov -- ./test_set_trace_level.sh
testLogLevel_PRODUCT
testLogLevel_TRACE
Ran 2 tests.
OK
bashcov: warning: /tmp/shunit.GmdRwD/noexec was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.GmdRwD/suite was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.GmdRwD/setUp was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.GmdRwD/tearDown was executed but has been deleted since then - it won't be reported in coverage.
Coverage report generated for bashcov 1.6.0 (bash 4.4) to [...]/coverage. 148 / 399 LOC (37.09%) covered.
It's working fine for me but I'm using Bash 4.4 and you're using 4.3 so this might explain the issue. Can you try with 4.4?
Btw, I noticed there is an extra space in test_set_trace_level.sh
: #! /bin/sh
. Perhaps this is causing issues too.
Besides, what is the mechanism that bashcov used for coverage checking?
Bashcov leverages Bash's xtrace
feature which outputs executed lines to $PS4
: https://github.com/infertux/bashcov/blob/master/lib/bashcov/xtrace.rb.
Hi, infertux: Thanks for the reply. Upgrade the bash to 4.4, also remove the space, the result is as following: root@VirtualBox:~/bashcov-test# bashcov -- ./test_set_trace_level.sh testLogLevel_PRODUCT testLogLevel_TRACE
Ran 2 tests.
OK bashcov: warning: encountered an error parsing Bash's output (error was: expected integer for LINENO, got ""). This can occur if your script or its path contains the sequence "\u001E", or if your script unsets LINENO. Aborting early; coverage report will be incomplete. Coverage report generated for bashcov 1.6.0 (bash 4.4) to /root/bashcov-test/coverage.
Is there any other suspect ? My os is ubuntu 16.04
Hmm no other suspects I can think of. We'll need to get some debugging information. Can you add the following line in $GEM_HOME/gems/bashcov-1.6.0/lib/bashcov/xtrace.rb
and paste the output here (redacting any sensitive information ;)):
diff --git i/lib/bashcov/xtrace.rb w/lib/bashcov/xtrace.rb
index 5ba285c..871e216 100644
--- i/lib/bashcov/xtrace.rb
+++ w/lib/bashcov/xtrace.rb
@@ -118,6 +118,7 @@ module Bashcov
if lineno =~ /\A\d+\z/
lineno = lineno.to_i
else
+ p paths, @files
raise XtraceError.new(
"expected integer for LINENO, got #{lineno.inspect}", @files
)
Hi @infertux Added the
p paths, @files
and here are the output:
testLogLevel_PRODUCT testLogLevel_TRACE
Ran 2 tests.
OK ["", "", ""] {} bashcov: warning: encountered an error parsing Bash's output (error was: expected integer for LINENO, got ""). This can occur if your script or its path contains the sequence "\u001E", or if your script unsets LINENO. Aborting early; coverage report will be incomplete. Coverage report generated for bashcov 1.6.0 (bash 4.4) to /root/bashcov-test/coverage. 0 / 674 LOC (0.0%) covered.
Hope it will be helpful :)
besides, i output the $LINENO in my bash environment, it does output the $LINENO
Sorry this is pretty difficult to debug since I can't replicate the issue. What output do you get with the bashcov-test.tar.gz
archive you uploaded above? Also, what Ruby version are you using?
Hi, @infertux: Yes , it is really hard to debug. 1. Here are the ruby version: ruby 2.3.1p112 returned by the ruby --version. 2. Here are the output of the bashcov-test.tar.gz bashcov ./test_set_trace_level.sh testLogLevel_PRODUCT testLogLevel_TRACE
Ran 2 tests.
OK ["", "", ""] {} bashcov: warning: encountered an error parsing Bash's output (error was: expected integer for LINENO, got ""). This can occur if your script or its path contains the sequence "\u001E", or if your script unsets LINENO. Aborting early; coverage report will be incomplete. Coverage report generated for bashcov 1.6.0 (bash 4.4) to /root/bashcov-test/coverage. 0 / 7 LOC (0.0%) covered.
- Besides whether the bashcov could be installed with ruby version below 2.2.7 gem install bashcov Fetching: simplecov-html-0.10.2.gem (100%) Fetching: docile-1.1.5.gem (100%) Fetching: simplecov-0.15.1.gem (100%) Fetching: bashcov-1.6.0.gem (100%) ERROR: Error installing bashcov: bashcov requires Ruby version >= 2.2.7. I have another product environment which is rhel7 with ruby version below that, and it is hard for us to upgrade the product environment for the time being, how can i deal with this? Actually i am a newbie to ruby.
thanks
Sigh, I couldn't replicate the issue with Ruby 2.3.1 either:
$ /home/infertux/.rvm/gems/ruby-2.3.1/gems/bashcov-1.6.0/bin/bashcov ./test_set_trace_level.sh
testLogLevel_PRODUCT
testLogLevel_TRACE
Ran 2 tests.
OK
bashcov: warning: /tmp/shunit.FbFeIb/noexec was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.FbFeIb/suite was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.FbFeIb/setUp was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.FbFeIb/tearDown was executed but has been deleted since then - it won't be reported in coverage.
Coverage report generated for bashcov 1.6.0 (bash 4.4) to /home/infertux/dev/bashcov/bashcov-test/coverage. 148 / 399 LOC (37.09%) covered.
Coverage report generated for bashcov 1.6.0 (bash 4.4) to /home/infertux/dev/bashcov/bashcov-test/coverage. 0.0 / 0.0 LOC (100.0%) covered.
$ bash --version
GNU bash, version 4.4.12(1)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
Can you try on another machine?
I have another product environment which is rhel7 with ruby version below that, and it is hard for us to upgrade the product environment for the time being, how can i deal with this? Actually i am a newbie to ruby.
Ruby 2.3.1 is ancient and 2.2 will EOL soon. I would strongly suggest to upgrade. Ruby is one of those software that evolves too fast for package managers unfortunately. Ruby is one of the very few software I install from source because of that. I made a simple Bash script to do so: https://github.com/infertux/ruby-bootstrap (it works with CentOS so presumably RHEL as well.)
Hi @wondertiger, could you please update to the latest version with gem update bashcov
and paste the new output here?
Ping @wondertiger
Hi @infertux : Recently, i am busy with other stuffs, i will update this. thanks
Hi @infertux : Sorry for the late response. My OS is ubuntu I installed the ruby from scratch, and run the following against my scripts. bashcov ./myscript.sh
#<Thread:0x000056064cedc828@/usr/local/lib/ruby/gems/2.5.0/gems/bashcov-1.8.2/lib/bashcov/runner.rb:42 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
4: from /usr/local/lib/ruby/gems/2.5.0/gems/bashcov-1.8.2/lib/bashcov/runner.rb:42:in `block (2 levels) in run'
3: from /usr/local/lib/ruby/gems/2.5.0/gems/bashcov-1.8.2/lib/bashcov/xtrace.rb:94:in `read'
2: from /usr/local/lib/ruby/gems/2.5.0/gems/bashcov-1.8.2/lib/bashcov/xtrace.rb:94:in `loop'
1: from /usr/local/lib/ruby/gems/2.5.0/gems/bashcov-1.8.2/lib/bashcov/xtrace.rb:96:in `block in read'
/usr/local/lib/ruby/gems/2.5.0/gems/bashcov-1.8.2/lib/bashcov/xtrace.rb:121:in `parse_hit!': expected integer for LINENO, got "" (Bashcov::XtraceError)
bashcov: warning: encountered an error parsing Bash's output (error was: expected integer for LINENO, got ""). This can occur if your script or its path contains the sequence "\u001E", or if your script unsets LINENO. Aborting early; coverage report will be incomplete.
Run completed using bashcov 1.8.2 with Bash 4.4, Ruby 2.5.0, and SimpleCov 0.15.1.
Coverage report generated for /bin/bash ./netact_shell_runner.sh to /media/sf_my-croft/local_repository/installation/unit-test/coverage. 0 / 1015 LOC (0.0%) covered.
Hi @infertux :
I was able to find another centos machine. It seems that it is OK with this machine.
Besides, if i want to exclude all the test files in one directory, how can i deal with that?
bashcov: warning: /tmp/shunit.du2yMx/noexec was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.du2yMx/suite was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /etc/sysconfig/sam_med was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /usr/mock/bin/ls was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /usr/mock/bin/ps was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /usr/mock/bin/whoami was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /usr/mock/bin/java was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.du2yMx/tearDown was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.W9HegS/noexec was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.W9HegS/suite was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.W9HegS/setUp was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /usr/mock/bin/openssl was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.W9HegS/tearDown was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.sRYogR/noexec was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.sRYogR/suite was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.sRYogR/setUp was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.sRYogR/tearDown was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /usr/mock/bin/grep was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.M0se6w/noexec was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /opt/oss/nokianetworks-sam_user_creation/bin/sam_logging_helper.sh was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /usr/mock/bin/chown was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /opt/oss/nokianetworks-sam_user_creation/bin/sam_verify_deploy_user_keystore.sh was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.M0se6w/suite was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.M0se6w/setUp was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /usr/sbin/nscd was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.M0se6w/tearDown was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /usr/mock/bin/id was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /usr/bin/ldapmodify was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /usr/mock/bin/ldapsearch was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.1xlScs/noexec was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.1xlScs/suite was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.1xlScs/setUp was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.wMKevS/noexec was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /opt/oss/nokianetworks-sam_med/install/bin/sam_logging_helper.sh was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /opt/oss/nokianetworks-sam_med/install/bin/check_mediation_install_host.sh was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /usr/mock/bin/hostname was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.wMKevS/suite was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.wMKevS/setUp was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.wMKevS/tearDown was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.MEuTcB/noexec was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.MEuTcB/suite was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.MEuTcB/setUp was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.MEuTcB/tearDown was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.roiVyW/noexec was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.roiVyW/suite was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.roiVyW/setUp was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /usr/mock/bin/scp was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /usr/mock/bin/ssh was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.roiVyW/tearDown was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.e2VRVK/noexec was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.e2VRVK/suite was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.e2VRVK/setUp was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.e2VRVK/tearDown was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.X4VSEf/noexec was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.X4VSEf/suite was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.X4VSEf/setUp was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.X4VSEf/tearDown was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.p8SRH9/noexec was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.p8SRH9/suite was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.p8SRH9/setUp was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.p8SRH9/tearDown was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.ItM3kr/noexec was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.ItM3kr/suite was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.ItM3kr/setUp was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.ItM3kr/tearDown was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.dl2SNV/noexec was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.dl2SNV/suite was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.dl2SNV/setUp was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.dl2SNV/tearDown was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /usr/mock/bin/keytool was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /usr/mock/bin/chmod was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /usr/mock/bin/cp was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.Xnowti/noexec was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.Xnowti/suite was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/shunit.Xnowti/setUp was executed but has been deleted since then - it won't be reported in coverage.
Run completed using bashcov 1.8.2 with Bash 4.2, Ruby 2.5.0, and SimpleCov 0.15.1.
Coverage report generated for /bin/bash ./netact_shell_runner.sh to /root/install/unit-test/coverage. 1242 / 1566 LOC (79.31%) covered.
So it has happened with Bash 4.2, 4.3 and 4.4 thus I don't think it has anything to do with the version of Bash.
Are you sure the code was the same on Ubuntu and CentOS? You may use the rsync -av --delete --dry-run $FROM $TO
command to double check.
if i want to exclude all the test files in one directory, how can i deal with that?
See https://github.com/infertux/bashcov#simplecov-integration - you can create a .simplecov
file with add_filter "/test/"
to exclude a directory.
Hi there!
Same error here with ubuntu 18.04 in a docker container:
#<Thread:0x00005570e1cb7120@/var/lib/gems/2.5.0/gems/bashcov-1.8.2/lib/bashcov/runner.rb:42 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
4: from /var/lib/gems/2.5.0/gems/bashcov-1.8.2/lib/bashcov/runner.rb:42:in `block (2 levels) in run'
3: from /var/lib/gems/2.5.0/gems/bashcov-1.8.2/lib/bashcov/xtrace.rb:94:in `read'
2: from /var/lib/gems/2.5.0/gems/bashcov-1.8.2/lib/bashcov/xtrace.rb:94:in `loop'
1: from /var/lib/gems/2.5.0/gems/bashcov-1.8.2/lib/bashcov/xtrace.rb:96:in `block in read'
/var/lib/gems/2.5.0/gems/bashcov-1.8.2/lib/bashcov/xtrace.rb:121:in `parse_hit!': expected integer for LINENO, got "" (Bashcov::XtraceError)
bashcov: warning: encountered an error parsing Bash's output (error was: expected integer for LINENO, got ""). This can occur if your script or its path contains the sequence "\u001E", or if your script unsets LINENO. Aborting early; coverage report will be incomplete.
If I use ubuntu 17.10, I've got a different stack trace
# ruby -v
ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]
root@0c9d306e73a0:/# echo echo hello > /tmp/a.bash
root@0c9d306e73a0:/# bashcov /tmp/a.bash
hello
bashcov: warning: encountered an error parsing Bash's output (error was: expected integer for LINENO, got ""). This can occur if your script or its path contains the sequence "\u001E", or if your script unsets LINENO. Aborting early; coverage report will be incomplete.
/var/lib/gems/2.3.0/gems/bashcov-1.8.2/lib/bashcov/detective.rb:50:in `readline': Invalid argument @ io_fillbuf - fd:8 /proc/1/attr/current (Errno::EINVAL)
from /var/lib/gems/2.3.0/gems/bashcov-1.8.2/lib/bashcov/detective.rb:50:in `block in shellscript_shebang?'
from /var/lib/gems/2.3.0/gems/bashcov-1.8.2/lib/bashcov/detective.rb:50:in `open'
from /var/lib/gems/2.3.0/gems/bashcov-1.8.2/lib/bashcov/detective.rb:50:in `shellscript_shebang?'
from /var/lib/gems/2.3.0/gems/bashcov-1.8.2/lib/bashcov/detective.rb:37:in `shellscript?'
from /var/lib/gems/2.3.0/gems/bashcov-1.8.2/lib/bashcov/runner.rb:132:in `block in find_bash_files!'
from /usr/lib/ruby/2.3.0/pathname.rb:563:in `block in find'
from /usr/lib/ruby/2.3.0/find.rb:49:in `block (2 levels) in find'
from /usr/lib/ruby/2.3.0/find.rb:48:in `catch'
from /usr/lib/ruby/2.3.0/find.rb:48:in `block in find'
from /usr/lib/ruby/2.3.0/find.rb:43:in `each'
from /usr/lib/ruby/2.3.0/find.rb:43:in `find'
from /usr/lib/ruby/2.3.0/pathname.rb:563:in `find'
from /var/lib/gems/2.3.0/gems/bashcov-1.8.2/lib/bashcov/runner.rb:131:in `find_bash_files!'
from /var/lib/gems/2.3.0/gems/bashcov-1.8.2/lib/bashcov/runner.rb:68:in `result'
from /var/lib/gems/2.3.0/gems/bashcov-1.8.2/bin/bashcov:13:in `<top (required)>'
from /usr/local/bin/bashcov:22:in `load'
from /usr/local/bin/bashcov:22:in `<main>'
I think that the key is the next line:
/var/lib/gems/2.3.0/gems/bashcov-1.8.2/lib/bashcov/detective.rb:50:in `readline': Invalid argument @ io_fillbuf - fd:8 /proc/1/attr/current (Errno::EINVAL)
Don't know if @wondertiger has the same line.
OK, I've found my issue's cause, and I'm able to fix it outside bashcov.
The problem is that bash does not inherit PS4
variables executing as root since bash 4.4 (See news.nn in https://lists.gnu.org/archive/html/help-bash/2016-09/msg00019.html). If @wondertiger is executing tests under root, and the issue shows in different bash version, I bet that the different distros have backported the fix.
So my current solution in my test system is to execute bashcov as a newly created user, but bashcov should warn or provide an alternative path if the user is root. Sadly, my knowledge of ruby is insufficient, so I can't send a patch, but I hope that this description will be enough to fix the issue.
Hoping that this clue is enough for you to address the issue!
So... the only solution for this one is > bash-4.4
?
I'm sorry to say that I ended up using kcov, since I don't know anything about ruby but I do know C++ :smile:. having said that, I solved this particular issue with BASH_ENV
, setting PS4
there. BASH_ENV
keeps being inherited.
@stdedos -- I'm currently working implementing the solution @eugpermar describes. Will link to the WIP branch as soon as I've pushed it from my working copy.
@stdedos -- I'm currently working implementing the solution @eugpermar describes. Will link to the WIP branch as soon as I've pushed it from my working copy.
That sounds nice! It is definitely less hassle than kcov
, since there are no "compiled" versions (and I don't have entire control over the executed environment). It would nice if you support Ubuntu 16.04 environment-specifics out of the box (used Ruby is 2.4.0, but I assume that is not "such" a big issue, since there is always RVM)
I did just hit this problem and I am struggeling find a workaround. Is there a fix planned in bashcov? I would appreciate if somebody could explain what the workaround is? I am running bashcov on a RHEL8 with bash 4.4.19 and I use bats 1.2.1. Using bashcov -- bats --tap ./unit-tests.bats all tests run succesful and then
bashcov: warning: environment was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/bats-run-242923/bats.242961.src was executed but has been deleted since then - it won't be reported in coverage.
Run completed using bashcov 1.8.2 with Bash 4.4, Ruby 2.5.5, and SimpleCov 0.15.1.
Coverage report generated for /bin/bash bats --tap ./unit-tests.bats to /home/myuser/project/tests/unit-tests/coverage. 0 / 5 LOC (0.0%) covered.
Would be great if you could drop me a hint how to get around the PS4 "Problem".
Thanks a lot. Michael
Bashcov 3.0 has been released with a fix for this issue. Please run gem update bashcov
and try again.
I get this error message when running bats tests
bashcov: warning: environment was executed but has been deleted since then - it won't be reported in coverage.
bashcov: warning: /tmp/bats-run-ImmxDv/bats.4628.src was executed but has been deleted since then - it won't be reported in coverage.
Coverage report generated for RSpec, Unknown Test Framework to /workspace/coverage. 0 / 0 LOC (100.0%) covered.