Fix: Update python environment to ROBOT3_VENV
[cps.git] / csit / run-csit.sh
index e23e84a..25f5f6a 100755 (executable)
 # $1 project/functionality
 # $2 robot options
 
-# Branched from integration/csit to this repository 18.2.2021
-#
+# Branched from ccsdk/distribution to this repository Feb 23, 2021
+
+WORKDIR=$(mktemp -d --suffix=-robot-workdir)
 
 #
 # functions
 #
 
+# wrapper for sourcing a file
+function source_safely() {
+    [ -z "$1" ] && return 1
+    relax_set
+    . "$1"
+    load_set
+}
+# Activate the virtualenv containing all the required libraries installed by prepare-csit.sh
+source_safely "${ROBOT3_VENV}/bin/activate"
+
 function on_exit(){
     rc=$?
     if [[ ${WORKSPACE} ]]; then
@@ -108,14 +119,6 @@ function relax_set() {
     set +o pipefail
 }
 
-# wrapper for sourcing a file
-function source_safely() {
-    [ -z "$1" ] && return 1
-    relax_set
-    . "$1"
-    load_set
-}
-
 #
 # main
 #
@@ -155,14 +158,11 @@ TESTPLANDIR="${WORKSPACE}/${TESTPLAN}"
 # Run installation of prerequired libraries
 source_safely "${WORKSPACE}/prepare-csit.sh"
 
-# Activate the virtualenv containing all the required libraries installed by prepare-csit.sh
-source_safely "${ROBOT_VENV}/bin/activate"
-
-WORKDIR=$(mktemp -d --suffix=-robot-workdir)
+# Use robot framework working directory
 cd "${WORKDIR}"
 
 # Add csit scripts to PATH
-export PATH="${PATH}:${WORKSPACE}/docker/scripts:${WORKSPACE}/scripts:${ROBOT_VENV}/bin"
+export PATH="${PATH}:${WORKSPACE}/docker/scripts:${WORKSPACE}/scripts:${ROBOT3_VENV}/bin"
 export SCRIPTS="${WORKSPACE}/scripts"
 export ROBOT_VARIABLES=
 
@@ -190,7 +190,7 @@ SUITES=$( xargs -a testplan.txt )
 echo ROBOT_VARIABLES="${ROBOT_VARIABLES}"
 echo "Starting Robot test suites ${SUITES} ..."
 relax_set
-python -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp ${ROBOT_VARIABLES} ${TESTOPTIONS} ${SUITES}
+python3 -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp ${ROBOT_VARIABLES} ${TESTOPTIONS} ${SUITES}
 RESULT=$?
 load_set
 echo "RESULT: $RESULT"