Skip to content

Commit ca9dba7

Browse files
authored
Resolve code coverage hang issue in develop (#185)
* Resolve code coverage hang issue in develop Signed-off-by: PriyaDharshini_Kathiravan <priyakathiravan05@gmail.com> * Run L1 test in main branch * Run L1 test in main * Run code coverage in develop branch * Run L1 code coverage in develop * Run L1 code coverage in develop * Run L1 code coverage in develop * Run L1 code coverage in develop * Resolve the hang issue in code coverage yml * Resolve the hang issue and failures in L1 code coverage * Resolve hang issue and crash in L1 test and code coverage * Update datamodelTest.cpp * Resolve hang issue in L1 test run --------- Signed-off-by: PriyaDharshini_Kathiravan <priyakathiravan05@gmail.com>
1 parent c72e53c commit ca9dba7

File tree

6 files changed

+31
-338
lines changed

6 files changed

+31
-338
lines changed

.github/workflows/code-coverage.yml

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Code Coverage
22

33
on:
44
pull_request:
5-
branches: [ main, develop]
5+
branches: [ main]
66

77
env:
88
AUTOMATICS_UNAME: ${{ secrets.AUTOMATICS_UNAME }}
@@ -31,32 +31,18 @@ jobs:
3131
run: |
3232
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
3333
34-
- name: Run unit tests with coverage flags enabled
35-
run: docker exec -i native-platform /bin/bash -c "cd /mnt/L1_CONTAINER_SHARED_VOLUME/ && sh test/run_ut.sh --enable-cov"
34+
- name: Run unit tests with coverage flags enabled and Caculate the code coverage summary
35+
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"
3636

37-
- name: Caculate the code coverage summary
38-
run: |
39-
lcov --list coverage.info | grep "Lines\|Total" > /tmp/Gtest_Report/coverage_summary.txt
40-
41-
- name: Copy the code coverage to runner
42-
run: |
43-
docker cp native-platform:/tmp/Gtest_Report/ /tmp/Gtest_Report/
37+
- name: Copy coverage summary to runner
38+
run: docker cp native-platform:/tmp/coverage_summary.txt /tmp/
4439

45-
upload-test-results:
46-
name: Upload L1 coverage reports
47-
needs: execute-unit-code-coverage-report-on-release
48-
runs-on: ubuntu-latest
49-
container:
50-
image: ghcr.io/rdkcentral/docker-rdk-ci:latest
51-
volumes:
52-
- /tmp/Gtest_Report:/tmp/Gtest_Report
53-
steps:
5440
- name: Update the coverage report to Pull request using actions
5541
uses: actions/github-script@v4
5642
with:
5743
script: |
5844
const fs = require('fs');
59-
const lcov_result = fs.readFileSync('/tmp/Gtest_Report/coverage_summary.txt', 'utf8');
45+
const lcov_result = fs.readFileSync('/tmp/coverage_summary.txt', 'utf8');
6046
6147
github.issues.createComment({
6248
issue_number: context.issue.number,
@@ -71,12 +57,13 @@ jobs:
7157
});
7258
7359
- name: Generate the html report
74-
run: |
75-
genhtml coverage.info --output-directory /tmp/coverage_report
60+
run: docker exec -i native-platform /bin/bash -c " cd /mnt/L1_CONTAINER_SHARED_VOLUME/ && genhtml coverage.info --output-directory /tmp/coverage_report"
61+
62+
- name: Copy html report to runner
63+
run: docker cp native-platform:/tmp/coverage_report /tmp/
7664

7765
- name: Upload the coverage report to Pull request using actions
7866
uses: actions/upload-artifact@v4
7967
with:
8068
name: coverage-report
8169
path: /tmp/coverage_report
82-

source/test/bulkdata/datamodelTest.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,10 @@ TEST_F(datamodelTestFixture, datamodel_processProfile_RP)
141141
"\"HTTP\":{\"URL\":\"https://stbrtl.r53.xcal.tv/\",\"Compression\":\"None\",\"Method\":\"POST\","
142142
"\"RequestURIParameter\":[{\"Name\":\"reportName\",\"Reference\":\"Profile.Name\"}]},"
143143
"\"JSONEncoding\":{\"ReportFormat\":\"NameValuePair\",\"ReportTimestamp\":\"None\"}}}]}";
144-
145144
EXPECT_CALL(*g_datamodelMock, ReportProfiles_ProcessReportProfilesBlob(_, _))
146145
.Times(1);
147146
EXPECT_EQ(T2ERROR_SUCCESS, datamodel_processProfile((char*)testJson, T2_RP));
148-
std::this_thread::sleep_for(std::chrono::milliseconds(100));
147+
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
149148
}
150149

151150
//datamodel_processProfile success test
@@ -171,7 +170,7 @@ TEST_F(datamodelTestFixture, datamodel_processProfile_TRP)
171170
EXPECT_CALL(*g_datamodelMock, ReportProfiles_ProcessReportProfilesBlob(_, _))
172171
.Times(1);
173172
EXPECT_EQ(T2ERROR_SUCCESS, datamodel_processProfile((char*)testJson, T2_TEMP_RP));
174-
std::this_thread::sleep_for(std::chrono::milliseconds(100));
173+
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
175174
}
176175

177176
//datamodel_processProfile failure test

0 commit comments

Comments
 (0)