Skip to content

Commit 8b234f4

Browse files
Update test scripts to receive absolute paths
1 parent 40a6e42 commit 8b234f4

File tree

6 files changed

+19
-28
lines changed

6 files changed

+19
-28
lines changed

test_scripts/run_conformance_tests_cypress.sh

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,12 @@ if [[ "$3" == "-v" || "$3" == "--verbose" ]]; then
8989
VERBOSE=1
9090
fi
9191

92-
current_dir=$(pwd)
93-
9492
# Ensures that if any command in the pipeline fails (like npm run build), the entire pipeline
9593
# will return a non-zero status, allowing the if condition to properly catch failures.
9694
set -o pipefail
9795

9896
# Define the path to the subfolder
99-
NODE_SUBFOLDER=node_$1
97+
NODE_SUBFOLDER=$(dirname "$1")/node_$(basename "$1")
10098

10199
# Running React application
102100
printf "### Step 1: Starting the React application in folder $NODE_SUBFOLDER...\n"
@@ -121,7 +119,7 @@ else
121119
mkdir -p $NODE_SUBFOLDER
122120
fi
123121

124-
cp -R $1/* $NODE_SUBFOLDER
122+
cp -R "$1"/* $NODE_SUBFOLDER
125123

126124
# Move to the subfolder
127125
cd "$NODE_SUBFOLDER" 2>/dev/null
@@ -202,11 +200,8 @@ fi
202200
# Execute all Cypress conformance tests in the build folder
203201
printf "### Step 2: Running Cypress conformance tests $2...\n"
204202

205-
# Move back to the original directory
206-
cd $current_dir
207-
208203
# Define the path to the conformance tests subfolder
209-
NODE_CONFORMANCE_TESTS_SUBFOLDER=node_$2
204+
NODE_CONFORMANCE_TESTS_SUBFOLDER=$(dirname "$2")/node_$(basename "$2")
210205

211206
if [ "${VERBOSE:-}" -eq 1 ] 2>/dev/null; then
212207
printf "Preparing conformance tests Node subfolder: $NODE_CONFORMANCE_TESTS_SUBFOLDER\n"
@@ -228,7 +223,7 @@ else
228223
mkdir -p $NODE_CONFORMANCE_TESTS_SUBFOLDER
229224
fi
230225

231-
cp -R $2/* $NODE_CONFORMANCE_TESTS_SUBFOLDER
226+
cp -R "$2"/* $NODE_CONFORMANCE_TESTS_SUBFOLDER
232227

233228
# Move to the subfolder with Cypress tests
234229
cd "$NODE_CONFORMANCE_TESTS_SUBFOLDER" 2>/dev/null

test_scripts/run_conformance_tests_golang.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ if [ -z "$2" ]; then
1616
exit $UNRECOVERABLE_ERROR_EXIT_CODE
1717
fi
1818

19-
current_dir=$(pwd)
20-
21-
GO_BUILD_SUBFOLDER=go_$1
19+
GO_BUILD_SUBFOLDER=$(dirname "$1")/go_$(basename "$1")
2220

2321
if [ "${VERBOSE:-}" -eq 1 ] 2>/dev/null; then
2422
printf "Preparing Go build subfolder: $GO_BUILD_SUBFOLDER\n"
@@ -40,7 +38,7 @@ else
4038
mkdir -p $GO_BUILD_SUBFOLDER
4139
fi
4240

43-
cp -R $1/* $GO_BUILD_SUBFOLDER
41+
cp -R "$1"/* $GO_BUILD_SUBFOLDER
4442

4543
# Move to the subfolder
4644
cd "$GO_BUILD_SUBFOLDER" 2>/dev/null
@@ -53,10 +51,10 @@ fi
5351
echo "Runinng go get in the build folder..."
5452
go get
5553

56-
cd "$current_dir/$2" 2>/dev/null
54+
cd "$2" 2>/dev/null
5755

5856
if [ $? -ne 0 ]; then
59-
printf "Error: Conformance tests folder '$current_dir/$2' does not exist.\n"
57+
printf "Error: Conformance tests folder '$2' does not exist.\n"
6058
exit $UNRECOVERABLE_ERROR_EXIT_CODE
6159
fi
6260

@@ -69,12 +67,12 @@ else
6967
fi
7068

7169
# Move back to build directory
72-
cd "$current_dir/$GO_BUILD_SUBFOLDER" 2>/dev/null
70+
cd "$GO_BUILD_SUBFOLDER" 2>/dev/null
7371

7472
# Execute Go lang conformance tests
7573
printf "Running Golang conformance tests...\n\n"
7674

77-
output=$(go run $current_dir/$2/conformance_tests.go 2>&1)
75+
output=$(go run "$2"/conformance_tests.go 2>&1)
7876
exit_code=$?
7977

8078
# If there was an error, print the output and exit with the error code

test_scripts/run_conformance_tests_python.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ else
2626
exit $UNRECOVERABLE_ERROR_EXIT_CODE
2727
fi
2828

29-
current_dir=$(pwd)
30-
31-
PYTHON_BUILD_SUBFOLDER=python_$1
29+
PYTHON_BUILD_SUBFOLDER=$(dirname "$1")/python_$(basename "$1")
3230

3331
if [ "${VERBOSE:-}" -eq 1 ] 2>/dev/null; then
3432
printf "Preparing Python build subfolder: $PYTHON_BUILD_SUBFOLDER\n"
@@ -50,7 +48,7 @@ else
5048
mkdir -p $PYTHON_BUILD_SUBFOLDER
5149
fi
5250

53-
cp -R $1/* $PYTHON_BUILD_SUBFOLDER
51+
cp -R "$1"/* $PYTHON_BUILD_SUBFOLDER
5452

5553
# Move to the subfolder
5654
cd "$PYTHON_BUILD_SUBFOLDER" 2>/dev/null
@@ -63,7 +61,7 @@ fi
6361
# Execute all Python conformance tests in the build folder
6462
printf "Running Python conformance tests...\n\n"
6563

66-
output=$($PYTHON_CMD -m unittest discover -b -s "$current_dir/$2" 2>&1)
64+
output=$($PYTHON_CMD -m unittest discover -b -s "$2" 2>&1)
6765
exit_code=$?
6866

6967
# Echo the original output

test_scripts/run_unittests_golang.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if [ -z "$1" ]; then
99
exit $UNRECOVERABLE_ERROR_EXIT_CODE
1010
fi
1111

12-
GO_BUILD_SUBFOLDER=go_$1
12+
GO_BUILD_SUBFOLDER=$(dirname "$1")/go_$(basename "$1")
1313

1414
if [ "${VERBOSE:-}" -eq 1 ] 2>/dev/null; then
1515
printf "Preparing Go build subfolder: $GO_BUILD_SUBFOLDER\n"
@@ -31,7 +31,7 @@ else
3131
mkdir -p $GO_BUILD_SUBFOLDER
3232
fi
3333

34-
cp -R $1/* $GO_BUILD_SUBFOLDER
34+
cp -R "$1"/* $GO_BUILD_SUBFOLDER
3535

3636
# Move to the subfolder
3737
cd "$GO_BUILD_SUBFOLDER" 2>/dev/null

test_scripts/run_unittests_python.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ else
1919
exit $UNRECOVERABLE_ERROR_EXIT_CODE
2020
fi
2121

22-
PYTHON_BUILD_SUBFOLDER=python_$1
22+
PYTHON_BUILD_SUBFOLDER=$(dirname "$1")/python_$(basename "$1")
2323

2424
if [ "${VERBOSE:-}" -eq 1 ] 2>/dev/null; then
2525
printf "Preparing Python build subfolder: $PYTHON_BUILD_SUBFOLDER\n"
@@ -41,7 +41,7 @@ else
4141
mkdir -p $PYTHON_BUILD_SUBFOLDER
4242
fi
4343

44-
cp -R $1/* $PYTHON_BUILD_SUBFOLDER
44+
cp -R "$1"/* $PYTHON_BUILD_SUBFOLDER
4545

4646
# Move to the subfolder
4747
cd "$PYTHON_BUILD_SUBFOLDER" 2>/dev/null

test_scripts/run_unittests_react.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if [ -z "$1" ]; then
1717
fi
1818

1919
# Define the path to the subfolder
20-
NODE_SUBFOLDER=node_$1
20+
NODE_SUBFOLDER=$(dirname "$1")/node_$(basename "$1")
2121

2222
if [ "${VERBOSE:-}" -eq 1 ] 2>/dev/null; then
2323
printf "Preparing Node subfolder: $NODE_SUBFOLDER\n"
@@ -39,7 +39,7 @@ else
3939
mkdir -p $NODE_SUBFOLDER
4040
fi
4141

42-
cp -R $1/* $NODE_SUBFOLDER
42+
cp -R "$1"/* $NODE_SUBFOLDER
4343

4444
# Move to the subfolder
4545
cd "$NODE_SUBFOLDER" 2>/dev/null

0 commit comments

Comments
 (0)