Giter Club home page Giter Club logo

Comments (6)

tomeon avatar tomeon commented on June 9, 2024

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.

infertux avatar infertux commented on June 9, 2024

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.

golharam avatar golharam commented on June 9, 2024

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.

tomeon avatar tomeon commented on June 9, 2024

@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.

infertux avatar infertux commented on June 9, 2024

Ping @golharam

from bashcov.

infertux avatar infertux commented on June 9, 2024

It's been nearly two years. Going to close this. Please reopen if this is still happening.

from bashcov.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.