Skip to content

Fix the gaps in workflows to upload L1 test results to portal - #407

Open
shibu-kv wants to merge 7 commits into
developfrom
feature/L1-test-result-upload
Open

Fix the gaps in workflows to upload L1 test results to portal#407
shibu-kv wants to merge 7 commits into
developfrom
feature/L1-test-result-upload

Conversation

@shibu-kv

@shibu-kv shibu-kv commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Fix the workflow that seems to be broken with migration of container used for actual test execution

@shibu-kv
shibu-kv requested a review from a team as a code owner August 5, 2026 16:08
Copilot AI review requested due to automatic review settings August 5, 2026 16:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR repairs the L1 unit test result publishing pipeline after a container migration by ensuring the GTest report directory exists and by transferring reports between jobs via GitHub Actions artifacts rather than container volume mounts.

Changes:

  • Ensure /tmp/Gtest_Report exists during unit test execution so report generation/copying doesn’t fail due to a missing directory.
  • Upload the copied L1 GTest reports as a workflow artifact and download them in the upload job (replacing the previous /tmp volume mapping).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
test/run_ut.sh Creates the GTest report output directory before running test binaries so reports can be produced and collected reliably.
.github/workflows/L1-tests.yml Switches cross-job report transfer from container volume mounts to upload/download artifact steps to support the new execution container flow.
Suppressed comments (1)

.github/workflows/L1-tests.yml:53

  • upload-test-results currently won’t run if execute-L1-tests-on-pr fails (default needs behavior), even if the report artifact was uploaded via if: always(). Add if: always() at the job level so results can still be pushed to the portal on failing test runs (or at least attempt/skip based on secret availability).
  upload-test-results:
    name: Upload L1 test results to automatic test result management system
    needs: execute-L1-tests-on-pr
    runs-on: ubuntu-latest
    container:

Comment thread test/run_ut.sh
Comment on lines +47 to +49
# Create test results directory
mkdir -p /tmp/Gtest_Report

Comment on lines 38 to +42
run: |
docker cp native-platform:/tmp/Gtest_Report /tmp/Gtest_Report
ls -l /tmp/Gtest_Report

- name: Upload test results as artifact
Copilot AI review requested due to automatic review settings August 5, 2026 16:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (4)

test/run_ut.sh:49

  • The script creates /tmp/Gtest_Report but doesn’t check for failure. If /tmp is read-only/full, tests will still run and CI may later fail to collect/upload results with little signal. Fail fast (and optionally clear stale JSON from previous runs) when the directory cannot be prepared.
# Create test results directory
mkdir -p /tmp/Gtest_Report

.github/workflows/L1-tests.yml:75

  • In the container-based upload job, downloading the artifact to /tmp can land on the runner filesystem and not be visible inside the job container; the subsequent ls/gtest-json-result-push.py then won’t see any files. Download into $GITHUB_WORKSPACE (mounted into the container) and reference that path in the upload step.
      - name: Download test results
        uses: actions/download-artifact@v4
        with:
          name: gtest-results
          path: /tmp/Gtest_Report

      - name: Upload results
        if: github.repository_owner == 'rdkcentral'
        env:
          TEST_RESULTS_PUSH_URL: ${{ secrets.TEST_RESULTS_PUSH_URL }}
        run: |
          echo "Contents in /tmp/Gtest_Report:"
          ls -l /tmp/Gtest_Report
          if [ -z "${TEST_RESULTS_PUSH_URL}" ]; then
            echo "TEST_RESULTS_PUSH_URL secret not set. Skipping test result upload."
            exit 0
          fi
          git config --global --add safe.directory `pwd`
          gtest-json-result-push.py /tmp/Gtest_Report "${TEST_RESULTS_PUSH_URL}" `pwd`

.github/workflows/L1-tests.yml:5

  • The pull_request branch filter now includes a feature branch name. This deviates from other workflows in this repo (which target stable base branches like develop/main) and can cause the workflow to run (or be skipped) unexpectedly as branches are created/removed. Consider limiting to stable base branches.
  pull_request:
    branches: [ develop, main , feature/L1-test-result-upload ]

.github/workflows/L1-tests.yml:47

  • Artifact upload uses an absolute /tmp path. To avoid runner-/container-specific filesystem differences and to keep artifacts within the checked-out workspace, copy results into ${{ github.workspace }} and upload from there (also avoids clobbering host /tmp across parallel jobs).

This issue also appears on line 57 of the same file.

      - name: Copy L1 test results to runner
        run: |
          docker cp native-platform:/tmp/Gtest_Report /tmp/Gtest_Report
          ls -l /tmp/Gtest_Report

      - name: Upload test results as artifact
        uses: actions/upload-artifact@v4
        with:
          name: gtest-results
          path: /tmp/Gtest_Report
          retention-days: 1

Copilot AI review requested due to automatic review settings August 5, 2026 16:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (6)

test/run_ut.sh:48

  • mkdir -p failure is currently ignored; if /tmp is read-only or the command fails, the script will continue and later steps may silently miss result files. Treat this as a hard failure so the CI job reports the real root cause.
# Create test results directory
mkdir -p /tmp/Gtest_Report

.github/workflows/L1-tests.yml:47

  • Same as the copy step: when tests fail, this artifact upload won't run unless forced, which breaks the goal of uploading results for failed test runs. Add if: ${{ always() }} so the artifact is published even on failure.
      - name: Upload test results as artifact
        uses: actions/upload-artifact@v4
        with:
          name: gtest-results
          path: /tmp/Gtest_Report
          retention-days: 1

.github/workflows/L1-tests.yml:53

  • upload-test-results will not run if execute-L1-tests-on-pr fails (default needs behavior), which prevents result upload exactly when tests fail. Add a job-level if: ${{ always() }} so uploading can still proceed when prior job fails but artifacts exist.
  upload-test-results:
    name: Upload L1 test results to automatic test result management system
    needs: execute-L1-tests-on-pr
    runs-on: ubuntu-latest
    container:

.github/workflows/L1-tests.yml:41

  • If any unit test fails, docker exec ... run_ut.sh exits non-zero and this step will be skipped, so you lose the JSON results needed for artifact/portal upload. Make this copy step run regardless of earlier step success.

This issue also appears in the following locations of the same file:

  • line 42
  • line 49
      - name: Copy L1 test results to runner
        run: |
          docker cp native-platform:/tmp/Gtest_Report /tmp/Gtest_Report
          ls -l /tmp/Gtest_Report

.github/workflows/L1-tests.yml:5

  • Including feature/L1-test-result-upload under on.pull_request.branches only triggers the workflow for PRs targeting that branch (base ref). If the intent was to run this workflow for PRs coming from that feature branch, this filter won’t help and may be left behind accidentally.
    branches: [ develop, main , feature/L1-test-result-upload ]

.github/workflows/code-coverage.yml:5

  • Same branch-filter concern here: on.pull_request.branches matches the PR base branch, not the source branch. Keeping a temporary feature branch name here is likely unintended and won’t make the workflow run for PRs originating from that branch.
    branches: [ develop, main, feature/L1-test-result-upload ]

The upload scripts were not running within the source checkout directory
Copilot AI review requested due to automatic review settings August 5, 2026 17:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (3)

test/run_ut.sh:48

  • The new test-results directory creation doesn’t check for failure. If /tmp is not writable (or filesystem issues occur), the script will continue and later steps may fail with less clear errors. Please fail fast with an explicit error message when mkdir fails.
# Create test results directory
mkdir -p /tmp/Gtest_Report

.github/workflows/code-coverage.yml:5

  • on.pull_request.branches filters the PR base branch. Including a feature branch name here is unusual and likely temporary; it can cause workflows to run for PRs targeting that feature branch. Consider limiting this to long-lived base branches only.
    branches: [ develop, main, feature/L1-test-result-upload ]

.github/workflows/L1-tests.yml:5

  • on.pull_request.branches filters the PR base branch. Including a feature branch name here is unusual and likely temporary; it can cause workflows to run for PRs targeting that feature branch and is inconsistent with other workflows (e.g., .github/workflows/L2-tests.yml:5 uses only develop). Consider limiting this to long-lived base branches only.
    branches: [ develop, main , feature/L1-test-result-upload ]

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Code Coverage Summary

                                   Total:|60.5%  10162|89.9%   347|    -      0

Include posting coverage summary to every PR in develop
Copilot AI review requested due to automatic review settings August 5, 2026 17:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (5)

test/run_ut.sh:49

  • Creating /tmp/Gtest_Report without clearing it can cause stale JSON reports from previous runs (e.g., local dev or a reused container) to be included in the aggregation and uploaded artifacts. Clean the directory before running tests to ensure only current results are reported.
# Create test results directory
mkdir -p /tmp/Gtest_Report

.github/workflows/L1-tests.yml:6

  • The workflow uses actions/github-script to create a PR comment, but the workflow does not declare write permissions for issues/PRs. If repo defaults are restricted, comment creation can fail with 403. Declare explicit minimal permissions at workflow level.
on:
  pull_request:
    branches: [ develop, main , feature/L1-test-result-upload ]

.github/workflows/L1-tests.yml:43

  • docker cp native-platform:/tmp/Gtest_Report /tmp/Gtest_Report can create a nested directory if /tmp/Gtest_Report already exists on the runner (docker cp copies the source directory into the destination directory). Remove/recreate the destination and copy the directory contents to keep artifact paths stable.
      - name: Copy L1 test results to runner
        run: |
          docker cp native-platform:/tmp/Gtest_Report /tmp/Gtest_Report
          ls -l /tmp/Gtest_Report

.github/workflows/L1-tests.yml:62

  • The github-script step triggers an async API call without awaiting it. Without await, the action can finish before the comment is actually posted, leading to intermittent missing PR comments. Await the promise and add newlines so the fenced block renders correctly.
            const fs = require('fs');
            const lcov_result = fs.readFileSync('/tmp/coverage_summary.txt', 'utf8');
          
            github.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: 
                    '## Code Coverage Summary \n' +
                    ' ' +
                    '```' +
                    lcov_result + 
                    '```'
            });

.github/workflows/L1-tests.yml:47

  • PR comment creation will fail for pull requests coming from forks because the pull_request event GITHUB_TOKEN is read-only in that case. Guard the comment step so the job still produces artifacts/results even when the comment cannot be posted.
      - name: Update the coverage report to Pull request using actions
        uses: actions/github-script@v4
        with:

Copilot AI review requested due to automatic review settings August 5, 2026 17:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (5)

test/run_ut.sh:49

  • mkdir -p /tmp/Gtest_Report is not checked for failure, so the script can continue and later steps will silently miss JSON results if /tmp is not writable or the directory cannot be created. Fail fast with an explicit error when the directory cannot be created.
# Create test results directory
mkdir -p /tmp/Gtest_Report

.github/workflows/L1-tests.yml:53

  • The github-script step doesn’t await the createComment call and doesn’t guard against oversized content. If the API call fails (e.g., due to comment size limits), this can result in missing coverage comments or flaky behavior. Use await and truncate the body to stay within GitHub’s limits.
            const fs = require('fs');
            const lcov_result = fs.readFileSync('/tmp/coverage_summary.txt', 'utf8');
          
            github.issues.createComment({
              issue_number: context.issue.number,

.github/workflows/L1-tests.yml:5

  • Including a feature branch name in the pull_request.branches filter is likely temporary and can cause confusion/maintenance overhead after merge. If the workflow should run for PRs targeting develop and main, remove the feature branch entry.
    branches: [ develop, main , feature/L1-test-result-upload ]

.github/workflows/L1-tests.yml:36

  • lcov --list coverage.info can produce very large output; writing the full listing to /tmp/coverage_summary.txt (and then posting it to a PR comment) is likely to exceed GitHub comment size limits and/or slow the workflow. Prefer extracting only the summary lines.

This issue also appears on line 49 of the same file.

      - name: Run L1 Unit Tests inside container with coverage flags enabled
        run: docker exec -i native-platform /bin/bash -c "cd /mnt/L1_CONTAINER_SHARED_VOLUME/ && sh test/run_ut.sh --enable-cov && lcov --list coverage.info > /tmp/coverage_summary.txt"

.github/workflows/code-coverage.yml:36

  • lcov --list coverage.info writes the full per-file listing into /tmp/coverage_summary.txt. This is likely much larger than intended for a “summary” and can increase CI time and artifact size. Consider filtering to the aggregate summary lines only (as was previously done).
      - name: Run unit tests with coverage flags enabled and Caculate the code coverage summary
        run: docker exec -i native-platform /bin/bash -c "cd /mnt/L1_CONTAINER_SHARED_VOLUME/ && sh test/run_ut.sh --enable-cov && lcov --list coverage.info > /tmp/coverage_summary.txt"

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Code Coverage Summary

                                   Total:|60.5%  10162|89.9%   347|    -      0

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Code Coverage Summary

                                         |Lines       |Functions  |Branches    
Filename                                  |Rate     Num|Rate    Num|Rate     Num
================================================================================
[/mnt/L1_CONTAINER_SHARED_VOLUME/source/]
bulkdata/datamodel.c                      |72.5%    218|88.9%     9|    -      0
bulkdata/profile.c                        |21.5%   1076|71.0%    31|    -      0
bulkdata/profilexconf.c                   |45.5%    501|81.2%    16|    -      0
bulkdata/reportprofiles.c                 |57.5%    583| 100%    27|    -      0
bulkdata/t2eventreceiver.c                |64.8%    298| 100%    10|    -      0
bulkdata/t2markers.c                      |80.5%    169|83.3%    12|    -      0
ccspinterface/busInterface.c              |86.8%     53|85.7%     7|    -      0
ccspinterface/rbusInterface.c             |74.3%    946|97.2%    36|    -      0
commonlib/telemetry_busmessage_sender.c   |40.4%    396|84.2%    19|    -      0
dcautil/dca.c                             |71.7%    674| 100%    20|    -      0
dcautil/dcaproc.c                         |84.3%    230| 100%     7|    -      0
dcautil/dcautil.c                         |78.9%    185| 100%     6|    -      0
dcautil/legacyutils.c                     |79.0%    105| 100%     7|    -      0
privacycontrol/rdkservices_privacyutils.c | 100%     11| 100%     2|    -      0
protocol/http/curlinterface.c             | 100%     24| 100%     3|    -      0
protocol/http/multicurlinterface.c        |59.7%    375|80.0%    10|    -      0
protocol/rbusMethod/rbusmethodinterface.c |60.6%    104|50.0%     6|    -      0
reportgen/reportgen.c                     |55.9%    919| 100%    21|    -      0
scheduler/scheduler.c                     |73.3%    371| 100%    12|    -      0
t2parser/t2parser.c                       |59.4%   1939|88.5%    26|    -      0
t2parser/t2parserxconf.c                  |89.7%    195| 100%     3|    -      0
utils/persistence.c                       |78.7%    253| 100%    10|    -      0
utils/t2MtlsUtils.c                       |82.6%     46|75.0%     4|    -      0
utils/t2collection.c                      |89.6%    201| 100%    18|    -      0
utils/t2common.c                          |58.9%    185|66.7%    15|    -      0
utils/t2log_wrapper.c                     |69.2%     26|50.0%     2|    -      0
utils/vector.c                            |94.9%     79| 100%     8|    -      0
================================================================================
                                   Total:|60.5%  10162|89.9%   347|    -      0

Verified with the execution and limiting to develop based on results.
Copilot AI review requested due to automatic review settings August 5, 2026 18:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (4)

test/run_ut.sh:48

  • mkdir -p failure would be silently ignored and the rest of the script would run without producing JSON reports. Since this directory is required for test result generation, fail fast (or at least log+exit) if it cannot be created.
# Create test results directory
mkdir -p /tmp/Gtest_Report

.github/workflows/L1-tests.yml:47

  • Posting a PR comment will fail (and fail the job) on PRs coming from forks because the GITHUB_TOKEN is read-only for pull_request events. Gate this step to same-repo PRs (or make it non-blocking) so external contributions don’t break CI.
      - name: Update the coverage report to Pull request using actions
        uses: actions/github-script@v4
        with:

.github/workflows/L1-tests.yml:36

  • lcov --list coverage.info can be very large; writing the full per-file listing into a PR comment frequently exceeds GitHub’s comment size limit and adds noise. Keep this to a small summary (e.g., only Lines/Total) like the previous workflow did.

This issue also appears on line 45 of the same file.

      - name: Run L1 Unit Tests inside container with coverage flags enabled
        run: docker exec -i native-platform /bin/bash -c "cd /mnt/L1_CONTAINER_SHARED_VOLUME/ && sh test/run_ut.sh --enable-cov && lcov --list coverage.info > /tmp/coverage_summary.txt"

.github/workflows/code-coverage.yml:36

  • This change captures the full lcov --list output into coverage_summary.txt. That content can be extremely large and may cause the subsequent PR comment step to fail due to GitHub comment size limits; prefer a small summary (e.g., grep 'Lines\|Total') instead.
      - name: Run unit tests with coverage flags enabled and Caculate the code coverage summary
        run: docker exec -i native-platform /bin/bash -c "cd /mnt/L1_CONTAINER_SHARED_VOLUME/ && sh test/run_ut.sh --enable-cov && lcov --list coverage.info > /tmp/coverage_summary.txt"

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Code Coverage Summary

                                         |Lines       |Functions  |Branches    
Filename                                  |Rate     Num|Rate    Num|Rate     Num
================================================================================
[/mnt/L1_CONTAINER_SHARED_VOLUME/source/]
bulkdata/datamodel.c                      |72.5%    218|88.9%     9|    -      0
bulkdata/profile.c                        |21.5%   1076|71.0%    31|    -      0
bulkdata/profilexconf.c                   |45.5%    501|81.2%    16|    -      0
bulkdata/reportprofiles.c                 |57.5%    583| 100%    27|    -      0
bulkdata/t2eventreceiver.c                |64.8%    298| 100%    10|    -      0
bulkdata/t2markers.c                      |80.5%    169|83.3%    12|    -      0
ccspinterface/busInterface.c              |86.8%     53|85.7%     7|    -      0
ccspinterface/rbusInterface.c             |74.3%    946|97.2%    36|    -      0
commonlib/telemetry_busmessage_sender.c   |40.4%    396|84.2%    19|    -      0
dcautil/dca.c                             |71.7%    674| 100%    20|    -      0
dcautil/dcaproc.c                         |84.3%    230| 100%     7|    -      0
dcautil/dcautil.c                         |78.9%    185| 100%     6|    -      0
dcautil/legacyutils.c                     |79.0%    105| 100%     7|    -      0
privacycontrol/rdkservices_privacyutils.c | 100%     11| 100%     2|    -      0
protocol/http/curlinterface.c             | 100%     24| 100%     3|    -      0
protocol/http/multicurlinterface.c        |59.7%    375|80.0%    10|    -      0
protocol/rbusMethod/rbusmethodinterface.c |60.6%    104|50.0%     6|    -      0
reportgen/reportgen.c                     |55.9%    919| 100%    21|    -      0
scheduler/scheduler.c                     |73.3%    371| 100%    12|    -      0
t2parser/t2parser.c                       |59.4%   1939|88.5%    26|    -      0
t2parser/t2parserxconf.c                  |89.7%    195| 100%     3|    -      0
utils/persistence.c                       |78.7%    253| 100%    10|    -      0
utils/t2MtlsUtils.c                       |82.6%     46|75.0%     4|    -      0
utils/t2collection.c                      |89.6%    201| 100%    18|    -      0
utils/t2common.c                          |58.9%    185|66.7%    15|    -      0
utils/t2log_wrapper.c                     |69.2%     26|50.0%     2|    -      0
utils/vector.c                            |94.9%     79| 100%     8|    -      0
================================================================================
                                   Total:|60.5%  10162|89.9%   347|    -      0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants