From b30de97c35cbe00ef5565fbde40851eda906ff8e Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Tue, 11 Nov 2014 11:43:11 -0500 Subject: [PATCH] tests: add `xmlesc` to escape XML in generated XML reports. Signed-off-by: Jean Privat --- tests/tests.sh | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/tests/tests.sh b/tests/tests.sh index f488b1f..e02eef2 100755 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -146,6 +146,13 @@ function compare_to_result() fi } +function xmlesc() +{ + sed 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g'<>$xml "" + echo >>$xml "" #for sav in "sav/$engine/fixme/$pattern.res" "sav/$engine/$pattern.res" "sav/fixme/$pattern.res" "sav/$pattern.res" "sav/$pattern.sav"; do for savdir in $savdirs; do sav=$savdir/fixme/$pattern.res @@ -225,7 +232,7 @@ function process_result() if [ -n "$SAV" ]; then if [ -n "$OLD" ]; then echo "[*ok*] $outdir/$pattern.res $SAV - but $OLD remains!" - echo >>$xml "" + echo >>$xml "" remains="$remains $OLD" else echo "[ok] $outdir/$pattern.res $SAV" @@ -234,7 +241,7 @@ function process_result() elif [ -n "$FIXME" ]; then if [ -n "$OLD" ]; then echo "[*fixme*] $outdir/$pattern.res $FIXME - but $OLD remains!" - echo >>$xml "" + echo >>$xml "" remains="$remains $OLD" else echo "[fixme] $outdir/$pattern.res $FIXME" @@ -247,7 +254,7 @@ function process_result() todos="$todos $pattern" elif [ -n "$SOSO" ]; then echo "[======= soso $outdir/$pattern.res $SOSO =======]" - echo >>$xml "" + echo >>$xml "" echo >>$xml ">$xml -n 50 echo >>$xml "]]>" @@ -255,7 +262,7 @@ function process_result() echo "$ii" >> "$ERRLIST" elif [ -n "$SOSOF" ]; then echo "[======= fixme soso $outdir/$pattern.res $SOSOF =======]" - echo >>$xml "" + echo >>$xml "" echo >>$xml ">$xml -n 50 echo >>$xml "]]>" @@ -263,7 +270,7 @@ function process_result() echo "$ii" >> "$ERRLIST" elif [ -n "$NSAV" ]; then echo "[======= fail $outdir/$pattern.res $NSAV =======]" - echo >>$xml "" + echo >>$xml "" echo >>$xml ">$xml -n 50 echo >>$xml "]]>" @@ -271,7 +278,7 @@ function process_result() echo "$ii" >> "$ERRLIST" elif [ -n "$NFIXME" ]; then echo "[======= changed $outdir/$pattern.res $NFIXME ======]" - echo >>$xml "" + echo >>$xml "" echo >>$xml ">$xml -n 50 echo >>$xml "]]>" @@ -303,12 +310,12 @@ need_skip() test "$noskip" = true && return 1 if echo "$1" | grep -f "$engine.skip" >/dev/null 2>&1; then echo "=> $2: [skip]" - echo >>$xml "" + echo >>$xml "" return 0 fi if test -n "$isinterpret" && echo "$1" | grep -f "exec.skip" >/dev/null 2>&1; then echo "=> $2: [skip exec]" - echo >>$xml "" + echo >>$xml "" return 0 fi return 1 @@ -538,7 +545,7 @@ END chmod +x "$ff.bin" if grep "Fatal Error: more than one primitive class" "$ff.compile.log" > /dev/null; then echo " [skip] do no not imports kernel" - echo >>$xml "" + echo >>$xml "" continue fi fi -- 1.7.9.5