Some rv userspace selftests rely on the pid of the rv process to match
with the output and fail prematurely in case the pid was not found.
If the rv process failed, however, it's likely it will terminate before
catching the pid, and the test reports empty pid ignoring the error that
caused the process to fail.

Report empty pid only when the rv process succeeds (exit code not what
was expected) and continue showing exit code and output otherwise.

Signed-off-by: Gabriele Monaco <[email protected]>
---
 tools/verification/tests/engine.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/verification/tests/engine.sh 
b/tools/verification/tests/engine.sh
index cfdf2180aad8..4dad43b0b822 100644
--- a/tools/verification/tests/engine.sh
+++ b/tools/verification/tests/engine.sh
@@ -60,8 +60,9 @@ _check() {
        failbuf=''
        fail=0
 
-       # Suppress any other error if a needed pid is empty
-       if [ -z "$pid" ] && grep -q "\$pid" <<< "$patterns"; then
+       # Suppress any other error if a needed pid is empty and there was no 
other error
+       if [ -z "$pid" ] && grep -q "\$pid" <<< "$patterns" \
+               && [ $exitcode -eq "$expected_exitcode" ]; then
                result=''
                failure "# Empty pid for $command"
                return 1
-- 
2.55.0


Reply via email to