diff options
author | Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com> | 2016-08-09 15:11:53 -0500 |
---|---|---|
committer | Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | 2016-08-10 14:31:57 +0000 |
commit | 2968b3644c046831179ac556570245762a0b1458 (patch) | |
tree | 91ec5654a56f92ff0939d8a80af632bb59d6f162 /scripts/sanitycheck | |
parent | 6ff2011b96d684b653b0fe91a84348f96d2771ec (diff) |
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>
Diffstat (limited to 'scripts/sanitycheck')
-rwxr-xr-x | scripts/sanitycheck | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/sanitycheck b/scripts/sanitycheck index a75eb80ee..6328666d8 100755 --- a/scripts/sanitycheck +++ b/scripts/sanitycheck @@ -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" |