Repository navigation
testing/ostest: Test work_queue_init() and work_queue_run() - #4140
chengkai15 wants to merge 1 commit into
Conversation
622bb55 to
e7e8869
Compare
🔗 Cross-repo PR dependenciesThe read-only Build run reported the following dependent PR(s) and fetched head SHA(s): CI run: https://github.com/apache/nuttx-apps/actions/runs/45625625849 |
|
Thanks, the test reuses the existing helpers well, and 1. With #22268 at 4c73208:
The header says ASSERT(work_queue_run(wq) == -EINVAL);and fix the kernel side in #22268 to match, e.g. with a 2. A regression in the
3. The new skip in #22268 adds the #ifdef CONFIG_BUILD_FLAT
ASSERT(work_queue_setpriority_wq(wqueue, CUSTOM_PRIORITY + 1) == OK);
ASSERT(work_queue_priority_wq(wqueue) == CUSTOM_PRIORITY + 1);
#endifWithout the skip, 4. Second sub-test:
5. Smaller, optional
The |
Serve a queue of work_queue_init() with two pthreads of the test task that call work_queue_run(). Check that work queued before the threads start runs, that it runs in the task (getpid() is the pid of the task and a file descriptor that the task opened can be written), that both threads serve the queue at the same time, that a third work_queue_run() returns -EBUSY, that a worker cannot free its own queue (-EDEADLK), and that work_queue_run() returns 0 after work_queue_free(). The -EBUSY call runs in its own thread, so a regression fails instead of hanging ostest. Then check that work is served while a slot is still empty, that the priority of such a queue can be changed in the flat build, and that a thread that calls work_queue_run() after work_queue_free() gets -ESHUTDOWN while work_queue_free() waits for it. work_queue_run() on a queue of work_queue_create() returns -EINVAL. Assisted-by: Kiro:claude-opus-5-5 Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
e7e8869 to
b6de363
Compare
|
@cederom thanks, all points are addressed in the new push:
The commit message is updated to list the cases. Passes on sim:ostest and sim:smp. |
Note: Please adhere to Contributing Guidelines.
Depends-On: apache/nuttx/pull/22268
Summary
Regression test for
work_queue_init()andwork_queue_run()(apache/nuttx#22268).A queue of
work_queue_init(2)is served by two pthreads of the test task that callwork_queue_run(). The test checks that:getpid()is the pid of the task, and a file descriptor that the task opened can be written;work_queue_run()returns-EBUSY;work_queue_run()returns 0 in both threads afterwork_queue_free();work_queue_free()does not wait for a slot that no thread took.Impact
testing/ostest/wqueue.conly. It needs sched/wqueue: Add work_queue_init() and work_queue_run() nuttx#22268 (the interfaces are new, so the test does not build on master), and must be merged after it.Testing
sim:ostest (flat), full ostest (4 loops, no errors):
mps2-an500:citest_protected (protected) +
CONFIG_LIBC_USRWORK, qemu-system-arm,ostest wqueue:qemu-armv7a:citest_knsh (kernel) +
CONFIG_LIBC_USRWORK, qemu-system-arm,ostest wqueue:On protected and kernel,
ostest wqueuefails on master before it reaches this case, in existing checks: cancelling idle work on a libc custom queue does not return-ENOENT(both builds), and the callbacks of the predefined USRWORK queue do not run (kernel). For these two runs those checks were disabled locally.Not tested: CMake, SMP, real hardware.