util: uart_stress_tester raises an error on character loss
util: uart_stress_tester raises an error on character loss

This patch let the tester exit with an error code on test failure.
It would make easy the future autotest to detect a failure.

BUG=None
BRANCH=None
TEST=ran on fleex.

$ uart_stress_tester.py /dev/ttyUSB1 /dev/ttyUSB2 -t 120 -d

[before patch]
...
INFO   | UartSerial| EC |    14888 char lost /    1382400 (1.1 %)
INFO   | UartSerial| AP |        0 char lost /    1382400 (0.0 %)
ERROR  | ChargenTest    | FAIL: lost 14888 character(s) from the test
...
$ echo $?
0

[after patch]
...
INFO   | UartSerial| EC |    14888 char lost /    1382400 (1.1 %)
INFO   | UartSerial| AP |        0 char lost /    1382400 (0.0 %)
ERROR  | ChargenTest    | FAIL: lost 14888 character(s) from the test
Error:  Test failed for losing 144888 character(s)
...
$ echo $?
1

$ ./util/uart_stress_tester.py /dev/ttyUSB1 /dev/ttyUSB2 -t 120 -d
Error:  /dev/ttyUSB1 does not exist.
$ echo $?
1

Change-Id: I210efd4ad7fdb8eb612206624eda6c39c5bb3b1c
Signed-off-by: Namyoon Woo <e8732cefb861f07768f47df788a8e8eb75efc09a@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1696115
Reviewed-by: Vadim Bendebury <5515d6d2d0829cbe0dd0dcf2094aaded06d58514@chromium.org>
Reviewed-by: Aseda Aboagye <12c9b286316a940fd31c24070da5ab64cdd4d0e7@chromium.org>

coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec