diff options
author | Patryk Duda <pdk@semihalf.com> | 2022-03-21 16:56:47 +0100 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-03-30 09:30:32 +0000 |
commit | 52b8fb0dac7e3981e465b4c499d0607f227cfbfe (patch) | |
tree | ca08ba8d861858def3481ece10ae8bc3ac330371 /test/run_device_tests.py | |
parent | 6ac48cc7735ec9c6630ef90a510d8e91bb106db8 (diff) | |
download | chrome-ec-52b8fb0dac7e3981e465b4c499d0607f227cfbfe.tar.gz |
test/run_device_tests: Define failure regexp for test
Panic data tests will require to crash FPMCU, but run_device_test will
report a failure when there was an assertion failure, even when test
passed. This patch add fine-grained failure regular expression control.
BUG=b:221087395
BRANCH=none
TEST=./test/run_device_tests.py -b dartmonkey
TEST=./test/run_device_tests.py -b bloonchipper
Signed-off-by: Patryk Duda <pdk@semihalf.com>
Change-Id: I4282d9cead948583b12520acb4782c54f14b09bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3555747
Reviewed-by: Andrea Grandi <agrandi@google.com>
Reviewed-by: Bobby Casey <bobbycasey@google.com>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Commit-Queue: Patryk Duda <patrykd@google.com>
Diffstat (limited to 'test/run_device_tests.py')
-rwxr-xr-x | test/run_device_tests.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/test/run_device_tests.py b/test/run_device_tests.py index 69ce6b9d15..817816977c 100755 --- a/test/run_device_tests.py +++ b/test/run_device_tests.py @@ -90,16 +90,21 @@ class TestConfig: """Configuration for a given test.""" def __init__(self, name, image_to_use=ImageType.RW, finish_regexes=None, - toggle_power=False, test_args=None, num_flash_attempts=2, - timeout_secs=10, enable_hw_write_protect=False): + fail_regexes=None, toggle_power=False, test_args=None, + num_flash_attempts=2, timeout_secs=10, + enable_hw_write_protect=False): if test_args is None: test_args = [] if finish_regexes is None: finish_regexes = [ALL_TESTS_PASSED_REGEX, ALL_TESTS_FAILED_REGEX] + if fail_regexes is None: + fail_regexes = [SINGLE_CHECK_FAILED_REGEX, ALL_TESTS_FAILED_REGEX, + ASSERTION_FAILURE_REGEX] self.name = name self.image_to_use = image_to_use self.finish_regexes = finish_regexes + self.fail_regexes = fail_regexes self.test_args = test_args self.toggle_power = toggle_power self.num_flash_attempts = num_flash_attempts @@ -339,14 +344,10 @@ def process_console_output_line(line: bytes, test: TestConfig): if SINGLE_CHECK_PASSED_REGEX.match(line_str): test.num_passes += 1 - if SINGLE_CHECK_FAILED_REGEX.match(line_str): - test.num_fails += 1 - - if ALL_TESTS_FAILED_REGEX.match(line_str): - test.num_fails += 1 - - if ASSERTION_FAILURE_REGEX.match(line_str): - test.num_fails += 1 + for regex in test.fail_regexes: + if regex.match(line_str): + test.num_fails += 1 + break return line_str except UnicodeDecodeError: |