Blame SOURCES/0049-tests-Fix-endianness-issue-in-test-suite.patch

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