tests: bsim_bt tests: Fix malformed JUNIT results file
Fix the following issues regarding the JUNIT results file format (xml): The logger produces illegal xml characters in the text output => Ensure that any non-valid xml character is replaced with the valid xml scapes When GNU parallel is installed and a testcase fails, the xml output was malformed => Fixed it Also store in the Junit output the processes stderr Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
This commit is contained in:
parent
6e0f367396
commit
7593be7a3f
1 changed files with 11 additions and 6 deletions
|
@ -46,34 +46,39 @@ echo "Attempting to run ${N_CASES} cases (logging to \
|
||||||
|
|
||||||
chmod +x $ALL_CASES
|
chmod +x $ALL_CASES
|
||||||
|
|
||||||
|
export CLEAN_XML="sed -E -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g' \
|
||||||
|
-e 's/\"/"/g'"
|
||||||
|
|
||||||
echo -n "" > $TMP_RES_FILE
|
echo -n "" > $TMP_RES_FILE
|
||||||
|
|
||||||
if [ `command -v parallel` ]; then
|
if [ `command -v parallel` ]; then
|
||||||
parallel '
|
parallel '
|
||||||
echo "<testcase name=\"{}\" time=\"0\">";
|
echo "<testcase name=\"{}\" time=\"0\">";
|
||||||
{} $@ > {#}.log ;
|
{} $@ &> {#}.log ;
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
(>&2 echo -e "\e[91m{} FAILED\e[39m");
|
(>&2 echo -e "\e[91m{} FAILED\e[39m");
|
||||||
(>&2 cat {#}.log);
|
(>&2 cat {#}.log);
|
||||||
echo "<failure message=\"failed\" type=\"failure\">";
|
echo "<failure message=\"failed\" type=\"failure\">";
|
||||||
cat {#}.log ;
|
cat {#}.log | eval $CLEAN_XML;
|
||||||
echo "</failure>";
|
echo "</failure>";
|
||||||
|
rm {#}.log ;
|
||||||
|
echo "</testcase>";
|
||||||
exit 1;
|
exit 1;
|
||||||
else
|
else
|
||||||
(>&2 echo -e "{} PASSED");
|
(>&2 echo -e "{} PASSED");
|
||||||
|
rm {#}.log ;
|
||||||
|
echo "</testcase>";
|
||||||
fi;
|
fi;
|
||||||
rm {#}.log ;
|
|
||||||
echo "</testcase>";
|
|
||||||
' ::: $ALL_CASES >> $TMP_RES_FILE ; err=$?
|
' ::: $ALL_CASES >> $TMP_RES_FILE ; err=$?
|
||||||
else #fallback in case parallel is not installed
|
else #fallback in case parallel is not installed
|
||||||
for CASE in $ALL_CASES; do
|
for CASE in $ALL_CASES; do
|
||||||
echo "<testcase name=\"$CASE\" time=\"0\">" >> $TMP_RES_FILE
|
echo "<testcase name=\"$CASE\" time=\"0\">" >> $TMP_RES_FILE
|
||||||
$CASE $@ > $i.log
|
$CASE $@ &> $i.log
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo -e "\e[91m$CASE FAILED\e[39m"
|
echo -e "\e[91m$CASE FAILED\e[39m"
|
||||||
cat $i.log
|
cat $i.log
|
||||||
echo "<failure message=\"failed\" type=\"failure\">" >> $TMP_RES_FILE
|
echo "<failure message=\"failed\" type=\"failure\">" >> $TMP_RES_FILE
|
||||||
cat $i.log >> $TMP_RES_FILE
|
cat $i.log | eval $CLEAN_XML >> $TMP_RES_FILE
|
||||||
echo "</failure>" >> $TMP_RES_FILE
|
echo "</failure>" >> $TMP_RES_FILE
|
||||||
let "err++"
|
let "err++"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue