-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/dcm test #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Feature/dcm test #21
Changes from all commits
7749fa2
69d0195
4937b27
0a33770
52ef8e4
663ee14
8f0e65e
608a5c5
e2d044b
603788b
f1c4b9e
0065950
0d022d7
d53ea0d
cb8d024
dcc4baf
4e55ba5
3fb373d
816f41c
0b3c804
85681ab
6a16b9f
2ee46bb
1b2534a
7ea7b62
5b044c0
041d5a8
1c75dbf
0812225
ab51cd0
1c48c54
3994d18
712f082
3cbd5d0
3c70dbe
f49332a
5fd1fc8
b4082c8
450ab44
d9e4693
3f2e4f6
209620b
c36a8b1
315b878
ce57df4
825eac5
ab13852
6906bb3
b0f4189
352c713
ddfb7af
f8eba82
a6a9f26
91f91aa
053d482
5957165
382efb1
0a3842e
b0d4318
35c3ba9
9eb2517
808c510
753236c
9b47a8d
9c3e1ab
7dffd68
da2b6bc
2e96a68
a61404a
5ddb1e0
cbb4532
30cbd57
1e1681c
55db490
9259d09
6853106
0c533f0
11fc2da
806cbd4
e0391da
e906cef
9545c9c
3fe1f15
88d0380
40eb7f4
556403d
5655617
c2bcd5f
6bd6540
2a868bd
95585f5
4246942
3994b38
3e76d9b
3a9508e
1e7af60
8791ad6
67c2492
b1ef9a8
0dc11fc
02397e0
2136f35
be64f3b
8ae41dd
7e8b9cd
dbde776
c6416ee
81a85a4
73e6010
5adb151
3a61d90
1c506f1
c7aceca
9b85c11
2ed2d5a
ce93a26
111f519
a16356e
97ecff5
0dea907
6e03651
3e98f61
d68e8c4
c1727b6
6062a76
472baaf
c277e86
3c12cce
0153534
9b93456
dbf613f
ddbe9dc
0662c09
60e1a7f
4a019b2
e9ed596
36bfe90
96e322a
a96768a
a6adc5a
f2867cf
5336a2d
88df413
8ed2d28
afa3e81
cd7e885
bd6ba9b
28989a5
18135c7
a15d996
317625f
c0b0dc6
2edbf2b
9495713
5180ee4
cba9f8f
562bf07
cd8c610
211b804
0353714
28ff25b
cab29a9
b268f99
f2443fd
fb378dd
e01cef8
0653b3b
c45a498
15a640e
e7e0e67
f8d3514
d3b02f4
653ab28
5eec6b9
63150eb
bdaa8ce
66df372
89c29bb
53ec894
efeeb49
e4de5fe
b37101b
927e8c3
82e122b
e6ba30d
b35a48a
4561f22
cb81905
3d22edb
f03f46c
58db102
89cd7c1
7c9bc1b
05dfb6f
0783ef1
6f54346
043d198
6da779b
00b3565
ef706b1
dd10b80
2df965e
cf1bd5e
ade4b28
7a48bda
d47a312
353da01
578d77c
8dcf1a6
8c0b8fb
0d55ba1
160d415
ab5e44b
fdbf878
c4058f4
6cc7152
435a848
90e1a83
18df02f
0bb4298
8feb5c6
9a087ec
1c6940f
808f322
de7fdf2
70eaece
0f347bf
f0c1367
8ed1136
2450ad9
4a78a33
c864223
9affd99
6847b8b
ddf95b6
534dc0f
339bd26
0998572
afbff94
5355eb9
54d78c4
ee8c132
9b0e370
cdb1fc1
2e0d544
9883441
b121f85
9fc05d2
7dd026e
2ba7b22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| name: Unit tests dcm-agent | ||
| on: | ||
| pull_request: | ||
| branches: [ develop, main ] | ||
|
|
||
| env: | ||
| AUTOMATICS_UNAME: ${{ secrets.AUTOMATICS_UNAME }} | ||
| AUTOMATICS_PASSCODE: ${{ secrets.AUTOMATICS_PASSCODE }} | ||
|
|
||
| jobs: | ||
| execute-unit-tests-on-pr: | ||
| name: Execute unit tests in dcm-agent GTest suite | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: ghcr.io/rdkcentral/docker-rdk-ci:latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Run unit tests | ||
| run: sh unit_test.sh | ||
|
|
||
| - name: Upload test results to automatic test result management system | ||
| if: github.repository_owner == 'rdkcentral' | ||
| run: | | ||
| git config --global --add safe.directory `pwd` | ||
| gtest-json-result-push.py /tmp/Gtest_Report https://rdkeorchestrationservice.apps.cloud.comcast.net/rdke_orchestration_api/push_unit_test_results `pwd` | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,54 @@ | ||||||||||||||||||||||||||
| name: Code Coverage | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||
| branches: [ main, develop] | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||
| execute-unit-code-coverage-report-on-release: | ||||||||||||||||||||||||||
| name: Test coverage report for release | ||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||
| container: | ||||||||||||||||||||||||||
| image: ghcr.io/rdkcentral/docker-rdk-ci:latest | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||
| - name: Checkout code | ||||||||||||||||||||||||||
| uses: actions/checkout@v3 | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Run unit tests with coverage flags enabled | ||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||
| sh unit_test.sh --enable-cov | ||||||||||||||||||||||||||
| - name: Caculate the code coverage summary | ||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||
| cd ./unittest | ||||||||||||||||||||||||||
| lcov --list coverage.info | grep "Lines\|Total" > /tmp/coverage_summary.txt | ||||||||||||||||||||||||||
| cd - | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - 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/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 + | ||||||||||||||||||||||||||
| '```' | ||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
| - name: Generate the html report | ||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||
| cd ./unittest | ||||||||||||||||||||||||||
| genhtml coverage.info --output-directory /tmp/coverage_report | ||||||||||||||||||||||||||
| cd - | ||||||||||||||||||||||||||
| - name: Upload the coverage report to Pull request using actions | ||||||||||||||||||||||||||
| uses: actions/upload-artifact@v4 | ||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||
| name: coverage-report | ||||||||||||||||||||||||||
| path: /tmp/coverage_report | ||||||||||||||||||||||||||
|
Comment on lines
+9
to
+54
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 4 months ago To fix the problem, we need to add a
No other permissions are required. The edit should be made directly to the
Suggested changeset
1
.github/workflows/code-coverage.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| #!/bin/bash | ||
|
|
||
| # | ||
| ## Copyright 2023 Comcast Cable Communications Management, LLC | ||
| ## | ||
| ## Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
Check failure on line 6 in unit_test.sh
|
||
| ## you may not use this file except in compliance with the License. | ||
| ## You may obtain a copy of the License at | ||
| ## | ||
| ## http://www.apache.org/licenses/LICENSE-2.0 | ||
| ## | ||
| ## Unless required by applicable law or agreed to in writing, software | ||
| ## distributed under the License is distributed on an "AS IS" BASIS, | ||
| ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| ## See the License for the specific language governing permissions and | ||
| ## limitations under the License. | ||
| ## | ||
| ## SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
|
|
||
| ENABLE_COV=true | ||
|
|
||
| if [ "x$1" = "x--enable-cov" ]; then | ||
| echo "Enabling coverage options" | ||
| export CXXFLAGS="-g -O0 -fprofile-arcs -ftest-coverage" | ||
| export CFLAGS="-g -O0 -fprofile-arcs -ftest-coverage" | ||
| export LDFLAGS="-lgcov --coverage" | ||
| ENABLE_COV=true | ||
| fi | ||
| export TOP_DIR=`pwd` | ||
| export top_srcdir=`pwd` | ||
|
|
||
| cd unittest/ | ||
| cp mocks/mockrbus.h /usr/local/include | ||
| automake --add-missing | ||
| autoreconf --install | ||
|
|
||
| ./configure | ||
|
|
||
| make clean | ||
| make | ||
|
|
||
| fail=0 | ||
|
|
||
| for test in \ | ||
| ./dcm_utils_gtest \ | ||
| ./dcm_schedjob_gtest \ | ||
| ./dcm_cronparse_gtest \ | ||
| ./dcm_parseconf_gtest \ | ||
| ./dcm_rbus_gtest \ | ||
| ./dcm_gtest | ||
| #./rdm_main_gtest \ | ||
| #./rdm_utils_gtest \ | ||
| #./rdm_curl_gtest \ | ||
| #./rdm_json_gtest \ | ||
| #./rdm_download_gtest \ | ||
| #./rdm_downloadutils_gtest \ | ||
| #./rdm_rbus_gtest \ | ||
| #./rdm_openssl_gtest \ | ||
| #./rdm_usbinstall_gtest \ | ||
|
|
||
| do | ||
| $test | ||
| status=$? | ||
| if [ $status -ne 0 ]; then | ||
| echo "Test $test failed with exit code $status" | ||
| fail=1 | ||
| fi | ||
| done | ||
|
|
||
| if [ $fail -ne 0 ]; then | ||
| echo "Some unit tests failed." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "********************" | ||
| echo "**** CAPTURE DCM-AGENT COVERAGE DATA ****" | ||
| echo "********************" | ||
| if [ "$ENABLE_COV" = true ]; then | ||
| echo "Generating coverage report" | ||
| lcov --capture --directory . --output-file coverage.info | ||
| lcov --extract coverage.info "*/dcm*.c" -o newcov.info | ||
| lcov --list newcov.info | ||
| lcov --remove coverage.info '/usr/*' --output-file coverage.info | ||
| lcov --list coverage.info | ||
| lcov --remove coverage.info "${PWD}/*" --output-file coverage.info | ||
| lcov --list coverage.info | ||
| fi | ||
|
|
||
| #if [ "$ENABLE_COV" = true ]; then | ||
| # echo "Generating coverage report" | ||
| # lcov --capture --directory . --output-file coverage.info | ||
| #lcov --remove coverage.info "${PWD}/*" --output-file coverage.info | ||
| #lcov --remove coverage.info "$HOME/usr/*" --output-file coverage.info | ||
| #lcov --remove coverage.info "/usr/*" --output-file coverage.info | ||
| # lcov --extract coverage.info "*/dcm*.c" -o newcov.info | ||
| # lcov --list coverage.info | ||
| # lcov --list newcov.info | ||
| #fi | ||
|
|
||
|
|
||
|
|
||
| cd $TOP_DIR | ||
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 4 months ago
To fix the problem, the workflow YAML should be amended to explicitly specify the required permissions by adding a
permissionsblock. The block can be placed at the root level (recommended, for future jobs) or directly inside the individual job. The minimal starting permissions should becontents: read, which allows the workflow only to read repository contents. There is no evidence that write permissions or other scopes (such aspull-requests: write) are needed for any step in the provided workflow.Change required: In
.github/workflows/L1-Test.yml, add the following beneath the workflownamenear the top of the file:This change limits the default permissions available to the workflow and its jobs. No changes to imports, dependencies, secret/environment variable handling, or any step definition are needed.