sanity: non utf-8 characters are tolerated

Sanity check script was not handling non utf-8 characters as a result
it crashed and didn't kill qemu and test used to hang.

Now tests fail upon untranslatable bytes.

JIRA: ZEP-673

Change-Id: I885a185e0481083501fce15cd51412bfdd26a7d7
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
This commit is contained in:
Genaro Saucedo Tejada 2016-08-09 15:11:53 -05:00 committed by Inaky Perez-Gonzalez
commit 2968b3644c

View file

@ -284,7 +284,13 @@ class QEMUHandler:
out_state = "timeout"
break
c = in_fp.read(1).decode("utf-8")
try:
c = in_fp.read(1).decode("utf-8")
except UnicodeDecodeError:
# Test is writing something weird, fail
out_state = "unexpected byte"
break
if c == "":
# EOF, this shouldn't happen unless QEMU crashes
out_state = "unexpected eof"