test: convert LIST unit tests from CMock to Ztest framework by tmleman · Pull Request #10066 · thesofproject/sof · GitHub
Skip to content

test: convert LIST unit tests from CMock to Ztest framework#10066

Merged
lgirdwood merged 2 commits into
thesofproject:mainfrom
tmleman:topic/upstream/pr/unit_test/poc/ztest/list
Jul 16, 2025
Merged

test: convert LIST unit tests from CMock to Ztest framework#10066
lgirdwood merged 2 commits into
thesofproject:mainfrom
tmleman:topic/upstream/pr/unit_test/poc/ztest/list

Conversation

@tmleman

@tmleman tmleman commented Jun 23, 2025

Copy link
Copy Markdown
Contributor

This commit converts the legacy LIST unit tests from the CMock test framework to the Zephyr Ztest framework. The converted tests maintain the same test coverage while adhering to SOF and Zephyr coding standards.

All list operations are covered:

  • list_init
  • list_is_empty
  • list_item_append
  • list_item_prepend
  • list_item_del
  • list_item_is_last

Tests can be run with:

west twister --testsuite-root sof/test/ztest/unit/list/ --platform native_sim

@tmleman tmleman added the DNM Do Not Merge tag label Jun 23, 2025
@tmleman

tmleman commented Jun 23, 2025

Copy link
Copy Markdown
Contributor Author

@tmleman tmleman changed the title [SKIP SOFCI-TEST] test: convert LIST unit tests from CMocka to Ztest framework [SKIP SOFCI-TEST] test: convert LIST unit tests from CMock to Ztest framework Jun 23, 2025
Comment thread test/ztest/unit/list/test_list_ztest.c Outdated
Comment thread test/ztest/unit/list/test_list_ztest.c Outdated

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM - great idea !

@tmleman tmleman force-pushed the topic/upstream/pr/unit_test/poc/ztest/list branch 13 times, most recently from b8300ff to 9f07951 Compare July 11, 2025 15:34
@tmleman tmleman changed the title [SKIP SOFCI-TEST] test: convert LIST unit tests from CMock to Ztest framework test: convert LIST unit tests from CMock to Ztest framework Jul 11, 2025
@tmleman tmleman marked this pull request as ready for review July 11, 2025 15:35
@tmleman tmleman added DNM Do Not Merge tag and removed DNM Do Not Merge tag labels Jul 14, 2025
@tmleman tmleman force-pushed the topic/upstream/pr/unit_test/poc/ztest/list branch from 9f07951 to 2c36807 Compare July 14, 2025 09:24
@tmleman tmleman removed the DNM Do Not Merge tag label Jul 14, 2025
tmleman added 2 commits July 14, 2025 12:43
This commit converts the legacy LIST unit tests from the CMocka/Unity
test framework to the Zephyr Ztest framework. The converted tests maintain
the same test coverage while adhering to SOF and Zephyr coding standards.

The test code was generated with assistance from GitHub Copilot AI.
Test flow and test coverage scope is based on the existing CMocka tests
located at sof/test/cmocka/src/list.

All list operations are covered:
- list_init
- list_is_empty
- list_item_append
- list_item_prepend
- list_item_del
- list_item_is_last

Tests can be run with:

west twister --testsuite-root sof/test/ztest/unit/ --platform \
	native_sim --verbose --inline-logs

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
This commit introduces a functional CI workflow that builds and executes
SOF unit tests that have been ported from cmocka to Zephyr ztest.

Key features:
- Targets native_sim platform for unit test execution
- Installs minimal dependencies: clang, llvm, ninja-build,
  device-tree-compiler
- Includes multilib support (gcc-multilib/g++-multilib) for i386
  native_sim
- Runs tests using west twister with verbose output and inline logs
- 10-minute timeout for efficient CI resource usage
- Proper concurrency control to cancel previous runs

The workflow has been tested and verified to work in CI environment.
It provides a foundation for continuous integration of SOF unit tests
without requiring the full Zephyr SDK installation, making it faster
and more resource-efficient.

Future iterations can extend this workflow to include additional
test suites and platforms as they are developed.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
@lgirdwood

Copy link
Copy Markdown
Member

@wszypelt good to merge ? not expecting this code to run in internal CI.

@wszypelt

Copy link
Copy Markdown

@lgirdwood lgirdwood merged commit a7e7df8 into thesofproject:main Jul 16, 2025
40 of 45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants