diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0f5f593..620bf97 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,4 +2,4 @@ # the repo. Unless a later match takes precedence, # @global-owner1 and @global-owner2 will be requested for # review when someone opens a pull request. -* @rdkcentral/advsecurity-maintainers +* @rdkcentral/dbus-message-cli-maintainers @rdkcentral/rdkb-maintainers diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 0550479..c58b1b0 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -1,13 +1,20 @@ name: "CLA" + +permissions: + contents: read + pull-requests: write + actions: write + statuses: write + on: issue_comment: types: [created] pull_request_target: - types: [opened,closed,synchronize] + types: [opened, closed, synchronize] jobs: CLA-Lite: name: "Signature" - uses: rdkcentral/cmf-actions/.github/workflows/cla.yml@main + uses: rdkcentral/cmf-actions/.github/workflows/cla.yml@v1 secrets: - PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_ASSISTANT }} \ No newline at end of file + PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_ASSISTANT }} diff --git a/.github/workflows/fossid_integration_stateless_diffscan_target_repo.yml b/.github/workflows/fossid_integration_stateless_diffscan_target_repo.yml index da02b8b..7b8c1cb 100644 --- a/.github/workflows/fossid_integration_stateless_diffscan_target_repo.yml +++ b/.github/workflows/fossid_integration_stateless_diffscan_target_repo.yml @@ -1,11 +1,18 @@ name: Fossid Stateless Diff Scan -on: pull_request +on: + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: read + pull-requests: read jobs: call-fossid-workflow: - uses: rdkcentral/build_tools_workflows/.github/workflows/fossid_integration_stateless_diffscan.yml@develop - secrets: + if: ${{ ! github.event.pull_request.head.repo.fork }} + uses: rdkcentral/build_tools_workflows/.github/workflows/fossid_integration_stateless_diffscan.yml@1.0.0 + secrets: FOSSID_CONTAINER_USERNAME: ${{ secrets.FOSSID_CONTAINER_USERNAME }} FOSSID_CONTAINER_PASSWORD: ${{ secrets.FOSSID_CONTAINER_PASSWORD }} FOSSID_HOST_USERNAME: ${{ secrets.FOSSID_HOST_USERNAME }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 653da50..2437450 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,22 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [2.0.0](https://github.com/rdkcentral/data-model-cli/compare/1.0.0...2.0.0) + +- RDKB-61922: RDK Coverity cleanup for dmcli [`#11`](https://github.com/rdkcentral/data-model-cli/pull/11) +- Update CODEOWNERS [`#9`](https://github.com/rdkcentral/data-model-cli/pull/9) +- Deploy fossid_integration_stateless_diffscan_target_repo action [`#8`](https://github.com/rdkcentral/data-model-cli/pull/8) +- Deploy cla action [`#7`](https://github.com/rdkcentral/data-model-cli/pull/7) +- Update CODEOWNERS [`#6`](https://github.com/rdkcentral/data-model-cli/pull/6) +- Update run_ut.sh [`#3`](https://github.com/rdkcentral/data-model-cli/pull/3) +- Merge tag '1.0.0' into develop [`335d9ee`](https://github.com/rdkcentral/data-model-cli/commit/335d9ee75bc6ed165ee02b45b62968a4baa41117) + #### 1.0.0 -- Create CODEOWNERS [`#2`](https://github.com/rdkcentral/dbus-message-cli/pull/2) -- Create CONTRIBUTING.md [`#1`](https://github.com/rdkcentral/dbus-message-cli/pull/1) -- Import of source (stable2) [`b0267e3`](https://github.com/rdkcentral/dbus-message-cli/commit/b0267e36df445ec4dcfcd570f79f30aa906934b7) -- Deploy L1-tests action [`de8da21`](https://github.com/rdkcentral/dbus-message-cli/commit/de8da216c3b4c0005f274c5f2b7aee1a80f6eb6d) -- Deploy cla action [`f472d2d`](https://github.com/rdkcentral/dbus-message-cli/commit/f472d2da42e6fff6445f3dd20800abc983a5244d) +> 15 July 2025 + +- Create CODEOWNERS [`#2`](https://github.com/rdkcentral/data-model-cli/pull/2) +- Create CONTRIBUTING.md [`#1`](https://github.com/rdkcentral/data-model-cli/pull/1) +- Import of source (stable2) [`b0267e3`](https://github.com/rdkcentral/data-model-cli/commit/b0267e36df445ec4dcfcd570f79f30aa906934b7) +- Deploy L1-tests action [`de8da21`](https://github.com/rdkcentral/data-model-cli/commit/de8da216c3b4c0005f274c5f2b7aee1a80f6eb6d) +- Update CHANGELOG.md [`409214d`](https://github.com/rdkcentral/data-model-cli/commit/409214dabde7e93cf38f138dac6eb6e566467d08) diff --git a/source/MsgBusTestServer/cosa_MsgBusTest_dml.c b/source/MsgBusTestServer/cosa_MsgBusTest_dml.c index 9917c92..a34079f 100644 --- a/source/MsgBusTestServer/cosa_MsgBusTest_dml.c +++ b/source/MsgBusTestServer/cosa_MsgBusTest_dml.c @@ -82,7 +82,8 @@ BOOL MsgBusTest_SetParamStringValue(ANSC_HANDLE hInsContext, char* ParamName, ch ERR_CHK(rc); if ((!ind) && (rc == EOK)) { - AnscCopyString(ParamString, strValue); + memset(ParamString, 0, sizeof(ParamString)); + strncpy(ParamString, strValue, (sizeof(ParamString) - 1)); return TRUE; } diff --git a/source/MsgBusTestServer/ssp_main.c b/source/MsgBusTestServer/ssp_main.c index c9742a6..a4c9a2e 100644 --- a/source/MsgBusTestServer/ssp_main.c +++ b/source/MsgBusTestServer/ssp_main.c @@ -201,7 +201,7 @@ int main(int argc, char* argv[]) { if ((strcmp(argv[idx], "-subsys") == 0)) { - AnscCopyString(g_Subsystem, argv[idx+1]); + strncpy(g_Subsystem, argv[idx+1], (sizeof(g_Subsystem) - 1)); } else if (strcmp(argv[idx], "-c") == 0) { diff --git a/source/test/run_ut.sh b/source/test/run_ut.sh index 4ea4088..d2fa10b 100755 --- a/source/test/run_ut.sh +++ b/source/test/run_ut.sh @@ -27,41 +27,39 @@ log() { echo " " } -# Initialize branch variable with an if-else statement -branch=${BRANCH:-stable2} -log "INFO" "Using branch: $branch" - -# Check if RdkbGMock directory already exists +# Clone or enter RdkbGMock if [ -d "RdkbGMock" ]; then log "INFO" "RdkbGMock directory already exists. Skipping clone." cd RdkbGMock else - log "INFO" "RdkbGMock directory does not exist. Cloning repository..." - if git clone ssh://gerrit.teamccp.com:29418/rdk/rdkb/components/opensource/ccsp/RdkbGMock/generic RdkbGMock -b "$branch"; then - log "INFO" "Entering into RdkbGMock directory..." + log "INFO" "Cloning RdkbGMock repository from GitHub..." + # Use token for authentication if provided + if git clone -b "develop" "https://github.com/rdkcentral/gmock-broadband.git" RdkbGMock; then cd RdkbGMock else - log "ERROR" "Failed to clone RdkbGMock repository." + log "ERROR" "Failed to clone repository with branch: develop" exit 1 fi fi -# Check if change number/revision is provided +# Check if a pull request ID is provided in argument 1 if [ -n "$1" ]; then - change_revision=$1 - change_number=$(echo $change_revision | cut -d'/' -f1) - revision=$(echo $change_revision | cut -d'/' -f2) - last_two_digits=${change_number: -2} - - log "INFO" "Fetching and cherry-picking changes..." - if git fetch ssh://gerrit.teamccp.com:29418/rdk/rdkb/components/opensource/ccsp/RdkbGMock/generic refs/changes/"$last_two_digits"/"$change_number"/"$revision" && git cherry-pick FETCH_HEAD; then - log "INFO" "Changes fetched and cherry-picked successfully." + pr_id="$1" + log "INFO" "Fetching PR ID: $pr_id and checking out FETCH_HEAD" + if git fetch "https://github.com/rdkcentral/gmock-broadband.git" pull/"$pr_id"/head && git checkout FETCH_HEAD; then + log "INFO" "Successfully checked out PR #$pr_id" else - log "ERROR" "Failed to fetch and cherry-pick changes." + log "ERROR" "Failed to fetch or checkout PR #$pr_id" exit 1 fi else - log "INFO" "No change number/revision provided, skipping git fetch and cherry-pick." + log "INFO" "No PR ID provided. Fetching latest from branch: develop" + if git fetch "https://github.com/rdkcentral/gmock-broadband.git" develop && git checkout develop; then + log "INFO" "Checked out latest branch: develop" + else + log "ERROR" "Failed to fetch or checkout branch: develop" + exit 1 + fi fi log "INFO" "Start Running RdkbGMock Dependency Component Script..." @@ -87,7 +85,7 @@ else fi # Run configure with specific options -log "INFO" "Running configure with options --enable-gtestapp and --enable-unitTestDockerSupport..." +log "INFO" "Running configure with options --enable-unitTestDockerSupport..." if ./configure --enable-unitTestDockerSupport; then log "INFO" "Configuration successful." else @@ -100,32 +98,61 @@ if [ ! -f "${PWD}/RdkbGMock/docker_scripts/export_var.sh" ]; then log "ERROR" "RdkbGMock/docker_scripts/export_var.sh does not exist in the directory $PWD." exit 1 else - # Source the export_var.sh script from the current working directory source "RdkbGMock/docker_scripts/export_var.sh" - - # Log the paths set by the sourced script log "INFO" "C_INCLUDE_PATH is set to: $C_INCLUDE_PATH" log "INFO" "CPLUS_INCLUDE_PATH is set to: $CPLUS_INCLUDE_PATH" fi -# Run make for specific target -log "INFO" "Running make for CcspDmcliTest_gtest.bin..." -if make -C source/test/CcspDmcliTest; then - log "INFO" "Make operation completed successfully." -else - log "ERROR" "Make operation failed." - exit 1 -fi -log "INFO" "Completed running UT script." - log "INFO" "Preparing to run the Gtest Binary" -if [ -f "./source/test/CcspDmcliTest/CcspDmcliTest_gtest.bin" ]; then - log "INFO" "Running CcspDmcliTest_gtest.bin" - ./source/test/CcspDmcliTest/CcspDmcliTest_gtest.bin - log "INFO" "Completed Test Execution" -else - log "ERROR" "CcspDmcliTest_gtest.bin does not exist, cannot run tests" - exit 1 +# Generic function to build and run all gtest binaries under source/test and its subfolders +run_all_gtests() { + local test_dirs + local make_dir + local bin_files + local bin_file + + # Only include directories that contain a Makefile and do not contain makefile or GNUmakefile + test_dirs=( $(find source/test -type f -name 'Makefile' -exec dirname {} \; | sort -u) ) + + for make_dir in "${test_dirs[@]}"; do + log "INFO" "Running make in $make_dir..." + if make -C "$make_dir"; then + log "INFO" "Make operation completed successfully in $make_dir." + else + log "ERROR" "Make operation failed in $make_dir." + exit 1 + fi + done + + log "INFO" "Completed running all make operations." + + # Find all .bin files under source/test and its subfolders + bin_files=( $(find source/test -type f -name "*.bin") ) + + if [[ ${#bin_files[@]} -eq 0 ]]; then + log "ERROR" "No .bin files found under source/test, cannot run tests" + exit 1 + fi + + for bin_file in "${bin_files[@]}"; do + if [[ -x "$bin_file" ]]; then + log "INFO" "Running $(basename "$bin_file")" + "$bin_file" + log "INFO" "Completed Test Execution for $(basename "$bin_file")" + else + log "ERROR" "$(basename "$bin_file") is not executable, skipping" + fi + done +} + +# Call the generic function to build and run all gtest binaries +run_all_gtests + +# Check if coverage.info exists before filtering +if [ -f coverage.info ] || [ -d out ]; then + log "INFO" "Removing existing coverage.info and/or out directory" + [ -f coverage.info ] && rm -f coverage.info + [ -d out ] && rm -rf out fi log "INFO" "Starting Gcov for code coverage analysis"