linguini1 opened a new pull request, #3270:
URL: https://github.com/apache/nuttx-apps/pull/3270
## Summary
This commit introduces a Kconfig switch to include the cmocka binary built
from cmocka_main.c. The default behaviour is now changed so that cmocka is
built as a library only, which would be the desired behaviour for users
creating their own cmocka projects.
## Impact
Cmocka is now only built as a library, so the `cmocka` binary is no longer
included by default.
PR # to the NuttX kernel preserves the compilation of the `cmocka` binary for
the two existing defconfigs which use the cmocka application.
## Testing
Compilation of the cmocka libary without the binary using `sim:nsh` as a
basis:
```console
$ make -j
Create version.h
LN: platform/board to /home/linguini/coding/nuttx-space/apps/platform/dummy
Register: dd
Register: nsh
Register: sh
Register: gcov
Register: hello
Register: dumpstack
Register: gpio
Register: ostest
CP: /home/linguini/coding/nuttx-space/nuttx/include/nuttx/config.h
CP: /home/linguini/coding/nuttx-space/nuttx/include/nuttx/fs/hostfs.h
LD: nuttx
Pac SIM with dynamic libs..
'/usr/lib/libm.so.6' -> 'sim-pac/libs/libm.so.6'
'/usr/lib/libz.so.1' -> 'sim-pac/libs/libz.so.1'
'/usr/lib/libc.so.6' -> 'sim-pac/libs/libc.so.6'
'/usr/lib64/ld-linux-x86-64.so.2' -> 'sim-pac/libs/ld-linux-x86-64.so.2'
'/lib64/ld-linux-x86-64.so.2' -> 'sim-pac/ld-linux-x86-64.so.2'
SIM elf with dynamic libs archive in nuttx.tgz
```
Then, when disabling `CONFIG_TESTING_CMOCKA_ASLIB`, the compilation is:
```
$ make -j
Create version.h
LN: platform/board to /home/linguini/coding/nuttx-space/apps/platform/dummy
Register: cmocka
Register: hello
Register: nsh
Register: sh
Register: dd
Register: gcov
Register: gpio
Register: dumpstack
Register: ostest
CP: /home/linguini/coding/nuttx-space/nuttx/include/nuttx/config.h
LD: nuttx
Pac SIM with dynamic libs..
'/usr/lib/libm.so.6' -> 'sim-pac/libs/libm.so.6'
'/usr/lib/libz.so.1' -> 'sim-pac/libs/libz.so.1'
'/usr/lib/libc.so.6' -> 'sim-pac/libs/libc.so.6'
'/usr/lib64/ld-linux-x86-64.so.2' -> 'sim-pac/libs/ld-linux-x86-64.so.2'
'/lib64/ld-linux-x86-64.so.2' -> 'sim-pac/ld-linux-x86-64.so.2'
SIM elf with dynamic libs archive in nuttx.tgz
```
and I can run the cmocka application on sim:
```
nsh> cmocka --help
an elegant unit testing framework for C with support for mock objects
Usage: cmocka [OPTION [ARG]] ...
-?, --help show this help statement
-l, --list display only the names of testcases and testsuite,
don't execute them
-t, --test A only run cases where case function name matches A pattern
-p, --skip B don't run cases where case function name matches B pattern
-s, --suite C only run suites where PROGNAME matches C pattern
-f, --output-path use xml report instead of standard output
-d, --shuffle-seed shuffling test sequence,between 0 and 99999,
when seed is 0,use time(NULL) as the seed for
the random number generator
Example: cmocka --suite mm|sched --test Test* --skip TestNuttxMm0[123]
nsh>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]