summaryrefslogtreecommitdiffstats
path: root/src/build/citest
diff options
context:
space:
mode:
authorRoland Veloz <rveloz@us.ibm.com>2018-01-04 19:42:23 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-01-16 11:33:24 -0500
commitdfb142acec4374e23a3de5fd45b232b8acd6403b (patch)
treecb6b67b0dc911dc8e5ca744736a4652cf6d363b5 /src/build/citest
parent1e973575493db7b15d6cd36613034e3ea17ca900 (diff)
downloadtalos-hostboot-dfb142acec4374e23a3de5fd45b232b8acd6403b.tar.gz
talos-hostboot-dfb142acec4374e23a3de5fd45b232b8acd6403b.zip
Corrected issue with hb errlparser not exiting on error
The code was doing a lot of negative one returns and exits when it should be passing values from 0 - 255 (0 being success and 1 to 255 indicating failure.) Also, why return a different error when you have a perfectly good error code already there. So I return the current error code. Change-Id: I485e6abcfded39ad8121de109f16e587c53f1f81 CQ: SW326835 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/51507 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Elizabeth K. Liner <eliner@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/build/citest')
-rwxr-xr-xsrc/build/citest/build-errl-parsers28
-rwxr-xr-xsrc/build/citest/setup-env17
2 files changed, 31 insertions, 14 deletions
diff --git a/src/build/citest/build-errl-parsers b/src/build/citest/build-errl-parsers
index 754b180ff..cda1a30f2 100755
--- a/src/build/citest/build-errl-parsers
+++ b/src/build/citest/build-errl-parsers
@@ -6,7 +6,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2014,2015
+# Contributors Listed Below - COPYRIGHT 2014,2018
# [+] International Business Machines Corp.
#
#
@@ -37,23 +37,29 @@ then
exit -1
fi
+# If return code is not 0 (indicating failure),
+# then perpetuate the return code up the call chain.
+# For sh/bash, should use 0 for success and 1 to 255 for failures, don't use
+# negative numbers (-1). A negative number will be interpreted as a
+# positive number (-1 will become 255.)
+
echo "----Creating directories"
-mkdir -p ${SANDBOXBASE}/src/srci || exit -1
-mkdir -p ${SANDBOXBASE}/src/errl || exit -1
+mkdir -p ${SANDBOXBASE}/src/srci || exit $?
+mkdir -p ${SANDBOXBASE}/src/errl || exit $?
echo "----Building hbfw"
-execute_in_sandbox "cd ${SANDBOXBASE}/src/hbfw && mk -a -j32" "x86.nfp"
-if [ $? -ne 0 ]; then exit -1; fi
+execute_in_sandbox "cd ${SANDBOXBASE}/src/hbfw && mk -a -j32" "x86.nfp" \
+ || exit $?
echo "----Building srci"
-execute_in_sandbox "cd ${SANDBOXBASE}/src/srci && mk -a -j32" "x86.nfp"
-if [ $? -ne 0 ]; then exit -1; fi
+execute_in_sandbox "cd ${SANDBOXBASE}/src/srci && mk -a -j32" "x86.nfp" \
+ || exit $?
echo "----Building errl"
-execute_in_sandbox "cd ${SANDBOXBASE}/src/errl && mk -a -j32" "x86.nfp"
-if [ $? -ne 0 ]; then exit -1; fi
+execute_in_sandbox "cd ${SANDBOXBASE}/src/errl && mk -a -j32" "x86.nfp" \
+ || exit $?
echo "----Extracting errl tool"
-mkdir -p ${SANDBOXBASE}/simics || exit -1
+mkdir -p ${SANDBOXBASE}/simics || exit $?
tar -xvf ${SANDBOXBASE}/obj/x86.nfp/errl/nfp/tool/errl.tar \
- -C ${SANDBOXBASE}/simics errl || exit -1
+ -C ${SANDBOXBASE}/simics errl || exit $?
diff --git a/src/build/citest/setup-env b/src/build/citest/setup-env
index 36224845c..904101ad1 100755
--- a/src/build/citest/setup-env
+++ b/src/build/citest/setup-env
@@ -6,7 +6,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2014,2016
+# Contributors Listed Below - COPYRIGHT 2014,2018
# [+] International Business Machines Corp.
#
#
@@ -71,12 +71,23 @@ execute_in_sandbox()
${WORKON_CMD} -c ./sandbox_execute_cmd
- if [ $? -ne 0 ]; then
+ # capture the return code from previous command
+ rc=$?
+
+ # If return code is not 0 (indicating failure), do some
+ # cleanup and perpetuate the return code up the call chain.
+ # For sh/bash, should use 0 for success and 1 to 255 for failures, don't use
+ # negative numbers (-1). The shell interprets the '-' as an option
+ # for the return command. If you insist on using negative numbers
+ # do '-- -<n>' to use the negative number, however it will be interpreted
+ # as a positive number (-1 will become 255.)
+ if [ $rc -ne 0 ]; then
rm ${SANDBOXBASE}/src/sandbox_execute_cmd
- return -1
+ return $rc
fi
rm ${SANDBOXBASE}/src/sandbox_execute_cmd
+ return 0;
}
export -f execute_in_sandbox
OpenPOWER on IntegriCloud