xci: Log functest output before failure 03/53803/3
authorFatih Degirmenci <fdegir@gmail.com>
Wed, 14 Mar 2018 15:13:00 +0000 (16:13 +0100)
committerFatih Degirmenci <fdegir@gmail.com>
Wed, 14 Mar 2018 16:18:16 +0000 (17:18 +0100)
When functest fails, the job exits directly without us logging the
functest output to console. [1] Grepping functest log for FAIL for
determining the result helps us to cat the log before exiting with
right exit code.

[1] https://build.opnfv.org/ci/job/xci-verify-ubuntu-healthcheck-virtual-master/509/console

Change-Id: I01e3dcc51321e935b1722b749e8caf7ec5ad755b
Signed-off-by: Fatih Degirmenci <fdegir@gmail.com>
jjb/xci/xci-run-functest.sh

index 60b48cf..2e34363 100755 (executable)
@@ -7,9 +7,7 @@
 # which accompanies this distribution, and is available at
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
-set -o errexit
 set -o nounset
-set -o pipefail
 
 #----------------------------------------------------------------------
 # This script is used by CI and executed by Jenkins jobs.
@@ -58,3 +56,8 @@ echo "Functest log"
 echo "---------------------------------------------------------------------------------"
 ssh -F $HOME/.ssh/${DISTRO}-xci-vm-config ${DISTRO}_xci_vm_opnfv "cat /root/results/functest.log"
 echo "---------------------------------------------------------------------------------"
+# check the log to see if we have any error
+if ssh -F $HOME/.ssh/${DISTRO}-xci-vm-config ${DISTRO}_xci_vm_opnfv "grep -q 'FAIL' /root/results/functest.log"; then
+    echo "Error: Functest failed!"
+    exit 1
+fi