Skip to content

Conversation

@ThePassionate
Copy link
Contributor

@ThePassionate ThePassionate commented Jan 28, 2026

NuttX Simulator: Enable CMocka Testing Framework for Crypto Configuration

Overview

Enable CMocka unit testing framework support in the simulator's crypto configuration by adding required libc dependencies. This allows crypto test cases from nuttx-apps that depend on the CMocka framework to properly build and execute on the NuttX simulator.

Changes

Modified boards/sim/sim/sim/configs/crypto/defconfig to enable:

  • CONFIG_ALLOW_MIT_COMPONENTS=y - Allow MIT licensed components
  • CONFIG_LIBC_REGEX=y - Enable regex library (CMocka dependency)
  • CONFIG_TESTING_CMOCKA=y - Enable CMocka unit testing framework

Rationale

The nuttx-apps crypto testing module has been modernized to use CMocka unit testing framework instead of CLI-based tests. To support this on the NuttX simulator, the required dependencies must be available in the crypto configuration.

Dependency Chain

CONFIG_TESTING_CRYPTO (nuttx-apps)
↓ depends on
CONFIG_TESTING_CMOCKA (nuttx-apps)
↓ depends on
CONFIG_LIBC_REGEX (nuttx)
↓ depends on
CONFIG_ALLOW_MIT_COMPONENTS (nuttx)

Testing

This configuration change enables proper CI builds and execution of crypto tests that utilize the CMocka framework on the NuttX simulator without stripping the required testing configuration.

Related

- NuttX-Apps PR: apps-features branch (cmocka-based crypto testing)

@github-actions github-actions bot added Board: simulator Size: XS The size of the change in this PR is very small labels Jan 28, 2026
acassis
acassis previously approved these changes Jan 28, 2026
@acassis
Copy link
Contributor

acassis commented Jan 28, 2026

@ThePassionate you need to normalize all SIM profiles to avoid errors like this:

HEAD detached at pull/18251/merge
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   boards/sim/sim/sim/configs/crypto/defconfig

You can use this command:

$ ./tools/refresh.sh --silent board:sim

@ThePassionate ThePassionate dismissed stale reviews from acassis and xiaoxiang781216 via f526626 January 29, 2026 03:17
@ThePassionate ThePassionate force-pushed the sim-crypto-testing branch 3 times, most recently from 42046a6 to 29b133e Compare January 29, 2026 03:20
@ThePassionate
Copy link
Contributor Author

ThePassionate commented Jan 29, 2026

@ThePassionate you need to normalize all SIM profiles to avoid errors like this:

HEAD detached at pull/18251/merge
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   boards/sim/sim/sim/configs/crypto/defconfig

You can use this command:

$ ./tools/refresh.sh --silent board:sim

@acassis Thanks, but i found change in almost every defconfig. Shell i commit all result of the nomalization?

image

or just need to fix sim:crypto configure.

@xiaoxiang781216
Copy link
Contributor

@ThePassionate you need to normalize all SIM profiles to avoid errors like this:

HEAD detached at pull/18251/merge
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   boards/sim/sim/sim/configs/crypto/defconfig

You can use this command:

$ ./tools/refresh.sh --silent board:sim

@acassis Thanks, but i found change in almost every defconfig. Shell i commit all result of the nomalization?

image or just need to fix sim:crypto configure.

don't change the unrelated file

@ThePassionate
Copy link
Contributor Author

@ThePassionate you need to normalize all SIM profiles to avoid errors like this:

HEAD detached at pull/18251/merge
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   boards/sim/sim/sim/configs/crypto/defconfig

You can use this command:

$ ./tools/refresh.sh --silent board:sim

@acassis Thanks, but i found change in almost every defconfig. Shell i commit all result of the nomalization?
image
or just need to fix sim:crypto configure.

don't change the unrelated file

I got it! Let me try.

Enable CMocka unit testing framework in the simulator crypto configuration.
This requires enabling the following dependencies:
- CONFIG_ALLOW_MIT_COMPONENTS: Allow MIT licensed components
- CONFIG_LIBC_REGEX: Regular expression support needed by CMocka
- CONFIG_TESTING_CMOCKA: CMocka unit testing framework
- CONFIG_TESTING_CRYPTO: Crypto testing support

Signed-off-by: makejian <makejian@xiaomi.com>
@xiaoxiang781216 xiaoxiang781216 merged commit d9c6353 into apache:master Jan 29, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Board: simulator Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants