From a916f33535177a3032822d7b47ab199d6249b989 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Thu, 28 Nov 2019 11:37:33 +0100 Subject: [PATCH 049/181] tests: Fix endianness issue in test suite The test suite needs to compare greyscale images and was picking an undefined byte in the pixel data on big-endian. Select a byte that works on any endian instead. See: #200 --- tests/umockdev-test.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/umockdev-test.py b/tests/umockdev-test.py index d91fcb9..1b556e1 100755 --- a/tests/umockdev-test.py +++ b/tests/umockdev-test.py @@ -48,7 +48,10 @@ def cmp_pngs(png_a, png_b): for x in range(img_a.get_width()): for y in range(img_a.get_height()): - assert(data_a[y * stride + x * 4] == data_b[y * stride + x * 4]) + # RGB24 format is endian dependent, using +1 means we test either + # the G or B component, which works on any endian for the greyscale + # test. + assert(data_a[y * stride + x * 4 + 1] == data_b[y * stride + x * 4 + 1]) def get_umockdev_runner(ioctl_basename): ioctl = os.path.join(ddir, "{}.ioctl".format(ioctl_basename)) -- 2.24.1