Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tools: Test: Audio: Mitigate trace flood in process_test.m #9403

Merged

Conversation

singalsu
Copy link
Collaborator

The verbose test trace flood slows down the test to near unusable test times due to a lot of text printed to Octave console. As result also the SOF CI logs become large.

This patch adds redirect of testbench trace into a temporary file instead of standard output in process_test.m. The trace content is printed in comp_run.sh to console only if there has been an error. To prevent growing /tmp the trace file is deleted after test run and possible print to console.

@singalsu singalsu marked this pull request as ready for review August 23, 2024 15:25
@singalsu singalsu requested a review from marc-hb as a code owner August 23, 2024 15:25
cat "$FN_TRACE"
echo ----------------------------------------------------------
exit $RETVAL
fi
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized I should to restore set -e after this error handling code. With run success there's still possibly something that could (green) fail.

Copy link
Collaborator

@marc-hb marc-hb Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's how you should be able to kill all birds with one stone:

else
   $VALGRIND_CMD $CMD 2> "$FN_TRACE" || {
      local ret=$?
      echo ----------------------------------------------------------
      cat "$FN_TRACE"
      echo ----------------------------------------------------------
      return $ret # "exit" would be for something unexpected and catastrophic,
                  # not for a "regular" test failure
    }

No need for set -e.

I just realized I should to restore set -e after this error handling code.

You should never invoke set -e to "restore" the previous state because you may not know what this previous state was. It should always be possible to disable it globally at the top. Instead, disable errexit in a subshell (but NOT needed here):

    ( set +e
       # code running
       # without set -e
    )

This restores the previous -e state on subshell exit, WHICHEVER that state was in the first place.

This also restores the previous state wherever you exit the subshell from.

The only subshell drawback is the inability for the subshell to change parent variables or other side effect.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I used he above code version, it works correctly for a FW error return and a valgrind issue those I tried to insert to code.

@marc-hb marc-hb marked this pull request as draft August 24, 2024 00:27
@marc-hb
Copy link
Collaborator

marc-hb commented Aug 24, 2024

Converting to draft to avoid merge while work is still in progress.

The verbose test trace flood slows down the test to near
unusable test times due to a lot of text printed to Octave
console. As result also the SOF CI logs become large.

This patch adds redirect of testbench trace into a temporary
file instead of standard output in process_test.m. The trace
content is printed in comp_run.sh to console only if there has
been an error. To prevent growing /tmp the trace file is
deleted after test run and possible print to console.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu singalsu force-pushed the process_test_mitigate_trace_flood branch from d5b1459 to 27dfdd3 Compare August 26, 2024 09:11
@singalsu singalsu marked this pull request as ready for review August 26, 2024 09:14
cat "$FN_TRACE"
echo ----------------------------------------------------------
return $ret # "exit" would be for something unexpected and catastrophic,
# not for a "regular" test failure
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These comments were for you, not for the final version :-) A bit verbose now but OK

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it fits there :)

@kv2019i kv2019i merged commit ad85184 into thesofproject:main Aug 27, 2024
43 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants