From fd819cd0999ea237bc73f71db1eea4be23b62b7c Mon Sep 17 00:00:00 2001 From: andrejtonev <29177572+andrejtonev@users.noreply.github.com> Date: Tue, 1 Aug 2023 17:13:47 +0200 Subject: [PATCH] Add custom e2e test activation to include the toolchain libs (#1130) --- .github/workflows/diff.yaml | 4 +-- .github/workflows/release_centos8.yaml | 4 +-- .github/workflows/release_debian10.yaml | 4 +-- .github/workflows/release_ubuntu2004.yaml | 4 +-- tests/setup.sh | 43 +++++++++++++++++++++++ 5 files changed, 51 insertions(+), 8 deletions(-) diff --git a/.github/workflows/diff.yaml b/.github/workflows/diff.yaml index 1b8e36810..7746ddb91 100644 --- a/.github/workflows/diff.yaml +++ b/.github/workflows/diff.yaml @@ -267,8 +267,8 @@ jobs: - name: Run e2e tests run: | cd tests - ./setup.sh - source ve3/bin/activate + ./setup.sh /opt/toolchain-v4/activate + source ve3/bin/activate_e2e cd e2e ./run.sh diff --git a/.github/workflows/release_centos8.yaml b/.github/workflows/release_centos8.yaml index 7096809e7..acf2cb813 100644 --- a/.github/workflows/release_centos8.yaml +++ b/.github/workflows/release_centos8.yaml @@ -266,8 +266,8 @@ jobs: - name: Run e2e tests run: | cd tests - ./setup.sh - source ve3/bin/activate + ./setup.sh /opt/toolchain-v4/activate + source ve3/bin/activate_e2e cd e2e ./run.sh diff --git a/.github/workflows/release_debian10.yaml b/.github/workflows/release_debian10.yaml index b2c514630..28c8c1026 100644 --- a/.github/workflows/release_debian10.yaml +++ b/.github/workflows/release_debian10.yaml @@ -265,8 +265,8 @@ jobs: - name: Run e2e tests run: | cd tests - ./setup.sh - source ve3/bin/activate + ./setup.sh /opt/toolchain-v4/activate + source ve3/bin/activate_e2e cd e2e ./run.sh diff --git a/.github/workflows/release_ubuntu2004.yaml b/.github/workflows/release_ubuntu2004.yaml index 735d4d81c..fd1f76463 100644 --- a/.github/workflows/release_ubuntu2004.yaml +++ b/.github/workflows/release_ubuntu2004.yaml @@ -265,8 +265,8 @@ jobs: - name: Run e2e tests run: | cd tests - ./setup.sh - source ve3/bin/activate + ./setup.sh /opt/toolchain-v4/activate + source ve3/bin/activate_e2e cd e2e ./run.sh diff --git a/tests/setup.sh b/tests/setup.sh index 9c1e7d20c..c4b2ceb10 100755 --- a/tests/setup.sh +++ b/tests/setup.sh @@ -49,3 +49,46 @@ popd > /dev/null deactivate "$DIR"/e2e/graphql/setup.sh + +# Check if setup needs to setup additional variables +if [ $# == 1 ]; then + toolchain=$1 + if [ -f "$toolchain" ]; then + # Get the LD_LIB from toolchain + set +u + OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH + source $toolchain + NEW_LD_LIBRARY_PATH=$LD_LIBRARY_PATH + deactivate + set -u + + # Wrapper used to setup the correct libraries + tee -a ve3/bin/activate_e2e <<EOF +#!/bin/bash + +# Function to set the environment variable +set_env_variable() { + export LD_LIBRARY_PATH=$NEW_LD_LIBRARY_PATH +} + +# Function to activate the virtual environment and set the environment variable +activate_e2e() { + source ve3/bin/activate + set_env_variable +} + +# Function to deactivate the virtual environment and unset the environment variable +deactivate_e2e() { + deactivate + export LD_LIBRARY_PATH=$OLD_LD_LIBRARY_PATH +} + +# Activate the virtual environment and set the environment variable +activate_e2e +EOF + + chmod +x ve3/bin/activate_e2e + else + echo "Error: The toolchain virtual enviroonment activation is not a file." + fi +fi