Fix: Update python environment to ROBOT3_VENV
[cps.git] / csit / run-csit.sh
index f291e34..25f5f6a 100755 (executable)
 
 # Branched from ccsdk/distribution to this repository Feb 23, 2021
 
-# Activate the virtualenv containing all the required libraries installed by prepare-csit.sh
-source_safely "${ROBOT3_VENV}/bin/activate"
-
 WORKDIR=$(mktemp -d --suffix=-robot-workdir)
-cd "${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
@@ -113,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
 #
@@ -160,6 +158,9 @@ TESTPLANDIR="${WORKSPACE}/${TESTPLAN}"
 # Run installation of prerequired libraries
 source_safely "${WORKSPACE}/prepare-csit.sh"
 
+# Use robot framework working directory
+cd "${WORKDIR}"
+
 # Add csit scripts to PATH
 export PATH="${PATH}:${WORKSPACE}/docker/scripts:${WORKSPACE}/scripts:${ROBOT3_VENV}/bin"
 export SCRIPTS="${WORKSPACE}/scripts"