Skip to content

Conversation

joergho
Copy link
Contributor

@joergho joergho commented Sep 9, 2025

Description

Add the following arguments to the strategies BareboxStrategy, ShellStrategy and UBootStrategy:

- wait_for_systemd: If True, wait for all systemd services to be up and running when transitioning to the "shell" state default: True
- systemd_timeout: Timeout to wait for systemd services in seconds default: 30

Before the change, the systemctl is-system-running --wait command was called unconditionally with default timeout (30 seconds).

This does not cover the following scenarios:

  1. Maybe the user does not want to execute the check at all (maybe systemd is not even used on the device)?
    • this is what the wait_for_systemd attribute is for
  2. Or maybe the user wants to have a higher timeout because a certain service takes very long to start?
    • this is what the systemd_timeout attribute is for

Checklist

  • Documentation for the feature
  • Tests for the feature
  • The arguments and description in doc/configuration.rst have been updated
  • Add a section on how to use the feature to doc/usage.rst
  • Add a section on how to use the feature to doc/development.rst
  • PR has been tested
  • Man pages have been regenerated

Add the following arguments to the strategies BareboxStrategy,
ShellStrategy and UBootStrategy:

- wait_for_systemd: If True, wait for all systemd services to be up
  and running when transitioning to the "shell" state
  default: True
- systemd_timeout: Timeout to wait for systemd services in seconds
  default: 30

Signed-off-by: Jörg Hofrichter <[email protected]>
Copy link

codecov bot commented Sep 9, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.4%. Comparing base (22f4b81) to head (18b0567).

Files with missing lines Patch % Lines
labgrid/strategy/bareboxstrategy.py 50.0% 2 Missing ⚠️
labgrid/strategy/shellstrategy.py 50.0% 2 Missing ⚠️
labgrid/strategy/ubootstrategy.py 50.0% 2 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (22f4b81) and HEAD (18b0567). Click for more details.

HEAD has 60 uploads less than BASE
Flag BASE (22f4b81) HEAD (18b0567)
3.11 13 1
3.13 13 1
3.12 13 1
3.9 13 1
3.10 13 1
Additional details and impacted files
@@            Coverage Diff            @@
##           master   #1727      +/-   ##
=========================================
- Coverage    55.6%   45.4%   -10.3%     
=========================================
  Files         172     172              
  Lines       13495   13504       +9     
=========================================
- Hits         7514    6135    -1379     
- Misses       5981    7369    +1388     
Flag Coverage Δ
3.10 45.4% <50.0%> (-10.3%) ⬇️
3.11 45.4% <50.0%> (-10.3%) ⬇️
3.12 45.4% <50.0%> (-10.3%) ⬇️
3.13 45.4% <50.0%> (-10.3%) ⬇️
3.9 45.4% <50.0%> (-10.3%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@threexc
Copy link
Contributor

threexc commented Sep 9, 2025

This seems useful. How did you test it?

@joergho
Copy link
Contributor Author

joergho commented Sep 9, 2025

This seems useful. How did you test it?

@threexc I tested it manually.

Environment for testing:

  1. wrote an environment config file which works with my device and set the UBootStrategy arguments accordingly (see below)
  2. created a dummy test similar to the test_shell test using the shell_command fixture from the documentation
  3. Ran pytest with -vv argument (e.g. pytest --lg-env myconfig.yml test_shell.py -vv) to see the steplogger output.

Things I checked:

  1. Set wait_for_systemd=False in myconfig.yml and checked that systemctl is-system-running --wait is not executed
  2. Set wait_for_systemd=True in myconfig.yml and checked that systemctl is-system-running --wait is executed
  3. Set systemd_timeout=30 (some value which is known to be working) and checked that the transition to shell works as expected
  4. Set systemd_timeout=1 (some value which is known to be not working) and checked that executing systemctl is-system-running --wait fails

@joergho
Copy link
Contributor Author

joergho commented Sep 9, 2025

BTW, now that I think of it: Wouldn't it make sense to move this functionality out of the strategies completely and instead move it into the ShellDriver?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants