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
This commit is contained in:
Benjamin Berg 2019-11-28 11:37:33 +01:00 committed by Marco Trevisan
parent b9ff75c4e9
commit a7541b1f76

View file

@ -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))