Skip to content

Commit 5ab5c21

Browse files
committed
Refactor scripts to use absolute paths for twister executable and test directories
1 parent 5605f34 commit 5ab5c21

3 files changed

Lines changed: 24 additions & 14 deletions

File tree

samples.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
#!/bin/bash
22

3+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
4+
WORKSPACE_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
5+
36
# Set the path to the twister executable
4-
TWISTER_EXE="../zephyr/scripts/twister"
7+
TWISTER_EXE="$WORKSPACE_DIR/zephyr/scripts/twister"
58

69
# Set the path to the test cases directory
7-
TEST_CASES_DIR="../bacnet/zephyr/samples"
10+
TEST_CASES_DIR="$SCRIPT_DIR/zephyr/samples"
811

912
# Set the output directory for test results
10-
OUTPUT_DIR="twister-out.samples"
13+
OUTPUT_DIR="$SCRIPT_DIR/twister-out.samples"
1114

1215
# Remove the output directory
1316
rm -rf "$OUTPUT_DIR"
@@ -16,9 +19,9 @@ rm -rf "$OUTPUT_DIR"
1619
"$TWISTER_EXE" -O "$OUTPUT_DIR" -T "$TEST_CASES_DIR"
1720

1821
# twister output directory cleanup files we do not archive
19-
find $OUTPUT_DIR -name 'CMakeFiles' -exec rm -rf {} \; 2>/dev/null
20-
find $OUTPUT_DIR -name 'modules' -exec rm -rf {} \; 2>/dev/null
21-
find $OUTPUT_DIR -name 'app' -exec rm -rf \
22+
find "$OUTPUT_DIR" -name 'CMakeFiles' -exec rm -rf {} \; 2>/dev/null
23+
find "$OUTPUT_DIR" -name 'modules' -exec rm -rf {} \; 2>/dev/null
24+
find "$OUTPUT_DIR" -name 'app' -exec rm -rf \
2225
'{}/../zephyr/arch
2326
{}/../zephyr/boards
2427
{}/../zephyr/cmake
@@ -41,7 +44,7 @@ find $OUTPUT_DIR -name 'app' -exec rm -rf \
4144
{}/../Kconfig
4245
{}/../cmake_install.cmake
4346
{}/../CMakeCache.txt' \; 2>/dev/null
44-
find $OUTPUT_DIR -name 'app' -exec rm -rf '{}' \; 2>/dev/null
47+
find "$OUTPUT_DIR" -name 'app' -exec rm -rf '{}' \; 2>/dev/null
4548
echo "Twister output cleanup completed successfully."
4649

4750
# Check if twister ran successfully

unittest.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#!/bin/bash
22

33
# Set the path to the twister executable
4-
TWISTER_EXE="../zephyr/scripts/twister"
4+
TWISTER_EXE=""
55

66
# Set workspace virtual environment if available
77
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
88
WORKSPACE_VENV="$SCRIPT_DIR/../.venv"
9+
WORKSPACE_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
10+
TWISTER_EXE="$WORKSPACE_DIR/zephyr/scripts/twister"
911

1012
if [ -x "$WORKSPACE_VENV/bin/python3" ]; then
1113
VENV_SITE="$($WORKSPACE_VENV/bin/python3 -c 'import site; print(site.getsitepackages()[0])')"
@@ -14,12 +16,12 @@ if [ -x "$WORKSPACE_VENV/bin/python3" ]; then
1416
fi
1517

1618
# Set the path to the test cases directory
17-
TEST_CASES_DIR="../bacnet/zephyr/tests"
18-
NATIVE_SIM_TEST_CASES_DIR="../bacnet/zephyr/tests/subsys/bacnet_settings"
19+
TEST_CASES_DIR="$SCRIPT_DIR/zephyr/tests"
20+
NATIVE_SIM_TEST_CASES_DIR="$SCRIPT_DIR/zephyr/tests/subsys/bacnet_settings"
1921

2022
# Set the output directory for test results
21-
OUTPUT_DIR="twister-out.unit_testing"
22-
NATIVE_SIM_OUTPUT_DIR="twister-out.native_sim"
23+
OUTPUT_DIR="$SCRIPT_DIR/twister-out.unit_testing"
24+
NATIVE_SIM_OUTPUT_DIR="$SCRIPT_DIR/twister-out.native_sim"
2325

2426
TWISTER_PLATFORM="unit_testing"
2527
NATIVE_SIM_PLATFORM="native_sim"

west-ci.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
#!/bin/bash
22

3+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
4+
WORKSPACE_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
5+
36
# setup our build environment
7+
cd "$WORKSPACE_DIR"
8+
49
echo "$PWD"
5-
ls -al bacnet
10+
ls -al "$SCRIPT_DIR"
611
west --version
7-
west init -l --mf bacnet/west-ci.yml .
12+
west init -l --mf "$SCRIPT_DIR/west-ci.yml" .
813
west update > /dev/null 2>&1

0 commit comments

Comments
 (0)