From 120369a6a0e8122e4cf8ffa562d7427d4776e8a4 Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Mon, 22 Feb 2016 16:15:09 +0100
Subject: [PATCH] better logging in autotests

---
 cmake_targets/autotests/run_compilation_autotests.bash | 6 +++---
 cmake_targets/tools/test_helper                        | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cmake_targets/autotests/run_compilation_autotests.bash b/cmake_targets/autotests/run_compilation_autotests.bash
index afe7aa4873..a7b056dc81 100755
--- a/cmake_targets/autotests/run_compilation_autotests.bash
+++ b/cmake_targets/autotests/run_compilation_autotests.bash
@@ -20,7 +20,7 @@ test_compile() {
     compile_prog=$2
     exec_prog=$3
     build_dir=$tdir/$1/build
-    log_file=$tdir/log/test.$1.txt
+    log_file=$tdir/log/test.$1.$2.$5.txt
     target=$5
     echo "Compiling test case $test_name. Log file = $log_file"
     rm -fr $build_dir
@@ -34,10 +34,10 @@ test_compile() {
     if [ -s $exec_prog ] ; then
         cp $exec_prog $tdir/bin/`basename $exec_prog`.$target.$test_name
         echo_success "$test_name $exec_prog $target compiled"
-        xUnit_success "compilation" $test_name "PASS" 1
+        xUnit_success "compilation" $test_name "PASS" 1 "$results_file"
     else
         echo_error "$test_name $exec_prog $target compilation failed"
-        xUnit_fail "compilation" $test_name "FAIL" 1
+        xUnit_fail "compilation" $test_name "FAIL" 1 "$results_file"
     fi
 }
 
diff --git a/cmake_targets/tools/test_helper b/cmake_targets/tools/test_helper
index 49a9910573..cae0bacbe0 100644
--- a/cmake_targets/tools/test_helper
+++ b/cmake_targets/tools/test_helper
@@ -35,7 +35,7 @@ xUnit_fail() {
   currtime=$(date +%s.%N)
   time=$(echo "$currtime - $XUNIT_START" | bc -l)
   xml="<testcase classname='$class' name='$test_case' Run_result='$run_result' time='$time s' RESULT='$result'></testcase>"
-  echo  -e $xml >> $xmlfile_testcase
+  echo  -e "$xml" >> "$xmlfile_testcase"
   XUNIT_TESTCASES_XML="$XUNIT_TESTCASES_XML \n$xml"
   XUNIT_FAILED=$((XUNIT_FAILED+1))
 }
-- 
2.26.2