Repository navigation
RDKEMW-26925 : L1 unit tests #64
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: L1-tests | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| L1-tests: | ||
| name: Build and run L1 unit tests | ||
| runs-on: ubuntu-22.04 | ||
| container: | ||
| image: ghcr.io/rdkcentral/docker-rdk-ci:latest | ||
| steps: | ||
| - name: Checkout sys_mon_tools | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Prepare RDK build dependencies | ||
| run: ./build_dependencies.sh | ||
|
|
||
| - name: Install coverage tools | ||
| run: | | ||
| apt-get update | ||
| apt-get install -y lcov | ||
|
|
||
| - name: Build and run L1 tests | ||
| run: bash ./tests/run_l1_tests.sh | ||
|
|
||
| - name: Generate coverage report | ||
| if: success() | ||
| run: | | ||
| lcov --capture --directory . --output-file coverage.info | ||
| lcov --remove coverage.info '/usr/*' '*/tests/*' '*/stubs/*' --output-file filtered_coverage.info | ||
| genhtml filtered_coverage.info --output-directory coverage --title "sys_mon_tools L1 coverage" | ||
| lcov --summary filtered_coverage.info | ||
|
|
||
| - name: Upload L1 artifacts | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: artifacts-L1-sys_mon_tools | ||
| path: | | ||
| coverage/ | ||
| filtered_coverage.info | ||
| tests/test-suite.log | ||
| if-no-files-found: warn | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| name: tests-trigger | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, develop, 'sprint/**', 'release/**' ] | ||
| pull_request: | ||
| branches: [ main, develop, 'sprint/**', 'release/**', 'topic/RDK*', 'feature/RDK*' ] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| trigger-L1: | ||
| uses: ./.github/workflows/L1-tests.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| EXTRA_DIST = \ | ||
|
hgfell683 marked this conversation as resolved.
|
||
| run_l1_tests.sh \ | ||
| test_iarm_event_sender.c \ | ||
| test_key_simulator.c \ | ||
| test_legacy_key_simulator.c \ | ||
| test_mfr_utils.c \ | ||
| test_power_state_monitor.c \ | ||
| test_query_power_state.c \ | ||
| test_set_power_state.c \ | ||
| test_uinput.c \ | ||
| test_uinput_main.c \ | ||
| mocks/libCMAF.h \ | ||
| mocks/uidev.h | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #ifndef TEST_MOCK_LIB_CMAF_H | ||
| #define TEST_MOCK_LIB_CMAF_H | ||
|
|
||
| #include <stddef.h> | ||
|
|
||
| typedef enum { | ||
| CMAF_RESULT_SUCCESS = 0, | ||
| CMAF_RESULT_INVALID_PARAM = 1 | ||
| } CMAF_Result_t; | ||
|
|
||
| typedef enum { | ||
| CMAF_MEMTYPE_PROCESSSHARE = 0 | ||
| } CMAF_MemType_t; | ||
|
|
||
| typedef int CMAF_EventId_t; | ||
|
|
||
| CMAF_Result_t CMAF_Init(const char *group_name, const char *program_name, void **context); | ||
| CMAF_Result_t CMAF_Malloc(void *context, CMAF_MemType_t memory_type, size_t size, void **buffer); | ||
| CMAF_Result_t CMAF_NotifyEvent(void *context, CMAF_EventId_t event_id, void *event_data); | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #ifndef TEST_MOCK_UIDEV_H | ||
| #define TEST_MOCK_UIDEV_H | ||
|
|
||
| #define UIDEV_PROCESSGROUP_NAME "UIEventSimulator" | ||
| #define UIDEV_EVENT_IRKEY 1 | ||
|
|
||
| typedef struct { | ||
| int keyType; | ||
| int keyCode; | ||
| } UIDev_IRKeyData_t; | ||
|
|
||
| typedef struct { | ||
| int id; | ||
| union { | ||
| UIDev_IRKeyData_t irkey; | ||
| } data; | ||
| } UIDev_EventData_t; | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #!/bin/bash | ||
| set -ex | ||
|
|
||
| WORKDIR="$(pwd)" | ||
| ROOT=/usr | ||
| IARMBUS_PATH="$ROOT/iarmbus" | ||
| IARMMGRS_PATH="$ROOT/iarmmgrs" | ||
|
|
||
| export CFLAGS="-O2 -Wall -fPIC --coverage -I./include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include -I/usr/local/include -I${WORKDIR}/stubs -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/libsoup-2.4 -I/usr/include/gssdp-1.0" | ||
| export CC=gcc | ||
|
|
||
| BUILD_AM_CPPFLAGS="-I${WORKDIR}/stubs -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libsoup-3.0 -I/usr/local/include -I${IARMMGRS_PATH}/sysmgr/include -I${IARMBUS_PATH}/core -I${IARMBUS_PATH}/core/include -I${IARMMGRS_PATH}/hal/include -I${IARMMGRS_PATH}/mfr/include -I${IARMMGRS_PATH}/mfr/common/include -I${ROOT}/devicesettings/rpc/include -I${ROOT}/rdk-halif-device_settings/include" | ||
|
|
||
| GLIB_CFLAGS="$(pkg-config --cflags glib-2.0)" | ||
| GLIB_LIBS="$(pkg-config --libs glib-2.0)" | ||
|
|
||
| build_and_run() | ||
| { | ||
| test_name="$1" | ||
| test_source="$2" | ||
| test_cflags="$3" | ||
| test_libs="$4" | ||
| ${CC} ${CFLAGS} ${BUILD_AM_CPPFLAGS} ${test_cflags} -o "${WORKDIR}/tests/${test_name}" "${WORKDIR}/tests/${test_source}" ${test_libs} | ||
| "${WORKDIR}/tests/${test_name}" | ||
| } | ||
|
|
||
| build_and_run l1_uinput_tests test_uinput_main.c "-DUINPUT_VERSION=5 -I${WORKDIR}/key_simulator" "" | ||
| build_and_run test_set_power_state test_set_power_state.c "" "-lpthread" | ||
| build_and_run test_query_power_state test_query_power_state.c "" "" | ||
| build_and_run test_mfr_utils test_mfr_utils.c "" "" | ||
| build_and_run test_key_simulator test_key_simulator.c "-I${WORKDIR}/key_simulator" "" | ||
| build_and_run test_iarm_event_sender test_iarm_event_sender.c "${GLIB_CFLAGS}" "${GLIB_LIBS}" | ||
| build_and_run test_power_state_monitor test_power_state_monitor.c "${GLIB_CFLAGS}" "${GLIB_LIBS} -lpthread" | ||
| build_and_run test_legacy_key_simulator test_legacy_key_simulator.c "-I${WORKDIR}/key_simulator -I${WORKDIR}/tests/mocks" "" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.