From ad5da18b6683506c4782a133b2d31ed7101a1166 Mon Sep 17 00:00:00 2001 From: gr0vity Date: Sat, 7 Dec 2024 09:39:55 +0100 Subject: [PATCH 1/5] ci: enable debug logging for core tests Enable NANO_LOG_STATS and debug level logging for core tests to help diagnose intermittent failures on CI runners --- .github/workflows/unit_tests.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 7e42a115b4..135c6b6032 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -35,6 +35,9 @@ jobs: if: steps.build.outcome == 'success' && (success() || failure()) run: ../ci/tests/run-core-tests.sh working-directory: build + env: + NANO_LOG_STATS: 1 + NANO_LOG: debug - name: RPC Tests if: steps.build.outcome == 'success' && (success() || failure()) @@ -81,6 +84,9 @@ jobs: if: steps.build.outcome == 'success' && (success() || failure()) run: ../ci/tests/run-core-tests.sh working-directory: build + env: + NANO_LOG_STATS: 1 + NANO_LOG: debug - name: RPC Tests if: steps.build.outcome == 'success' && (success() || failure()) @@ -132,6 +138,9 @@ jobs: run: ../ci/tests/run-core-tests.sh working-directory: build shell: bash + env: + NANO_LOG_STATS: 1 + NANO_LOG: debug - name: RPC Tests if: steps.build.outcome == 'success' && (success() || failure()) From 2673c53d576686840ac920a80709e0b7823e8208 Mon Sep 17 00:00:00 2001 From: gr0vity Date: Sat, 7 Dec 2024 12:03:53 +0100 Subject: [PATCH 2/5] run tests with gtest-parallel and --worker=1 --- ci/tests/run-gtest-parallel.sh | 21 +++++++++++++++++++++ ci/tests/run-tests.sh | 4 ++-- 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100755 ci/tests/run-gtest-parallel.sh diff --git a/ci/tests/run-gtest-parallel.sh b/ci/tests/run-gtest-parallel.sh new file mode 100755 index 0000000000..83f96d8a9e --- /dev/null +++ b/ci/tests/run-gtest-parallel.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -euo pipefail + +source "$(dirname "$BASH_SOURCE")/common.sh" + +target=$1 +if [ -z "${target-}" ]; then + echo "Target not specified" + exit 1 +fi + +executable=./${target}$(get_exec_extension) + +# Check if gtest-parallel is available +if command -v gtest-parallel >/dev/null 2>&1; then + echo "Running tests with gtest-parallel for target: ${target}" + gtest-parallel "${executable}" --worker=1 +else + echo "gtest-parallel not found, running tests directly for target: ${target}" + "${executable}" +fi \ No newline at end of file diff --git a/ci/tests/run-tests.sh b/ci/tests/run-tests.sh index 7f48962359..4d95f861d4 100755 --- a/ci/tests/run-tests.sh +++ b/ci/tests/run-tests.sh @@ -46,10 +46,10 @@ case "$(uname -s)" in ;; esac -# Run the test +# Run the test using gtest-parallel helper shift executable=./${target}$(get_exec_extension) -"${executable}" "$@" +"$(dirname "$BASH_SOURCE")/run-gtest-parallel.sh" "${target}" "$@" status=$? if [ $status -ne 0 ]; then From 6911c68be103233c3b51862cb9743a09a8861007 Mon Sep 17 00:00:00 2001 From: gr0vity Date: Sat, 7 Dec 2024 13:13:37 +0100 Subject: [PATCH 3/5] Use gtest-parallel from submodule folder --- ci/tests/run-gtest-parallel.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ci/tests/run-gtest-parallel.sh b/ci/tests/run-gtest-parallel.sh index 83f96d8a9e..d2369ed6e5 100755 --- a/ci/tests/run-gtest-parallel.sh +++ b/ci/tests/run-gtest-parallel.sh @@ -11,11 +11,14 @@ fi executable=./${target}$(get_exec_extension) -# Check if gtest-parallel is available -if command -v gtest-parallel >/dev/null 2>&1; then +# Get the project root directory (2 levels up from ci/tests) +PROJECT_ROOT="$(cd "$(dirname "$BASH_SOURCE")/../.." && pwd)" +GTEST_PARALLEL="${PROJECT_ROOT}/submodules/gtest-parallel/gtest-parallel" + +if [ -f "${GTEST_PARALLEL}" ]; then echo "Running tests with gtest-parallel for target: ${target}" - gtest-parallel "${executable}" --worker=1 + "${GTEST_PARALLEL}" "${executable}" --worker=1 else - echo "gtest-parallel not found, running tests directly for target: ${target}" + echo "gtest-parallel not found at ${GTEST_PARALLEL}, running tests directly for target: ${target}" "${executable}" fi \ No newline at end of file From 80212f460e638090fa9de9a9f0c2ace9165f4c3e Mon Sep 17 00:00:00 2001 From: gr0vity Date: Sat, 7 Dec 2024 21:18:59 +0100 Subject: [PATCH 4/5] pass arguments to gtest-parallel --- ci/tests/run-gtest-parallel.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ci/tests/run-gtest-parallel.sh b/ci/tests/run-gtest-parallel.sh index d2369ed6e5..082197e138 100755 --- a/ci/tests/run-gtest-parallel.sh +++ b/ci/tests/run-gtest-parallel.sh @@ -9,6 +9,7 @@ if [ -z "${target-}" ]; then exit 1 fi +shift executable=./${target}$(get_exec_extension) # Get the project root directory (2 levels up from ci/tests) @@ -17,8 +18,8 @@ GTEST_PARALLEL="${PROJECT_ROOT}/submodules/gtest-parallel/gtest-parallel" if [ -f "${GTEST_PARALLEL}" ]; then echo "Running tests with gtest-parallel for target: ${target}" - "${GTEST_PARALLEL}" "${executable}" --worker=1 + "${GTEST_PARALLEL}" "${executable}" --worker=1 "$@" else echo "gtest-parallel not found at ${GTEST_PARALLEL}, running tests directly for target: ${target}" - "${executable}" + "${executable}" "$@" fi \ No newline at end of file From 71ed4ddbf906d79ac6e2f49502ad3035d923079b Mon Sep 17 00:00:00 2001 From: gr0vity Date: Mon, 9 Dec 2024 06:57:04 +0100 Subject: [PATCH 5/5] fix: Properly propagate test exit status through the script chain. Pass executable path instead of target --- ci/tests/run-gtest-parallel.sh | 18 +++++++++++------- ci/tests/run-tests.sh | 5 +++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ci/tests/run-gtest-parallel.sh b/ci/tests/run-gtest-parallel.sh index 082197e138..022f9c70f6 100755 --- a/ci/tests/run-gtest-parallel.sh +++ b/ci/tests/run-gtest-parallel.sh @@ -3,23 +3,27 @@ set -euo pipefail source "$(dirname "$BASH_SOURCE")/common.sh" -target=$1 -if [ -z "${target-}" ]; then - echo "Target not specified" +executable=$1 +if [ -z "${executable-}" ]; then + echo "Executable not specified" exit 1 fi shift -executable=./${target}$(get_exec_extension) # Get the project root directory (2 levels up from ci/tests) PROJECT_ROOT="$(cd "$(dirname "$BASH_SOURCE")/../.." && pwd)" GTEST_PARALLEL="${PROJECT_ROOT}/submodules/gtest-parallel/gtest-parallel" if [ -f "${GTEST_PARALLEL}" ]; then - echo "Running tests with gtest-parallel for target: ${target}" + echo "Running tests with gtest-parallel for executable: ${executable}" "${GTEST_PARALLEL}" "${executable}" --worker=1 "$@" + test_status=$? else - echo "gtest-parallel not found at ${GTEST_PARALLEL}, running tests directly for target: ${target}" + echo "gtest-parallel not found at ${GTEST_PARALLEL}, running tests directly for executable: ${executable}" "${executable}" "$@" -fi \ No newline at end of file + test_status=$? +fi + +# Return the original test exit status +exit $test_status \ No newline at end of file diff --git a/ci/tests/run-tests.sh b/ci/tests/run-tests.sh index 4d95f861d4..c322bba26c 100755 --- a/ci/tests/run-tests.sh +++ b/ci/tests/run-tests.sh @@ -46,10 +46,11 @@ case "$(uname -s)" in ;; esac -# Run the test using gtest-parallel helper shift executable=./${target}$(get_exec_extension) -"$(dirname "$BASH_SOURCE")/run-gtest-parallel.sh" "${target}" "$@" + +# Run the test using gtest-parallel helper +"$(dirname "$BASH_SOURCE")/run-gtest-parallel.sh" "${executable}" "$@" status=$? if [ $status -ne 0 ]; then