diff --git a/.github/workflows/L1-tests.yml b/.github/workflows/L1-tests.yml index 89a31438..39150dcd 100755 --- a/.github/workflows/L1-tests.yml +++ b/.github/workflows/L1-tests.yml @@ -640,10 +640,23 @@ jobs: PATH=$GITHUB_WORKSPACE/install/usr/bin:${PATH} LD_LIBRARY_PATH=$GITHUB_WORKSPACE/install/usr/lib:$GITHUB_WORKSPACE/install/usr/lib/wpeframework/plugins:${LD_LIBRARY_PATH} GTEST_OUTPUT="json:$(pwd)/rdkL1TestResults.json" - RdkServicesL1Test && + gdb -batch -ex "set logging file $GITHUB_WORKSPACE/gdb_log.txt" -ex "set logging on" -ex "run" -ex "bt" -ex "info registers" -ex "quit" --args RdkServicesL1Test 2>&1 | tee $GITHUB_WORKSPACE/gdb_output.log && cp -rf $(pwd)/rdkL1TestResults.json $GITHUB_WORKSPACE/rdkL1TestResultsWithoutValgrind.json && rm -rf $(pwd)/rdkL1TestResults.json + - name: Capture detailed crash info on failure + if: failure() + run: | + echo "Test failed, capturing additional debugging information..." + echo "Core dumps:" >> $GITHUB_WORKSPACE/debug_info.log + find . -name "core*" -type f >> $GITHUB_WORKSPACE/debug_info.log 2>/dev/null || echo "No core dumps found" >> $GITHUB_WORKSPACE/debug_info.log + echo "System info:" >> $GITHUB_WORKSPACE/debug_info.log + uname -a >> $GITHUB_WORKSPACE/debug_info.log + echo "Memory info:" >> $GITHUB_WORKSPACE/debug_info.log + free -h >> $GITHUB_WORKSPACE/debug_info.log + echo "Disk space:" >> $GITHUB_WORKSPACE/debug_info.log + df -h >> $GITHUB_WORKSPACE/debug_info.log + - name: Run unit tests with valgrind if: ${{ !env.ACT }} run: > @@ -694,7 +707,19 @@ jobs: path: | coverage/ valgrind_log + gdb_log.txt # (GDB's internal logging) + gdb_output.log # (captured terminal output) + debug_info.log # (system info on failure) rdkL1TestResultsWithoutValgrind.json rdkL1TestResultsWithValgrind.json if-no-files-found: warn + + # The below steps are for uploading full build results for debugging purposes. + - name: Upload build + if: always() + uses: actions/upload-artifact@v4 + with: + name: Build results + path: | + ./ diff --git a/Tests/L1Tests/tests/test_AVInput.cpp b/Tests/L1Tests/tests/test_AVInput.cpp index 771e73b7..4bdda46a 100644 --- a/Tests/L1Tests/tests/test_AVInput.cpp +++ b/Tests/L1Tests/tests/test_AVInput.cpp @@ -169,6 +169,21 @@ TEST_F(AVInputTest, RegisteredMethods) EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("getGameFeatureStatus"))); } +// Deliberate crash test to demonstrate GDB integration +TEST_F(AVInputTest, DeliberateCrashForGDBDemo) +{ + std::cout << "About to trigger a deliberate crash for GDB demonstration..." << std::endl; + std::cout << "This will help test the GDB integration in CI/CD pipeline" << std::endl; + + // Method 1: Null pointer dereference + int* null_ptr = nullptr; + std::cout << "Attempting null pointer dereference..." << std::endl; + *null_ptr = 42; // This will cause a segmentation fault + + // This code should never be reached + FAIL() << "This line should never be executed due to the crash above"; +} + TEST_F(AVInputInit, getInputDevices) { EXPECT_CALL(*p_hdmiInputImplMock, getNumberOfInputs())