casaroli opened a new pull request, #4020:
URL: https://github.com/apache/nuttx-apps/pull/4020
## Summary
`testing/nettest/others/test_others_bufpool.c` includes
`"../../nuttx/net/utils/utils.h"`. The compiler finds this file only through
`-I $(APPDIR)/include` or `-I $(TOPDIR)/include`, so the build works only when
the NuttX tree is a directory with the name `nuttx` next to the apps tree. With
any other name (for example a git worktree) `cmocka_net_others` does not
compile.
This PR adds the `net` directory of the NuttX tree to the include path of
`cmocka_net_others` (`$(TOPDIR)/net` in the Makefile, `${NUTTX_DIR}/net` in
CMake), and the test includes `"utils/utils.h"`, as the network stack does.
`testing/mm/heaptest` and `testing/mm/iob` find their kernel headers in the
same way.
The test calls functions of the network stack directly: `net_bufpool_*()`
and `chksum_iob()`. In a protected or kernel build these functions are only in
the kernel `libnet.a`, and user space cannot link them. So `TESTING_NET_OTHERS`
now depends on `BUILD_FLAT`.
The first commit adds two blank lines after declarations in
`test_others_bufpool.c`. These nxstyle errors are older than this PR, and
checkpatch checks the full file. No code change.
## Impact
Test only. In a flat build `cmocka_net_others` builds and runs as before,
for any name of the NuttX directory. In a protected or kernel build
`TESTING_NET_OTHERS` is not available; before, it was on by default with
`TESTING_NET_TEST` and the build failed. No defconfig in nuttx sets
`TESTING_NET_TEST`, so CI does not build this test.
## Testing
nuttx master 03aea786390 in a worktree with the name `nuttx-bpi-ws` (not
`nuttx`), apps master 72e5a3cd6 vs this PR, with `CONFIG_NET`,
`CONFIG_TESTING_CMOCKA` and `CONFIG_TESTING_NET_TEST` enabled:
| Configuration | apps master | this PR |
|---|---|---|
| qemu-armv8a:nsh (flat, arm64), make | fails: `test_others_bufpool.c:32:10:
fatal error: ../../nuttx/net/utils/utils.h: No such file or directory` |
builds, no warnings |
| qemu-armv8a:nsh (flat, arm64), CMake | fails: the same error | builds, no
warnings |
| qemu-armv8a:knsh (kernel, arm64), make + export + `make import` | fails:
the same error | builds; `TESTING_NET_OTHERS` is off |
`cmocka_net_others` on qemu-armv8a:nsh (QEMU HVF), make build of this PR:
`test_others_bufpool` OK, `test_others_chksum` OK, `[ PASSED ] 2 test(s).`
In the knsh export, `net_bufpool_timedalloc` and `chksum_iob` are defined
only in the kernel `staging/libnet.a` and in none of the user libraries (`nm`).
`tools/checkpatch.sh -c -u -m -g origin/master..HEAD` passes.
Not run: a protected build, other architectures.
--
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]