diff options
author | Edward Hill <ecgh@chromium.org> | 2022-11-16 21:01:43 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-11-17 00:47:49 +0000 |
commit | 925dec6cc62e41b67799e7afc6ff518f9b18c9c5 (patch) | |
tree | d187ada69e10a31d8f526ce0eaac995054e90630 | |
parent | afdd762d014f295e19b71d789890e565d5b9286d (diff) | |
download | chrome-ec-925dec6cc62e41b67799e7afc6ff518f9b18c9c5.tar.gz |
util: Improve uart_stress_tester.py
Adjust prompt detection and cleanup to work with AP UART, not just
EC UART.
BUG=b:227228605
BRANCH=none
TEST=uart_stress_tester.py -t 10 -d <raw_ec_uart> <raw_cpu_uart>
Change-Id: I9041e926b11e287942fe3152652fc38e2df7b1d2
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4032321
Reviewed-by: Mark Hasemeyer <markhas@google.com>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
-rwxr-xr-x | util/uart_stress_tester.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/util/uart_stress_tester.py b/util/uart_stress_tester.py index 3b29a50a2b..05976889d6 100755 --- a/util/uart_stress_tester.py +++ b/util/uart_stress_tester.py @@ -90,6 +90,7 @@ class UartSerial: "touch " + FLAG_FILENAME, # Create a temp file ], "cleanup_cmd": [ + "\x03", "rm -f " + FLAG_FILENAME, # Remove the temp file "dmesg -E", # Enable console message "logout", # Logout @@ -109,7 +110,7 @@ class UartSerial: "prompt": "ec:~$", "device_type": "EC(Zephyr)", "prepare_cmd": ["chan save", "chan 0"], # Disable console message - "cleanup_cmd": ["", "chan restore"], + "cleanup_cmd": ["x", "", "chan restore"], "end_of_input": CRLF, }, ) @@ -213,8 +214,6 @@ class UartSerial: self.serial.flushInput() self.serial.flushOutput() - # Send 'x' to cancel any previous chargen command still running. - self.run_command(["x"], delay=1) self.get_output() # drain data # Send a couple of line feeds, and capture the prompt text. @@ -330,9 +329,9 @@ class UartSerial: if captured: if self.num_ch_cap == 0: # Strip prompt on first read (if it's there) - prefixstr = self.dev_prof["prompt"] + " " - if captured.startswith(prefixstr): - captured = captured[len(prefixstr) :] + start = captured.find("0123") + if start > 0: + captured = captured[start:] # There is some output data. Reset the data starvation count. data_starve_count = 0 else: |