Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 10 additions & 23 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Code Coverage

on:
pull_request:
branches: [ main, develop]
branches: [ main]

env:
AUTOMATICS_UNAME: ${{ secrets.AUTOMATICS_UNAME }}
Expand Down Expand Up @@ -31,32 +31,18 @@ jobs:
run: |
docker run -d --name native-platform -v ${{ github.workspace }}:/mnt/L1_CONTAINER_SHARED_VOLUME ghcr.io/rdkcentral/docker-device-mgt-service-test/native-platform:latest

- name: Run unit tests 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"
- 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 | grep 'Lines\|Total' > /tmp/coverage_summary.txt"

- name: Caculate the code coverage summary
run: |
lcov --list coverage.info | grep "Lines\|Total" > /tmp/Gtest_Report/coverage_summary.txt

- name: Copy the code coverage to runner
run: |
docker cp native-platform:/tmp/Gtest_Report/ /tmp/Gtest_Report/
- name: Copy coverage summary to runner
run: docker cp native-platform:/tmp/coverage_summary.txt /tmp/

upload-test-results:
name: Upload L1 coverage reports
needs: execute-unit-code-coverage-report-on-release
runs-on: ubuntu-latest
container:
image: ghcr.io/rdkcentral/docker-rdk-ci:latest
volumes:
- /tmp/Gtest_Report:/tmp/Gtest_Report
steps:
- name: Update the coverage report to Pull request using actions
uses: actions/github-script@v4
with:
script: |
const fs = require('fs');
const lcov_result = fs.readFileSync('/tmp/Gtest_Report/coverage_summary.txt', 'utf8');
const lcov_result = fs.readFileSync('/tmp/coverage_summary.txt', 'utf8');

github.issues.createComment({
issue_number: context.issue.number,
Expand All @@ -71,12 +57,13 @@ jobs:
});

- name: Generate the html report
run: |
genhtml coverage.info --output-directory /tmp/coverage_report
run: docker exec -i native-platform /bin/bash -c " cd /mnt/L1_CONTAINER_SHARED_VOLUME/ && genhtml coverage.info --output-directory /tmp/coverage_report"

- name: Copy html report to runner
run: docker cp native-platform:/tmp/coverage_report /tmp/

- name: Upload the coverage report to Pull request using actions
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: /tmp/coverage_report

5 changes: 2 additions & 3 deletions source/test/bulkdata/datamodelTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,10 @@ TEST_F(datamodelTestFixture, datamodel_processProfile_RP)
"\"HTTP\":{\"URL\":\"https://stbrtl.r53.xcal.tv/\",\"Compression\":\"None\",\"Method\":\"POST\","
"\"RequestURIParameter\":[{\"Name\":\"reportName\",\"Reference\":\"Profile.Name\"}]},"
"\"JSONEncoding\":{\"ReportFormat\":\"NameValuePair\",\"ReportTimestamp\":\"None\"}}}]}";

EXPECT_CALL(*g_datamodelMock, ReportProfiles_ProcessReportProfilesBlob(_, _))
.Times(1);
EXPECT_EQ(T2ERROR_SUCCESS, datamodel_processProfile((char*)testJson, T2_RP));
std::this_thread::sleep_for(std::chrono::milliseconds(100));
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}

//datamodel_processProfile success test
Expand All @@ -171,7 +170,7 @@ TEST_F(datamodelTestFixture, datamodel_processProfile_TRP)
EXPECT_CALL(*g_datamodelMock, ReportProfiles_ProcessReportProfilesBlob(_, _))
.Times(1);
EXPECT_EQ(T2ERROR_SUCCESS, datamodel_processProfile((char*)testJson, T2_TEMP_RP));
std::this_thread::sleep_for(std::chrono::milliseconds(100));
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}

//datamodel_processProfile failure test
Expand Down
Loading
Loading