automated: linux: signaltest: parse: fix iteration parsing

If iterations > 1, the tests will be named 'iteration-<number>' where
number = iterations that was passed in, so all the other iterations will
be overwritten. mening if iterations=3, then it will look like this:

iteration-3-t0-min-latency: pass

And no iterations-1-* or iterations-2-*.

Solve this by manipulating a temporary file and extend the result file
with the temporary file.

Fixes: 2c35bc0d1494 ("automated: linux: signaltest: add iterations")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
diff --git a/automated/linux/signaltest/signaltest.sh b/automated/linux/signaltest/signaltest.sh
index 9069134..578527a 100755
--- a/automated/linux/signaltest/signaltest.sh
+++ b/automated/linux/signaltest/signaltest.sh
@@ -7,6 +7,7 @@
 OUTPUT="$(pwd)/output"
 LOGFILE="${OUTPUT}/signaltest"
 RESULT_FILE="${OUTPUT}/result.txt"
+TMP_RESULT_FILE="${OUTPUT}/tmp_result.txt"
 
 PRIORITY="98"
 THREADS="2"
@@ -55,9 +56,10 @@
 # Parse test log.
 for i in $(seq ${ITERATIONS}); do
     ../../lib/parse_rt_tests_results.py signaltest "${LOGFILE}-${i}.json" \
-        | tee "${RESULT_FILE}"
+        | tee "${TMP_RESULT_FILE}"
 
     if [ ${ITERATIONS} -ne 1 ]; then
-        sed -i "s|^|iteration-${i}-|g" "${RESULT_FILE}"
+        sed -i "s|^|iteration-${i}-|g" "${TMP_RESULT_FILE}"
     fi
+    cat "${TMP_RESULT_FILE}" | tee -a "${RESULT_FILE}"
 done