generate_xml.sh: Replace < and > in error message

Replace < with &lt; and > with &gt; in ERRS to not broke created xml.

Signed-off-by: stefan.raus <stefan.raus@analog.com>
main
stefan.raus 2021-11-03 13:06:49 +00:00 committed by SRaus
parent bcf5abb2fe
commit 3c07861ee8
1 changed files with 2 additions and 0 deletions

View File

@ -26,6 +26,8 @@ echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>" > $xmlFile
echo -e "<testsuite>" >> $xmlFile echo -e "<testsuite>" >> $xmlFile
echo -e "\t<testcase name=\"${NAME}\" time=\"${DURATION}\" classname=\"component_tb\">" >> $xmlFile echo -e "\t<testcase name=\"${NAME}\" time=\"${DURATION}\" classname=\"component_tb\">" >> $xmlFile
if [[ "$ERRS" ]]; then if [[ "$ERRS" ]]; then
#replace < with &lt; and > with &gt; in ERRS to not broke created xml
ERRS=$(echo $ERRS | sed 's/</&lt;/g' | sed 's/>/&gt;/g')
echo -e "\t\t<failure>\n\"$ERRS\"\n\t\t</failure>" >> $xmlFile echo -e "\t\t<failure>\n\"$ERRS\"\n\t\t</failure>" >> $xmlFile
elif [[ "$SUCCESS" ]]; then elif [[ "$SUCCESS" ]]; then
echo -e "\t\t<passed/>" >> $xmlFile echo -e "\t\t<passed/>" >> $xmlFile