tf-a-builder: log-splitter.py publish the plain log while error happens

Copy the plain log to lava-raw-debug.log and publish it for
investigation while error happens.

Signed-off-by: Arthur She <arthur.she@linaro.org>
Change-Id: If618173c65dff0eb6a910713e8f4ef315804dd32
diff --git a/tf-a-builder/log-splitter.py b/tf-a-builder/log-splitter.py
index 5a9c90f..b5a4970 100755
--- a/tf-a-builder/log-splitter.py
+++ b/tf-a-builder/log-splitter.py
@@ -8,6 +8,7 @@
 import os
 import sys
 import yaml
+from shutil import copyfile
 
 """
 The whole messages will go into 'lava.log' and if there are 'feedback' level message,
@@ -62,6 +63,8 @@
                         str(exc.problem))
             else:
                 print ("Something went wrong while parsing yaml file")
+            # Preserve plain_log for debugging
+            copyfile(plain_log, des_dir+"/lava-raw-debug.log")
             sys.exit(1)
         try:
             full_test_log = "{}/{}".format(des_dir, separated_log_file["all"])
diff --git a/tf-a-builder/squad.sh b/tf-a-builder/squad.sh
index c6cf828..c4069c1 100755
--- a/tf-a-builder/squad.sh
+++ b/tf-a-builder/squad.sh
@@ -112,8 +112,6 @@
 
                 # Split the UART messages to the corresponding log files
                 ${WORKSPACE}/tf-a-job-configs/tf-a-builder/log-splitter.py "${WORKSPACE}/lava-raw.log"
-                # If there is something wrong with the log file, publish the raw log for investigation
-                [ $? -ne 0 ] && mv "${WORKSPACE}/lava-raw.log" "${WORKSPACE}/lava-raw-debug.log" && exit 1
 
                 # Fetch and store LAVA job result (1 failure, 0 success)
                 resilient_cmd lavacli jobs show ${LAVAJOB_ID} | tee "${WORKSPACE}/lava.show"