Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

driver/bareboxdriver: silence barebox in _await_prompt() and unsilence on boot() #1221

Merged

Conversation

Bastian-Krause
Copy link
Member

@Bastian-Krause Bastian-Krause commented Jun 25, 2023

Description
Log messages such as..

eth0: 1000Mbps full duplex link detected

..are logged asynchronously. This confuses the BareboxDriver.

To fix that, set the log level to "emerg" (0) right after a prompt is detected and recover the previous log level right before booting.

To make the tests run successfully, mock the _run() method before driver activation to act as if echo $global.loglevel was run.

Checklist

  • Documentation for the feature
  • Tests for the feature
  • The arguments and description in doc/configuration.rst have been updated
  • PR has been tested

…e on boot()

Log messages such as..

  eth0: 1000Mbps full duplex link detected

..are logged asynchronously. This confuses the BareboxDriver.

To fix that, set the log level to "emerg" right after a prompt is
detected and recover the previous log level right before booting.

To make the tests run sucessfully, mock the _run() method before driver
activation to act as if `echo $global.loglevel` was run.

Signed-off-by: Bastian Krause <bst@pengutronix.de>
@codecov
Copy link

codecov bot commented Jun 25, 2023

Codecov Report

Patch coverage: 85.7% and no project coverage change.

Comparison is base (80595d5) 62.9% compared to head (6f7bf66) 62.9%.

Additional details and impacted files
@@          Coverage Diff           @@
##           master   #1221   +/-   ##
======================================
  Coverage    62.9%   62.9%           
======================================
  Files         159     159           
  Lines       11742   11749    +7     
======================================
+ Hits         7391    7397    +6     
- Misses       4351    4352    +1     
Impacted Files Coverage Δ
labgrid/driver/bareboxdriver.py 63.2% <85.7%> (+1.5%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jluebbe jluebbe merged commit 32bc748 into labgrid-project:master Jul 3, 2023
Bastian-Krause added a commit to Bastian-Krause/labgrid that referenced this pull request Jul 20, 2023
[1] introduced lowering barebox' log level to 0 (emerg) right after the
barebox prompt has been detected and recovering the log level right
before booting.

Tests may rely on log output, though. To enable capturing log messages a
command may emit, set the log level to the initially remembered level
before the command is executed and reset it to 0 (emerg) after the exit
code was emitted.

barebox' poller should not run between the echos, so this should be
safe. No asynchronous prints are expected to happen during this time.

[1] labgrid-project#1221, 6f7bf66 ("driver/bareboxdriver: silence barebox in _await_prompt() and unsilence on boot()")

Signed-off-by: Bastian Krause <bst@pengutronix.de>
Bastian-Krause added a commit to Bastian-Krause/labgrid that referenced this pull request Jul 20, 2023
[1] introduced lowering barebox' log level to 0 (emerg) right after the
barebox prompt has been detected and recovering the log level right
before booting.

Tests may rely on log output, though. To enable capturing log messages a
command may emit, set the log level to the initially remembered level
before the command is executed and reset it to 0 (emerg) after the exit
code was emitted.

barebox' poller should not run between the echos, so this should be
safe. No asynchronous prints are expected to happen during this time.

[1] labgrid-project#1221, 6f7bf66 ("driver/bareboxdriver: silence barebox in _await_prompt() and unsilence on boot()")

Signed-off-by: Bastian Krause <bst@pengutronix.de>
Bastian-Krause added a commit to Bastian-Krause/labgrid that referenced this pull request Jul 20, 2023
[1] introduced lowering barebox' log level to 0 (emerg) right after the
barebox prompt has been detected and recovering the log level right
before booting.

Tests may rely on log output, though. To enable capturing log messages a
command may emit, set the log level to the initially remembered level
before the command is executed and reset it to 0 (emerg) after the exit
code was emitted.

barebox' poller should not run between the echos, so this should be
safe. No asynchronous prints are expected to happen during this time.

[1] labgrid-project#1221, 6f7bf66 ("driver/bareboxdriver: silence barebox in _await_prompt() and unsilence on boot()")

Signed-off-by: Bastian Krause <bst@pengutronix.de>
@Bastian-Krause Bastian-Krause deleted the bst/barebox-loglevel branch July 20, 2023 15:00
rpoisel pushed a commit to honeytreelabs/labgrid that referenced this pull request Oct 24, 2023
[1] introduced lowering barebox' log level to 0 (emerg) right after the
barebox prompt has been detected and recovering the log level right
before booting.

Tests may rely on log output, though. To enable capturing log messages a
command may emit, set the log level to the initially remembered level
before the command is executed and reset it to 0 (emerg) after the exit
code was emitted.

barebox' poller should not run between the echos, so this should be
safe. No asynchronous prints are expected to happen during this time.

[1] labgrid-project#1221, 6f7bf66 ("driver/bareboxdriver: silence barebox in _await_prompt() and unsilence on boot()")

Signed-off-by: Bastian Krause <bst@pengutronix.de>
legraps pushed a commit to BasicServicePeople/labgrid that referenced this pull request Nov 6, 2023
[1] introduced lowering barebox' log level to 0 (emerg) right after the
barebox prompt has been detected and recovering the log level right
before booting.

Tests may rely on log output, though. To enable capturing log messages a
command may emit, set the log level to the initially remembered level
before the command is executed and reset it to 0 (emerg) after the exit
code was emitted.

barebox' poller should not run between the echos, so this should be
safe. No asynchronous prints are expected to happen during this time.

[1] labgrid-project#1221, 6f7bf66 ("driver/bareboxdriver: silence barebox in _await_prompt() and unsilence on boot()")

Signed-off-by: Bastian Krause <bst@pengutronix.de>
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.

3 participants