casaroli opened a new pull request, #4028:
URL: https://github.com/apache/nuttx-apps/pull/4028
depends-on: apache/nuttx/pull/21729
## Summary
This PR fixes three problems of ostest. Each fix is in its own commit.
1. `perf_gettime_test()` starts the minimum interval at `ULONG_MAX`.
`clock_t` is `int64_t`, so on a 64-bit target the start value is -1 and no
interval is smaller. The test then prints `Minimum interval:
18446744073709551615` and the warning "No time intervals recorded", although it
recorded 10 intervals. The minimum now starts at `CLOCK_MAX`. The warning text
also had a backslash inside the string literal, so it printed the indentation
of the next source line. The text is now two joined string literals.
2. The `perf_gettime` test asserts when the performance counter does not
move. On `mps2-an500` under QEMU, for example, the DWT cycle counter always
reads 0, because QEMU does not model it. ostest then stops at
`perf_gettime.c:132` ("Time not monotonically increasing"). The test now
busy-waits up to 100 ms for `perf_gettime()` to change. If the value does not
change, it prints `perf_gettime: counter does not move, test skipped` and
returns. A counter that moves runs the test as before.
3. The restoration test of `priority_inheritance()` makes its three
competing tasks with `task_create()`. A kernel build does not give
`task_create()` to programs, so ostest does not compile in a kernel build with
`CONFIG_PRIORITY_INHERITANCE` (`prioinherit.c:712: error: implicit declaration
of function 'task_create'`). A separate task would also not share `g_sem` and
`g_priority_tracking` in a kernel build. The competing threads are now made
with `pthread_create()` with the same priorities, and the test waits for them
with `pthread_join()`. The test is the same in flat, protected and kernel
builds.
Two commits change only the coding style, because the CI check runs nxstyle
on each changed file as a whole: a blank line after a declaration in
`perf_gettime.c`, and the loop bodies, blank lines, a long line and three
spelling errors in messages in `prioinherit.c`.
## Impact
Only ostest. Targets with a working counter run the perf test as before. The
prioinherit test checks the same priorities in all build modes.
## Testing
nuttx master e8b03dade4c, `EXTRAFLAGS="-Wno-cpp -Werror"`. qemu-armv8a under
QEMU with HVF, mps2-an500 under QEMU TCG (GNU EABI toolchain 13.2).
| Configuration | apps master 7f9ae9513 | this PR |
|---|---|---|
| `qemu-armv8a:knsh` + `PRIORITY_INHERITANCE` (kernel build) | build fails:
`prioinherit.c:712:17: error: implicit declaration of function 'task_create'` |
builds; ostest `priority_inheritance: PASSED Priority were correctly
restored.`, `ostest_main: Exiting with status 0` |
| `qemu-armv8a:nsh` + `PRIORITY_INHERITANCE` + `ARCH_PERF_EVENTS` (flat) |
`Minimum interval: 18446744073709551615`, `perf_gettime_test: WARNING -
No time intervals recorded`; status 0 | `Minimum interval:
102132000`, `perf_gettime_test: Time intervals look reasonable`; prioinherit
PASSED; status 0 |
| `mps2-an500:nsh` + `PRIORITY_INHERITANCE` + `ARCH_PERF_EVENTS` (flat,
ARMv7-M) | `Assertion failed : at file: perf_gettime.c:132`, `ostest_main:
Exiting with status 256` | `perf_gettime: counter does not move, test skipped`;
prioinherit PASSED; status 0 |
Not run: a protected build. The perf test is built only in a flat build
(`testing/ostest/Makefile`).
`tools/checkpatch.sh -c -u -m -g` passes.
--
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]