[Fuego] [PATCH 05/19] unpack: move code related to spec-defined tarballs to unpack

Daniel Sangorrin daniel.sangorrin at toshiba.co.jp
Fri May 12 08:19:46 UTC 2017


Test specs can override the default tarball by specifying
a new one with tarball_name. This code should be inside unpack
for clarity.

Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
---
 engine/scripts/functions.sh | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/engine/scripts/functions.sh b/engine/scripts/functions.sh
index d9e0b18..9eae52b 100755
--- a/engine/scripts/functions.sh
+++ b/engine/scripts/functions.sh
@@ -38,6 +38,16 @@ set -o errtrace
 
 # Unpacks $tarball_path/$tarball into current directory.
 function unpack {
+    # the tarball name can be defined in the spec (tarball_name) or direclty
+    # in fuego_test.sh (tarball). Note that the one in the spec has preference.
+    upName=`echo "${TESTDIR^^}"| tr '.' '_'`
+    spec_tarball="${upName}_TARBALL_NAME"
+
+    if [ ! -z "${!spec_tarball}" ]; then
+        echo "Using $spec_tarball=${!spec_tarball} from test spec"
+        tarball=${!spec_tarball}
+    fi
+
     if [ ! -z ${tarball+x} ]; then
         case ${tarball/*./} in
             gz|tgz) key=z ;;
@@ -170,14 +180,6 @@ function build_error () {
 # Build scripts must call this function in the beginning.
 function pre_build {
   cd ${WORKSPACE}
-  upName=`echo "${JOB_NAME^^}"| tr '.' '_'`
-  spec_tarball="${upName}_TARBALL_NAME"
-
-  if [ ! -z "${!spec_tarball}" ]
-  then
-      echo "Using $spec_tarball=${!spec_tarball} from test spec"
-      tarball=${!spec_tarball}
-  fi
 
   mkdir -p $TRIPLET && cd $TRIPLET
   if concurrent_check; then
-- 
2.7.4




More information about the Fuego mailing list