Comments (6)
Bashcov has a --mute
option that silences output from the scripts it executes, as well as some of its own output. There is currently no option to disable all output from Bashcov. However, the --mute
option might not work for you, since it would likely silence shunit2
's own output.
You might be able to get away with redirecting standard error to /dev/null
, if I'm correct that the Bashcov output you're referring to is stuff like bashcov: warning: /tmp/shunit.Yh0FXR/noexec was executed but has been deleted since then - it won't be reported in coverage.
. Would that approach work for you?
(P.S. I like BATS for unit testing shell scripts.)
from bashcov.
Thanks for chiming in @BaxterStockman :)
@golharam: Just to clarify, Bashcov itself only outputs one line on stdout
normally which is Coverage report generated for bashcov v1.3.1 to [...]
. It may output additional warnings on stderr
which look like bashcov: warning: [...]
if there's a problem.
As @BaxterStockman said, you can silence the output from your script with bashcov --mute ./your_script.sh
. However I assume you're using bashcov shunit2 ./your_script.sh
? In this case, you can't silence the output of your_script.sh
and keep shunit2's output if they're both on stdout
and/or stderr
. I'm not familiar with shunit2 but there might be an option to redirect its output to a file?
In any case, you can play around with the --mute
flag and also redirect stdout
/ stderr
to /dev/null
like that: bashcov ... 2> /dev/null
, bashcov --mute ... > /dev/null
, etc. and let us know if that helps.
from bashcov.
Here's some of the output I'm getting:
[golharr@watson bashcov_test]$ bashcov ./unitTests.sh
+BASHCOV>46./unitTests.sh/home/golharr/workspace/RNASeq/test/bashcov_test'[' -n '' ']'
+BASHCOV>47./unitTests.sh/home/golharr/workspace/RNASeq/test/bashcov_test. ../shunit2/source/2.1/src/shunit2
++BASHCOV>17../shunit2/source/2.1/src/shunit2/home/golharr/workspace/RNASeq/test/bashcov_test'[' -n '' ']'
++BASHCOV>18../shunit2/source/2.1/src/shunit2/home/golharr/workspace/RNASeq/test/bashcov_testSHUNIT_VERSION=2.1.7pre
++BASHCOV>21../shunit2/source/2.1/src/shunit2/home/golharr/workspace/RNASeq/test/bashcov_testSHUNIT_TRUE=0
++BASHCOV>22../shunit2/source/2.1/src/shunit2/home/golharr/workspace/RNASeq/test/bashcov_testSHUNIT_FALSE=1
++BASHCOV>23../shunit2/source/2.1/src/shunit2/home/golharr/workspace/RNASeq/test/bashcov_testSHUNIT_ERROR=2
In this case, I just want to not see the BASHCOV> debug statements.
When I use --mute, I get:
[golharr@watson bashcov_test]$ bashcov --mute ./unitTests.sh
bashcov: warning: encountered an error parsing Bash's output (error was: expected integer for LINENO, got `nil'). 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 v1.3.1 to /home/golharr/workspace/RNASeq/test/bashcov_test/coverage. 0 / 26 LOC (0.0%) covered.
I'm not sure what's causing this error. I don't set/unset LINENO, but not sure if shunit2 does.
from bashcov.
@golharam, could you provide a link to your unitTests.sh
script, or (if that's not available) to another script that encounters the same issue?
Also, what version of Bash are you using, and do you do any manipulation of Bash options in your test suite -- for instance, set -x
?
from bashcov.
Ping @golharam
from bashcov.
It's been nearly two years. Going to close this. Please reopen if this is still happening.
from bashcov.
Related Issues (20)
- Not working in a minimal Linux container? HOT 6
- Submit Bashcov to https://github.com/awesome-lists/awesome-bash
- Option to suppress all bashcov output HOT 5
- Error when used with bats HOT 3
- parse_hit fails
- Shell flags inherited by child shells HOT 3
- 0% coverage with BATS on Mac HOT 1
- Is bashcov concurrency safe? HOT 1
- bashcov output should be silent by default HOT 3
- Using PS4 in tested script breaks coverage results HOT 1
- Capturing coverage on sourced script functions executed by bashunit
- `--bash-path` is not respected for `BASH_VERSION` detection HOT 1
- [question] bash 'compiler' HOT 1
- bashcov HOT 1
- Bashcov failing with LINENO related error. Bash is indeed above 4.4 (that was the recommendation till now to this error) HOT 1
- Are you planning a new release? HOT 3
- please rewrite this in bash HOT 2
- How to install on RHEL UBI8? HOT 1
- How to ignore files and folders in bashcov in GitLab-CI yaml? HOT 1
- Use of mutation testing in bashcov - Help needed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bashcov.