From 2968b3644c046831179ac556570245762a0b1458 Mon Sep 17 00:00:00 2001 From: Genaro Saucedo Tejada Date: Tue, 9 Aug 2016 15:11:53 -0500 Subject: [PATCH] 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 --- scripts/sanitycheck | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/sanitycheck b/scripts/sanitycheck index a75eb80ee1a..6328666d82e 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"