Skip to content

Commit 71ed4dd

Browse files
author
gr0vity
committed
fix: Properly propagate test exit status through the script chain. Pass executable path instead of target
1 parent 80212f4 commit 71ed4dd

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

ci/tests/run-gtest-parallel.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,27 @@ set -euo pipefail
33

44
source "$(dirname "$BASH_SOURCE")/common.sh"
55

6-
target=$1
7-
if [ -z "${target-}" ]; then
8-
echo "Target not specified"
6+
executable=$1
7+
if [ -z "${executable-}" ]; then
8+
echo "Executable not specified"
99
exit 1
1010
fi
1111

1212
shift
13-
executable=./${target}$(get_exec_extension)
1413

1514
# Get the project root directory (2 levels up from ci/tests)
1615
PROJECT_ROOT="$(cd "$(dirname "$BASH_SOURCE")/../.." && pwd)"
1716
GTEST_PARALLEL="${PROJECT_ROOT}/submodules/gtest-parallel/gtest-parallel"
1817

1918
if [ -f "${GTEST_PARALLEL}" ]; then
20-
echo "Running tests with gtest-parallel for target: ${target}"
19+
echo "Running tests with gtest-parallel for executable: ${executable}"
2120
"${GTEST_PARALLEL}" "${executable}" --worker=1 "$@"
21+
test_status=$?
2222
else
23-
echo "gtest-parallel not found at ${GTEST_PARALLEL}, running tests directly for target: ${target}"
23+
echo "gtest-parallel not found at ${GTEST_PARALLEL}, running tests directly for executable: ${executable}"
2424
"${executable}" "$@"
25-
fi
25+
test_status=$?
26+
fi
27+
28+
# Return the original test exit status
29+
exit $test_status

ci/tests/run-tests.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ case "$(uname -s)" in
4646
;;
4747
esac
4848

49-
# Run the test using gtest-parallel helper
5049
shift
5150
executable=./${target}$(get_exec_extension)
52-
"$(dirname "$BASH_SOURCE")/run-gtest-parallel.sh" "${target}" "$@"
51+
52+
# Run the test using gtest-parallel helper
53+
"$(dirname "$BASH_SOURCE")/run-gtest-parallel.sh" "${executable}" "$@"
5354
status=$?
5455

5556
if [ $status -ne 0 ]; then

0 commit comments

Comments
 (0)