diff options
author | emaclee <lee.anjella.macabuhay@est.tech> | 2024-01-18 12:44:58 +0000 |
---|---|---|
committer | Lee Anjella Macabuhay <lee.anjella.macabuhay@est.tech> | 2024-01-22 11:06:56 +0000 |
commit | 75d07eaed2cd208e90b01919eb158a97a577d306 (patch) | |
tree | c6592b5513b1142c8ce499ec734366ee097dc31d /csit/run-csit.sh | |
parent | ed3e30d9b54cf19f44c743650eb316bc3ca0575a (diff) |
Update relevant robot scripts in DMI CSITs
Issue-ID: CPS-2032
Change-Id: I9f7f1e9078612434d07efeb9dadeb65d2f5acc48
Signed-off-by: emaclee <lee.anjella.macabuhay@est.tech>
Diffstat (limited to 'csit/run-csit.sh')
-rwxr-xr-x | csit/run-csit.sh | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/csit/run-csit.sh b/csit/run-csit.sh index b5d7e0dd..4a618505 100755 --- a/csit/run-csit.sh +++ b/csit/run-csit.sh @@ -20,10 +20,39 @@ # # Branched from ccsdk/distribution to this repository Feb 23, 2021 +echo "---> run-csit.sh" + +WORKDIR=$(mktemp -d --suffix=-robot-workdir) + +# Version should match those used to setup robot-framework in other jobs/stages +# Use pyenv for selecting the python version +if [[ -d "/opt/pyenv" ]]; then + echo "Setup pyenv:" + export PYENV_ROOT="/opt/pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" + pyenv versions + if command -v pyenv 1>/dev/null 2>&1; then + eval "$(pyenv init - --no-rehash)" + # Choose the latest numeric Python version from installed list + version=$(pyenv versions --bare | sed '/^[^0-9]/d' | sort -V | tail -n 1) + pyenv local "${version}" + fi +fi + # # 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 @@ -107,14 +136,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 # @@ -154,14 +175,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= @@ -189,7 +207,13 @@ SUITES=$( xargs -a testplan.txt ) echo ROBOT_VARIABLES="${ROBOT_VARIABLES}" echo "Starting Robot test suites ${SUITES} ..." relax_set -python3 -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp ${ROBOT_VARIABLES} ${TESTOPTIONS} ${SUITES} + +echo "Versioning information:" +python3 --version +pip freeze +python3 -m robot.run --version || : + +python3 -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp --legacy-output ${ROBOT_VARIABLES} ${TESTOPTIONS} ${SUITES} RESULT=$? load_set echo "RESULT: $RESULT" |