qapi: Force UTF8 encoding when parsing qapi files
commit39615354fc07af34e04ab5efb5b6d478b0d24e32
authorEric Blake <eblake@redhat.com>
Mon, 19 Mar 2018 20:50:40 +0000 (19 15:50 -0500)
committerEric Blake <eblake@redhat.com>
Fri, 23 Mar 2018 17:29:07 +0000 (23 12:29 -0500)
treecb47365920d9ed7ca8129e118b533822011bfc1b
parenta4f90923b520f1dc0a768634877eb412e5052c26
qapi: Force UTF8 encoding when parsing qapi files

Commit d4e5ec877 already fixed things to work around Python 3's
lame bug of having LC_ALL=C not be 8-bit clean, when parsing the
main QMP qapi files; but failed to do likewise in the tests
directory.  As a result, running 'LC_ALL=C make check' fails on
escape-too-big and unicode-str when using python 3 with a nasty
stack trace instead of the intended graceful error message that
QAPI doesn't yet support 8-bit data (the two tests contain
Unicode é, when parsed in UTF-8; they represent something
different when parsed in a proper single-byte C locale, but that
doesn't matter to the error message printed out, provided that
brain-dead Python hasn't first choked on the input instead of
being 8-bit clean).

Ideally, we'd teach the qapi generator scripts to automatically
slurp things in using UTF-8 regardless of locale, and to honor
content that is not limited to 7 bit data rather than gracefully
erroring out; but until then, since our graceful error depends
on python parsing 8-bit data (even if nothing we generate uses
8-bit data), our quick fix is to use the right locale when
running these tests.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20180319205040.1113423-1-eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
tests/Makefile.include