Skip to content

[BUG] [GREEN FAILURES] host-testbench.sh ignores errors #2752

Closed

Description

@marc-hb

Describe the bug
host-testbench exits with success 0 when tests fail. Random, recent example in PR #2751:

https://travis-ci.org/github/thesofproject/sof/jobs/672996210 is green but:

eqiir test failed!

I didn't even have to spend time to search for this example, I only looked at the most recent PR.

Ignoring failures is the very worst type of validation issue because it makes everyone think everything is OK when it's not.

Do NOT fix the unreported eqiir failure, fix host-testbench.sh error handling first.

From https://en.wikipedia.org/wiki/Test-driven_development#Test-driven_development_cycle

see if the new test fails [...] this rules out the possibility that the new test is flawed and will always pass.

For a start, host-testbench.sh has no set -e (set -o errexit)

$ shellcheck ./scripts/host-testbench.sh
In scripts/host-testbench.sh line 62:
if [[ $? -ne 0 ]]; then
      ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.

https://github.com/koalaman/shellcheck/wiki/SC2181

One possible alternative:

set -e
...
if test1 ; then
  ...
else
  ...
  : $((failures++))
fi

exit $failures

To ignore some errors use "|| true":

  this_command_can_fail_and_it_is_OK || true

https://github.com/thesofproject/sof/pull/2657/files is a good codesyle example.

To Reproduce

./scripts/host-testbench.sh |grep -i fail
eqiir test failed!
./scripts/host-testbench.sh; echo $?
0

Expected behavior
Failures are not ignored and painted green.

Impact
Regression are never noticed.

Environment

  1. Branch name and commit hash of the 2 repositories: sof (firmware/topology) and linux (kernel driver).
    • SOF: master branch, HEAD=9915b803f73e
  2. Name of the topology file
    N/A
  3. Name of the platform(s) on which the bug is observed.
    • Platform: build system

Screenshots or console output

./scripts/host-testbench.sh |grep -i fail
eqiir test failed!
./scripts/host-testbench.sh; echo $?
0

Activity

  1. added
    bugSomething isn't working as expected
    on Apr 9, 2020
  2. marc-hb commented on Apr 10, 2020

    @marc-hb
    CollaboratorAuthor

    Reducing the default verbosity would also help IMHO.

  3. lgirdwood commented on Apr 16, 2020

    @lgirdwood
    Member

    @singalsu fyi - is this a quick fix for you ?

  4. singalsu commented on Apr 16, 2020

    @singalsu
    Collaborator

    @marc-hb @singalsu I have never used this script. I'll take a look but also it's an option to remove it from repository.

  5. lgirdwood commented on Apr 16, 2020

    @lgirdwood
    Member

    @singalsu I think CI uses this script then, @xiulipan can you confirm ?

  6. singalsu commented on Apr 16, 2020

    @singalsu
    Collaborator

    Yes, this has been recently updated by @xiulipan and it should be fixed to detect early fails too.

  7. xiulipan commented on Apr 17, 2020

    @xiulipan
    Contributor

    @lgirdwood @singalsu It seems the CI for the testbench works for few days before it get error again. I will try to fix it asap.

  8. marc-hb commented on Apr 17, 2020

    @marc-hb
    CollaboratorAuthor

    @lgirdwood @singalsu It seems the CI for the testbench works for few days before it get error again. I will try to fix it asap.

    I'm not sure what you meant here but I filed this bug very specifically about "green failures" = green failed test. Once all failures are red we can close this bug.

  9. changed the title [-][BUG] host-testbench.sh ignores errors[/-] [+][BUG] [GREEN FAILURES] host-testbench.sh ignores errors[/+] on Apr 17, 2020
  10. added a commit that references this issue on May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P2Critical bugs or normal featuresbugSomething isn't working as expectedgood first issueGood for newcomers

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions