Skip to content

mtdlog: test cases for mtdlog driver.#3396

Closed
Kaben123 wants to merge 2 commits intoapache:masterfrom
Kaben123:driver-mtd-log
Closed

mtdlog: test cases for mtdlog driver.#3396
Kaben123 wants to merge 2 commits intoapache:masterfrom
Kaben123:driver-mtd-log

Conversation

@Kaben123
Copy link

@Kaben123 Kaben123 commented Feb 3, 2026

The tests cover basic read/write operations, ioctl interface, and log/block group management.
These tests help ensure the reliability and correctness of the mtdlog driver.

Note: Please adhere to Contributing Guidelines.

Summary

This pull request adds comprehensive unit tests for the mtdlog driver in NuttX apps, located under testing/drivers/drivertest/. The new test file drivertest_mtd_log.c uses the cmocka framework to verify the functionality of the mtdlog driver, including:

  • Basic read and write operations to /dev/mtdlog
  • Validation of ioctl interfaces (block info, log info, log count, group count, status)
  • Log entry and block group management
  • Data integrity checks between written and read data

The corresponding build system files (CMakeLists.txt and Makefile) are updated to include the new test when CONFIG_MTDLOG is enabled.

Impact

  • Improves test coverage for the mtdlog driver
  • No impact on production code; changes are limited to test sources and build scripts
  • No breaking changes or compatibility issues

Testing

  • The tests are built and executed with CONFIG_MTDLOG enabled
  • All test cases pass on supported hardware and emulation environments
  • Example test output:
    [==========] Running 3 test(s).
    [ RUN      ] drivertest_mtdlog_case1
    [       OK ] drivertest_mtdlog_case1
    [ RUN      ] drivertest_mtdlog_case2
    [       OK ] drivertest_mtdlog_case2
    [ RUN      ] drivertest_mtdlog_case3
    [       OK ] drivertest_mtdlog_case3
    [==========] 3 test(s) run.
    [  PASSED  ] 3 test(s).
    

The tests cover basic read/write operations, ioctl interface,
and log/block group management.
These tests help ensure the reliability and correctness of the
mtdlog driver.

Signed-off-by: yukangzhi <[email protected]>
This commit adds a new test case to the mtdlog driver tests, verifying the
writing and reading of data with different sizes. The test ensures the
mtdlog driver can handle variable-length data correctly and robustly.

Signed-off-by: yukangzhi <[email protected]>
@Kaben123
Copy link
Author

Kaben123 commented Feb 3, 2026

No need to commit to upstream yet.

@Kaben123 Kaben123 closed this Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant