Skip to content
Snippets Groups Projects

run-hap-test.sh: Fix erroneously reporting PASS on actual test FAILURE

Merged Robert Drab requested to merge feat/initial-scripts into main
1 file
+ 15
5
Compare changes
  • Side-by-side
  • Inline
+ 15
5
@@ -76,14 +76,24 @@ run_hap_test() (
# Wait for results only if ability started successfully
# Below hilog call should be refined with some filtering (JSApp?)
# and not just blindly catch all the logs
TESTCASE_REPORT=$(timeout "$TIMEOUT_S" hdc shell hilog) || true
TESTCASE_LOG=$(timeout "$TIMEOUT_S" hdc shell hilog) || true
fi
hdc uninstall "$PACKAGE_NAME"
} 1>&2
TESTCASES_PASS=$(echo "$TESTCASE_REPORT" | grep -Eo "\[pass\]" | wc -l)
# This is temporary workaround the fact that test suite exits upon first failure
# without producing the summary
echo "total cases:0;failure 0,error 0,pass $TESTCASES_PASS"
TESTCASE_REPORT=$(echo "$TESTCASE_LOG" | grep -Eo -m 1 "total cases.*") || true
TESTCASES_PASS=$(echo "$TESTCASE_LOG" | grep -Ec "\[pass\]") || true
# Return failure if TESTCASE_REPORT is empty
if test -n "$TESTCASE_REPORT"; then
echo "$TESTCASE_REPORT"
else
# This is temporary workaround of the fact that test suite exits upon
# first failure without producing the summary
if test "$TESTCASES_PASS" -gt 0; then
echo "total cases:0;failure 1,error 0,pass $TESTCASES_PASS"
fi
return 1
fi
)
TIMEOUT=0
Loading