Skip to content
Open
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7dfcd39
RDKEMW-18082: ctrlm coverity cleanup
msmith113 May 6, 2026
d662739
Testing removing xlog_ci_compat.h
msmith113 May 6, 2026
e1b5beb
Calling cmake on xr-voice-sdk for headers
msmith113 May 6, 2026
950a494
Test
msmith113 May 6, 2026
68debec
Fixing xr-voice-sdk cmake run
msmith113 May 6, 2026
de998e7
Another fix
msmith113 May 6, 2026
33b07b6
Addressing copilot comment about missing includes
msmith113 May 6, 2026
755f661
Removing unused var
msmith113 May 6, 2026
f28a94d
Update
msmith113 May 7, 2026
03c2ff8
Removing sefec mock
msmith113 May 7, 2026
bce2fb3
Fix
msmith113 May 7, 2026
eca9dde
Updates
msmith113 May 7, 2026
2baae1d
Test
msmith113 May 8, 2026
4bd79b1
Update
msmith113 May 8, 2026
0593333
Test
msmith113 May 8, 2026
b61a90d
Fix
msmith113 May 8, 2026
995c93b
Update
msmith113 May 8, 2026
a0595cb
Update to prevent warning from copied safec header
msmith113 May 8, 2026
a55c533
Test
msmith113 May 8, 2026
37bf0e9
Test
msmith113 May 8, 2026
6bb6049
Testing
msmith113 May 8, 2026
72bf7ca
Update
msmith113 May 8, 2026
f506840
Test
msmith113 May 11, 2026
95695a2
Updates
msmith113 May 11, 2026
93041b5
Update
msmith113 May 28, 2026
2255d47
Test
msmith113 May 28, 2026
1f6d6a2
Fix
msmith113 May 28, 2026
830304a
Update
msmith113 May 28, 2026
dd517be
Test
msmith113 May 28, 2026
b1f0c4a
Updates
msmith113 Jun 1, 2026
98aeaba
Adding guards around samples_per_packet instead of commenting
msmith113 Jun 1, 2026
3149a74
Updates
msmith113 Jun 1, 2026
842403b
testing VAD_ENABLED feature to remove webrtc dependency during native…
msmith113 Jun 1, 2026
05b51cb
Fixing coverity warning due to the safec wrappers and workarounds in ci
msmith113 Jun 2, 2026
0e96807
Test
msmith113 Jun 2, 2026
1a4e112
Updates
msmith113 Jun 2, 2026
21fc86d
Updates
msmith113 Jun 2, 2026
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
104 changes: 60 additions & 44 deletions ci/build_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ git config --global --add safe.directory "${GITHUB_WORKSPACE}"

# #############################
# 1. Install Dependencies and packages
echo "======================================================================================"

apt update
apt install -y \
Expand All @@ -43,22 +44,21 @@ apt install -y \
uuid-dev \
libevdev-dev \
libdrm-dev \
libsafec-dev \
python3-pip
libbsd-dev \
gperf \
python3-pip \
libwebrtc-audio-processing-dev
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.

I'm sure this works, but perhaps we should consider disabling this dependency via the cmake call. Thoughts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm onboard with removing as many dependencies as needed to have the simplest native build in ci. Are you suggesting adding a cmake option for webrtc and enable/disable with include guards or something else?

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.

Close. I'm saying adding a cmake option for the VAD feature "VAD_ENABLED" so that when disabled webrtc is not required.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've made changes to add VAD_ENABLED in xr-voice-sdk and disabled including the webrtc dependency during ci build. Let me know if this is what you had in mind.


python3 -m pip install jsonref

###########################################
# 2. Clone the required repositories

XRSDK_REF="1.0.13"
git clone --depth 1 --filter=blob:none --branch "${XRSDK_REF}" https://github.com/rdkcentral/xr-voice-sdk.git
# Will uncomment the following lines and update the branch to main once the changes in feature/RDKEMW-18082 are merged and released.
# git clone --depth 1 --filter=blob:none https://github.com/rdkcentral/xr-voice-sdk.git
git clone --depth 1 --filter=blob:none --branch feature/RDKEMW-18082 https://github.com/rdkcentral/xr-voice-sdk.git

git clone --depth 1 --filter=blob:none --branch develop https://github.com/rdkcentral/entservices-testframework.git

# Patch the upstream testframework devicesettings.h with ctrlm-specific
# additions (ducking types, setAudioDucking, Manager::IsInitialized).
# We can remove this if added to upstream testframework
git -C entservices-testframework apply "$GITHUB_WORKSPACE/ci/mocks/devicesettings_ctrlm.patch"
git clone --depth 1 --filter=blob:none --branch feature/RDKEMW-18082 https://github.com/rdkcentral/entservices-testframework.git

Comment thread
msmith113 marked this conversation as resolved.
git clone --depth 1 --filter=blob:none --sparse --branch develop https://github.com/rdkcentral/iarmmgrs.git
git -C iarmmgrs sparse-checkout set hal
Expand All @@ -72,41 +72,63 @@ git -C rdk-halif-power_manager sparse-checkout set include
git clone --depth 1 --filter=blob:none --sparse --branch develop https://github.com/rdkcentral/rdkversion.git
git -C rdkversion sparse-checkout set src

git clone --depth 1 --filter=blob:none --sparse https://github.com/rdkcentral/meta-rdk-oss-reference.git
git -C meta-rdk-oss-reference sparse-checkout set recipes-common/safec-common-wrapper/files

IARMMGRS_DIR="$GITHUB_WORKSPACE/iarmmgrs"
DEEPSLEEP_HAL_DIR="$GITHUB_WORKSPACE/rdk-halif-deepsleep_manager"
POWER_HAL_DIR="$GITHUB_WORKSPACE/rdk-halif-power_manager"
RDKVERSION_DIR="$GITHUB_WORKSPACE/rdkversion"
SAFEC_WRAPPER_DIR="$GITHUB_WORKSPACE/meta-rdk-oss-reference/recipes-common/safec-common-wrapper/files"

############################
# 3. Create stub/empty headers for external dependencies
echo "======================================================================================"
echo "Creating stub headers"

HEADERS_DIR="$GITHUB_WORKSPACE/ci/headers"
XRSDK_HEADERS_DIR="$HEADERS_DIR/xr-voice-sdk"
mkdir -p "${HEADERS_DIR}"
mkdir -p "${HEADERS_DIR}/rdk/iarmbus"
mkdir -p "${HEADERS_DIR}/rdk/ds"
mkdir -p "${HEADERS_DIR}/rdk/iarmmgrs-hal"
mkdir -p "${XRSDK_HEADERS_DIR}"

# Copy real xr-voice-sdk headers.
# xr_fdc.h is NOT copied: only needed when FDC_ENABLED=ON
cp "$GITHUB_WORKSPACE/xr-voice-sdk/src/xr-speech-vrex/xrsv.h" "${XRSDK_HEADERS_DIR}/"
cp "$GITHUB_WORKSPACE/xr-voice-sdk/src/xr-speech-router/xrsr.h" "${XRSDK_HEADERS_DIR}/"
cp "$GITHUB_WORKSPACE/xr-voice-sdk/src/xr-mq/xr_mq.h" "${XRSDK_HEADERS_DIR}/"
cp "$GITHUB_WORKSPACE/xr-voice-sdk/src/xr-speech-vrex/xrsv_http/xrsv_http.h" "${XRSDK_HEADERS_DIR}/"
cp "$GITHUB_WORKSPACE/xr-voice-sdk/src/xr-speech-vrex/xrsv_ws_nextgen/xrsv_ws_nextgen.h" "${XRSDK_HEADERS_DIR}/"
cp "$GITHUB_WORKSPACE/xr-voice-sdk/src/xr-timestamp/xr_timestamp.h" "${XRSDK_HEADERS_DIR}/"

# Generate rdkx_logger_modules.h from xr-voice-sdk's module configuration,
# then copy the real rdkx_logger and xr_voice_sdk headers.
# This replaces the hand-written ci/mocks/control/ stubs.
python3 "$GITHUB_WORKSPACE/xr-voice-sdk/scripts/rdkx_logger_modules_to_c.py" \
"$GITHUB_WORKSPACE/xr-voice-sdk/src/xr-logger/rdkv/rdkx_logger_modules.json" \
"${XRSDK_HEADERS_DIR}/rdkx_logger_modules" "mw"
cp "$GITHUB_WORKSPACE/xr-voice-sdk/src/xr-logger/rdkx_logger_mw.h" "${XRSDK_HEADERS_DIR}/rdkx_logger.h"
cp "$GITHUB_WORKSPACE/xr-voice-sdk/src/xr_voice_sdk.h" "${XRSDK_HEADERS_DIR}/xr_voice_sdk.h"

# Symlink to match expected include path for audio_processing.h
Comment thread
msmith113 marked this conversation as resolved.
Outdated
mkdir -p /usr/include/webrtc/modules/audio_processing/include/
ln -sf /usr/include/webrtc_audio_processing/webrtc/modules/audio_processing/include/audio_processing.h /usr/include/webrtc/modules/audio_processing/include/audio_processing.h

# Use the Yocto safec_lib.h sysroot header for CI builds without libsafec.
# Add include guards because the upstream header does not provide them.
cp "$SAFEC_WRAPPER_DIR/safec_lib.h" "$HEADERS_DIR/safec_lib.h"
sed -i '1s/^/#ifndef CTRLM_CI_SAFEC_LIB_H\n#define CTRLM_CI_SAFEC_LIB_H\n/' "$HEADERS_DIR/safec_lib.h"
printf '\n#endif /* CTRLM_CI_SAFEC_LIB_H */\n' >> "$HEADERS_DIR/safec_lib.h"
# patching parseFormat to avoid -Wmaybe-uninitialized warnings in ctrlm_database.cpp from the safec wrapper's dummy implementation
sed -i 's/static inline int parseFormat(const char \*dst,/static inline int parseFormat(char *dst,/' "$HEADERS_DIR/safec_lib.h"
# patching strncpy_s to avoid the wrapper's raw strncpy expansion, which triggers
# -Wstringop-truncation in CI even though ctrlm manually terminates the destination buffer.
perl -0pi -e 's{#define strncpy_s\(dst,max,src,len\) \(src != NULL\)\?\(\(len <= max\)\?EOK:ESLEMAX\):ESNULLP; \\\n if\(\(src != NULL\) && \(len <= max\)\) strncpy\(dst,src,len\);}{#define strncpy_s(dst,max,src,len) (src != NULL)?((len <= max)?EOK:ESLEMAX):ESNULLP; \\\n if((src != NULL) && (len <= max)) { size_t copy_len = strnlen(src, len); memcpy(dst, src, copy_len); if(copy_len < (size_t)(max)) memset((char *)(dst) + copy_len, 0, (size_t)(max) - copy_len); }}s or die "failed to patch strncpy_s in safec_lib.h\n"' "$HEADERS_DIR/safec_lib.h"

# Stage rdkversion.h before building xr-voice-sdk.
cp "$RDKVERSION_DIR/src/rdkversion.h" "$HEADERS_DIR/rdkversion.h"

# Build xr-voice-sdk and install its headers under ${HEADERS_DIR}/xr-voice-sdk/.
# Version doesn't matter here, but we try to get the latest tag for good measure since it's included in the generated headers and may be used by downstream code.
XRSDK_REF=$(git ls-remote --tags https://github.com/rdkcentral/xr-voice-sdk.git \
| grep -oP '\d+\.\d+\.\d+$' | sort -V | tail -1)
echo "Building xr-voice-sdk at ref ${XRSDK_REF}"
cmake -G Ninja \
-S "$GITHUB_WORKSPACE/xr-voice-sdk" \
-B "$GITHUB_WORKSPACE/build/xr-voice-sdk" \
-DCMAKE_INSTALL_PREFIX="${HEADERS_DIR}" \
-DCMAKE_INSTALL_INCLUDEDIR="xr-voice-sdk" \
-DCMAKE_INSTALL_SYSCONFDIR="${HEADERS_DIR}/etc" \
-DCMAKE_C_FLAGS="-I${HEADERS_DIR} -DSAFEC_DUMMY_API" \
-DSTAGING_BINDIR_NATIVE="/usr/bin" \
-DCMAKE_PROJECT_VERSION="${XRSDK_REF}" \
-DINSTALL_INTERNAL_HEADERS=ON

cmake --build "$GITHUB_WORKSPACE/build/xr-voice-sdk"
cmake --install "$GITHUB_WORKSPACE/build/xr-voice-sdk" --component headers
cmake --install "$GITHUB_WORKSPACE/build/xr-voice-sdk" --component internal-headers

cd "${HEADERS_DIR}"

Expand All @@ -116,10 +138,7 @@ touch rdk/iarmbus/libIBus.h
touch rdk/iarmbus/libIBusDaemon.h

# IARM manager headers
# sysMgr.h conflicts with the forced Iarm.h mock, which already provides the
# needed SYSMgr types. Use a shim here. To remove it later, either stop
# force-including those overlapping Iarm.h declarations or drop sysMgr.h from
# ctrlm source.
# sysMgr.h conflicts with the forced Iarm.h mock, so use a shim instead.
cat > rdk/iarmmgrs-hal/sysMgr.h <<'EOF'
#ifndef CTRLM_CI_SYSMGR_SHIM_H
#define CTRLM_CI_SYSMGR_SHIM_H
Expand Down Expand Up @@ -159,17 +178,12 @@ touch rfcapi.h
find "$IARMMGRS_DIR" -name comcastIrKeyCodes.h -print -quit | xargs -r -I{} cp "{}" comcastIrKeyCodes.h
[ -f comcastIrKeyCodes.h ]

# rdkversion.h (used by ctrlm_main.cpp)
cp "$RDKVERSION_DIR/src/rdkversion.h" rdkversion.h
# rdkversion.h (used by ctrlm_main.cpp and xr-voice-sdk)
[ -f rdkversion.h ]

# secure_wrapper (types provided via empty stub — no v_secure_* calls in core)
touch secure_wrapper.h

# safec compatibility header - committed in ci/mocks, copied here so it is
# resolved on the generated-headers include path.
cp "$GITHUB_WORKSPACE/ci/mocks/safec_lib.h" safec_lib.h

echo "Stub headers created successfully"

cd "${GITHUB_WORKSPACE}"
Expand All @@ -190,13 +204,15 @@ cat > /tmp/stub.c << 'STUB_EOF'
void __stub_placeholder(void) {}
STUB_EOF

# Build stub .so for each missing library
# nopoll and dshalcli are unused (factory-only) but unconditionally linked by CMakeLists.txt
# We can remove them from the link list in the future if desired, but for now just provide stubs to satisfy the linker.
for lib in xr-voice-sdk rdkversion IARMBus ds nopoll dshalcli rfcapi secure_wrapper evdev; do
# Build stub .so files for libraries still linked in CI.
# nopoll and dshalcli are factory-only but still linked unconditionally.
for lib in rdkversion IARMBus ds nopoll dshalcli rfcapi secure_wrapper evdev; do
gcc -shared -fPIC -o "${STUB_LIB_DIR}/lib${lib}.so" /tmp/stub.c
done

# Copy the real xr-voice-sdk .so alongside the stubs.
cp "$GITHUB_WORKSPACE/build/xr-voice-sdk/src/libxr-voice-sdk.so" "${STUB_LIB_DIR}/libxr-voice-sdk.so"

rm /tmp/stub.c

echo "Stub libraries created in ${STUB_LIB_DIR}"
Expand Down
4 changes: 0 additions & 4 deletions ci/cov_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ ls -la "${GITHUB_WORKSPACE}"
echo "building control (ctrlm-main)"

XRSDK_REAL_HEADERS="$GITHUB_WORKSPACE/ci/headers/xr-voice-sdk"
XLOG_COMPAT="$GITHUB_WORKSPACE/ci/mocks/xlog_ci_compat.h"
MOCK_DIR="$GITHUB_WORKSPACE/entservices-testframework/Tests/mocks"
MOCK_OVERRIDES="$GITHUB_WORKSPACE/ci/mocks/testframework_overrides.h"
HEADERS_DIR="$GITHUB_WORKSPACE/ci/headers"
EMPTY_JSON="$GITHUB_WORKSPACE/install/usr/include/ctrlm_config_empty.json"
GLIB_CFLAGS="$(pkg-config --cflags glib-2.0)"
Expand Down Expand Up @@ -77,9 +75,7 @@ cmake -G Ninja -S "$GITHUB_WORKSPACE" -B build/control \
-I ${GITHUB_WORKSPACE}/install/usr/include \
-I /usr/include/libdrm \
${GLIB_CFLAGS} \
-include ${XLOG_COMPAT} \
-include ${MOCK_DIR}/Iarm.h \
-include ${MOCK_OVERRIDES} \
-include ${MOCK_DIR}/devicesettings.h \
-include ${MOCK_DIR}/Rfc.h \
-Wall -Wno-error \
Expand Down
40 changes: 0 additions & 40 deletions ci/mocks/devicesettings_ctrlm.patch

This file was deleted.

44 changes: 0 additions & 44 deletions ci/mocks/safec_lib.h

This file was deleted.

48 changes: 0 additions & 48 deletions ci/mocks/testframework_overrides.h

This file was deleted.

42 changes: 0 additions & 42 deletions ci/mocks/xlog_ci_compat.h

This file was deleted.

6 changes: 6 additions & 0 deletions src/ctrlm_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <archive.h>
#include <algorithm>
#include <cctype>
#include <tuple>
#include "ctrlm.h"
#include "ctrlm_utils.h"
#include <xr_mq.h>
Expand All @@ -47,6 +48,11 @@
#include <regex>
// end dsMgr includes

using std::get;
using std::map;
using std::string;
using std::tuple;
Comment thread
msmith113 marked this conversation as resolved.

#define BLOCK_SIZE (1024 * 4 * 10) /* bytes */
#define MAX_RECURSE_DEPTH 20

Expand Down
Loading
Loading