Skip to content

testing/ostest: Exercise custom work queues. - #3759

Open
13022591351 wants to merge 1 commit into
apache:masterfrom
13022591351:testing/custom-work-queues
Open

testing/ostest: Exercise custom work queues.#3759
13022591351 wants to merge 1 commit into
apache:masterfrom
13022591351:testing/custom-work-queues

Conversation

@13022591351

Copy link
Copy Markdown

Summary

  • Extend the existing ostest work queue coverage to dynamically created
    queues with one and two workers.
  • Run scheduler queues and custom queues in Flat builds, and libc custom user
    queues in non-Flat builds.
  • Add ostest wqueue as a focused entry without changing the original
    no-argument ostest flow.
  • Cover explicit caller priorities, invalid arguments, periodic requeue,
    pending replacement, synchronous and parallel cancellation, multiple
    simultaneous queues, self-destruction rejection, and teardown.
  • Check work queue and semaphore API results and release all local test
    resources.
  • Depends on wqueue: Support custom user work queues. nuttx#19982.

Impact

  • New feature: YES, test coverage for custom scheduler and libc user work
    queues.
  • User adaptation: NO. The no-argument ostest sequence remains unchanged
    in non-Flat builds; the focused test is selected with ostest wqueue.
  • Build process: NO. CONFIG_TESTING_OSTEST_WQUEUE defaults to enabled
    only when its pthread and work queue dependencies are available.
  • Hardware: NO production hardware behavior is changed.
  • Documentation: NO separate application documentation is required; the
    Kconfig help describes backend selection.
  • Security: NO impact.
  • Compatibility: Existing Flat ostest work queue coverage is retained and
    expanded.

Testing

Build host:

  • Linux 6.8.0-60-generic, x86_64
  • GNU Arm Embedded Toolchain 10.3.1 20210824

Target:

Before change:

The ostest work queue source is selected only with CONFIG_SCHED_WORKQUEUE.
It has no focused command entry and cannot exercise libc custom user queues
in a Protected user process.

Build output after change:

master_flat:
  FLASH     1470396 B / 1920 KB (74.79%)
  AXI_SRAM    63380 B / 512 KB  (12.09%)

master_protected user:
  uflash      751000 B / 1 MB   (71.62%)
  usram         8192 B / 384 KB (2.08%)

Runtime output summary:

nsh> time "ostest wqueue"

Flat runs:
  30.1490 / 30.1490 / 30.1480 s

Protected libc user runs:
  15.6540 / 15.6540 / 15.6540 s

Every run:
  API validation done
  periodic calls = 3, expect = 3
  replacement total = 2, expect = 2
  sync cancel finished = 1, expect = 1
  parallel callbacks = 2, expect = 2
  multiple queues loop 1/4 through 4/4 done
  self free result = -35, expect = -35
  pending callback = 0, expect = 0
  running callback = 1, expect = 1
  teardown requeue rejected
  teardown done

All three runs for each backend completed without assertion. Current heap
usage did not increase after the first run, and all custom workers exited.

Validation:

checkpatch commit messages: pass
checkpatch complete patch range: pass
full-file nxstyle for wqueue.c and ostest_main.c: pass
cmake-format: pass
git diff --check: pass

PR verification Self-Check

  • This PR introduces only one functional change.
  • I have updated all required description fields above.
  • My PR adheres to the contributing guidelines and coding standard.
  • My PR is still work in progress.
  • My PR is ready for review and can be safely merged.

Add an ostest wqueue entry that runs against scheduler queues in Flat builds
and libc user queues in non-Flat builds without changing the original
no-argument ostest flow.

Cover custom worker pools, explicit caller priorities, invalid arguments,
periodic and pending replacement, synchronous and parallel cancellation,
multiple concurrent queues, self-destruction rejection, and teardown.  Check
API results, release local semaphores, and fix pre-existing style findings in
the touched ostest_main.c file.

Tested on an STM32H7 PX4 FMUv6C in Flat and Protected user configurations.

Assisted-by: Codex:GPT-5
Signed-off-by: DuoYuWang <thirteenking.wang@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants