Skip to content

Introduce a counting process as a test utility - #587

Merged
MaciejKaszynski merged 2 commits into
eclipse-score:mainfrom
etas-contrib:feature/counting-process
Sep 7, 2026
Merged

MaciejKaszynski merged 2 commits into
eclipse-score:mainfrom
etas-contrib:feature/counting-process

Conversation

@cameron-craig-etas

@cameron-craig-etas cameron-craig-etas commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

#588

This PR introduces a "counting" process that optionally posts to a named semaphore, and also optionally report running. This is a useful testing utility for occasions where we would like to wait for a number of processes to be started. Being able to call report_running() allows this utility to be executed as a reporting process in launch manager.

I've tested this locally:

  • Tested that the semaphore is created and posted to correctly:
    $ bazel build //tests/utils/test_helper:counting_process
    $ bazel-bin/tests/utils/test_helper/counting_process  -p /namedsem
    $ stat -c '%a %n' /dev/shm/sem.namedsem
    644 /dev/shm/sem.namedsem
    $ ./bin/python3 -c "import posix_ipc; sem = posix_ipc.Semaphore('/namedsem'); print('Value:', sem.value)"
    Value: 1
    $ bazel-bin/tests/utils/test_helper/counting_process  -p /namedsem
    Value: 2
    
  • Tested that report_running is called when configured.
    bazel-bin/tests/utils/test_helper/counting_process -r
    mw::log initialization error: Error No logging configuration files could be found. occurred with context information: Failed to load configuration files. Fallback to console logging.
    2026/09/03 11:38:32.1912871 130631703 000 ECU1 NONE LM log error verbose 3 [Lifecycle client] FD  111  is invalid for kRunning report
    
  • Tested that the help option works:
    $ bazel-bin/tests/utils/test_helper/counting_process --help
    Usage: ./counting_process [--help|-h] [--report-running|-r] [--post-to-semaphore|-p]
    $ bazel-bin/tests/utils/test_helper/counting_process -h
    Usage: ./counting_process [--help|-h] [--report-running|-r] [--post-to-semaphore|-p]
    
  • Tested that an error is printed if no arguments are passed.
    $ bazel-bin/tests/utils/test_helper/counting_process
    Invalid arguments! Must provide at least one option.
    
  • Tested that invalid or missing arguments are handled:
    $ bazel-bin/tests/utils/test_helper/counting_process -j
    bazel-bin/tests/utils/test_helper/counting_process: invalid option -- 'j'
    Invalid or missing argument.
    $ bazel-bin/tests/utils/test_helper/counting_process -p
    bazel-bin/tests/utils/test_helper/counting_process: option requires an argument -- 'p'
    Invalid or missing argument.
    
  • Test that invalid sem names are rejected
    $ bazel-bin/tests/utils/test_helper/counting_process -p sem
    Invalid semaphore name! POSIX named semaphores must start with '/'
    

@cameron-craig-etas
cameron-craig-etas marked this pull request as ready for review September 3, 2026 10:51
Comment thread tests/utils/test_helper/counting_process.cpp
@MaciejKaszynski
MaciejKaszynski deployed to workflow-approval September 7, 2026 11:30 — with GitHub Actions Active
@MaciejKaszynski
MaciejKaszynski deployed to workflow-approval September 7, 2026 11:30 — with GitHub Actions Active
@MaciejKaszynski
MaciejKaszynski merged commit 07fb6cd into eclipse-score:main Sep 7, 2026
16 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in LCM - Lifecycle & Health FT Sep 7, 2026
@MaciejKaszynski
MaciejKaszynski deleted the feature/counting-process branch September 23, 2026 13:49

This branch was successfully deployed

1 active deployment
workflow-approval — c7035b45 Deployed Sep 7, 2026 by MaciejKaszynski via Build and test unit-tests-x86_64-qnx / approval #693
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants