-
Notifications
You must be signed in to change notification settings - Fork 210
driver: Fix SmallUBootDriver for garbage #1700
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
base: master
Are you sure you want to change the base?
Conversation
The SmallUBoot spits out random chars which confuse the expect function, likely breaking it. This commit ignore two short answers and thereby fixing the issue. There might be cleaner implementations but this does the trick reliably for multiple device I'm using for testing. An error how this looks without the patch: ``` CONSOLE SerialLogger.ma: SerialDriver(main) > tpl␍ INFO StepLogger: → SerialDriver.expect(pattern='ap135>') CONSOLE SerialLogger.ma: SerialDriver(main) < ap135> ␍ INFO StepLogger: ← SerialDriver.expect() result=(0, b'\r\n', <re.Match object; span=(2, 8), match=b'ap135>'>, b'ap135>') [0.002s] CONSOLE SerialLogger.ma: SerialDriver(main) > echoPBTAJJAOZT; setenv serverip 192.168.1.99; echoPBTAJJAOZT␍ INFO StepLogger: → SerialDriver.expect(pattern='ap135>') CONSOLE SerialLogger.ma: SerialDriver(main) < ␍␍ CONSOLE SerialLogger.ma: SerialDriver(main) < ap135> echoPBTAJJAOZT; setenv serverip 192.168.1.99; echoPBTAJJAOZT␍ INFO StepLogger: ← SerialDriver.expect() result=(0, b' \r\r\n', <re.Match object; span=(4, 10), match=b'ap135>'>, b'ap135>') [0.002s] INFO StepLogger: ⚠ SmallUBootDriver._await_prompt() [7.811s] exception="Unknown command 'echoPBTAJJAOZT' - try 'help'" is not in list ERROR conftest: Failed to transition to state shell Traceback (most recent call last): File "/Users/user/src/openwrt/tests/tests/conftest.py", line 93, in shell_command strategy.transition("shell") ~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "/Users/user/src/openwrt/tests/targets/../strategies/tftpstrategy.py", line 75, in transition self.transition(Status.uboot) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ File "/Users/user/src/openwrt/tests/targets/../strategies/tftpstrategy.py", line 72, in transition self.target.activate(self.uboot) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^ File "/Users/user/src/labgrid/labgrid/labgrid/target.py", line 472, in activate client.on_activate() ~~~~~~~~~~~~~~~~~~^^ File "/Users/user/src/labgrid/labgrid/labgrid/driver/ubootdriver.py", line 61, in on_activate self._await_prompt() ~~~~~~~~~~~~~~~~~~^^ File "/Users/user/src/labgrid/labgrid/labgrid/step.py", line 215, in wrapper _result = func(*_args, **_kwargs) File "/Users/user/src/labgrid/labgrid/labgrid/driver/smallubootdriver.py", line 73, in _await_prompt self._run(command) ~~~~~~~~~^^^^^^^^^ File "/Users/user/src/labgrid/labgrid/labgrid/driver/smallubootdriver.py", line 105, in _run data = data[data.index(f"Unknown command 'echo{marker}' - try 'help'") +1 :] ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: "Unknown command 'echoPBTAJJAOZT' - try 'help'" is not in list ``` Signed-off-by: Paul Spooren <[email protected]>
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #1700 +/- ##
========================================
- Coverage 55.6% 55.6% -0.1%
========================================
Files 172 172
Lines 13471 13474 +3
========================================
Hits 7500 7500
- Misses 5971 5974 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -96,7 +96,10 @@ def _run(self, cmd: str, *, timeout: int = 30, codec: str = "utf-8", decodeerror | |||
cmp_command = f"echo{marker}; {cmd}; echo{marker}" | |||
|
|||
self.console.sendline(cmp_command) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder when the extra characters appear.?Is it before the echo is sent, or after?
Description
The SmallUBoot spits out random chars which confuse the expect function, likely breaking it. This commit ignore two short answers and thereby fixing the issue. There might be cleaner implementations but this does the trick reliably for multiple device I'm using for testing.
An error how this looks without the patch:
Checklist