[gegl/wip/smcv/endian: 10/10] tests: Use endiannness-dependent reference GEGL buffers




commit ebb08f08efab096e39a01ce6d5882e808db0642a
Author: Simon McVittie <smcv debian org>
Date:   Thu Sep 9 10:26:51 2021 +0100

    tests: Use endiannness-dependent reference GEGL buffers
    
    The on-disk format for GEGL buffers does not appear to have been
    designed to be endianness-independent (all headers and image data are
    in native endianness), so we cannot load a little-endian reference image
    on a big-endian architecture.
    
    Resolves: https://gitlab.gnome.org/GNOME/gegl/-/issues/289
    Signed-off-by: Simon McVittie <smcv debian org>

 tests/compositions/meson.build                           |   2 ++
 .../{hdr-color.gegl => hdr-color.little-endian.gegl}     | Bin
 .../{rgb-params.gegl => rgb-params.little-endian.gegl}   | Bin
 tests/mipmap/meson.build                                 |   1 +
 tests/opencl/meson.build                                 |   1 +
 tests/test-runner.py                                     |  15 +++++++++++++--
 6 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/tests/compositions/meson.build b/tests/compositions/meson.build
index fb1fda83f..ec1bdb911 100644
--- a/tests/compositions/meson.build
+++ b/tests/compositions/meson.build
@@ -103,6 +103,7 @@ foreach _test : tests
       '--test-name', _test,
       '--output-dir', meson.current_build_dir() / 'output',
       '--reference-path', _ref_dir,
+      '--endian', host_machine.endian(),
       '--input-file', _xml_file,
       '--gegl-exe', gegl_bin,
       '--imgcmp-exe', gegl_imgcmp,
@@ -122,6 +123,7 @@ foreach _test : tests
         '--test-name', _test,
         '--output-dir', meson.current_build_dir() / 'output-opencl',
         '--reference-path', _ref_dir,
+        '--endian', host_machine.endian(),
         '--input-file', _xml_file,
         '--gegl-exe', gegl_bin,
         '--imgcmp-exe', gegl_imgcmp,
diff --git a/tests/compositions/reference/hdr-color.gegl 
b/tests/compositions/reference/hdr-color.little-endian.gegl
similarity index 100%
rename from tests/compositions/reference/hdr-color.gegl
rename to tests/compositions/reference/hdr-color.little-endian.gegl
diff --git a/tests/compositions/reference/rgb-params.gegl 
b/tests/compositions/reference/rgb-params.little-endian.gegl
similarity index 100%
rename from tests/compositions/reference/rgb-params.gegl
rename to tests/compositions/reference/rgb-params.little-endian.gegl
diff --git a/tests/mipmap/meson.build b/tests/mipmap/meson.build
index 4f6f5ef7f..2f32cbf91 100644
--- a/tests/mipmap/meson.build
+++ b/tests/mipmap/meson.build
@@ -66,6 +66,7 @@ foreach _test, _args : mipmap_tests
       '--test-name', _test,
       '--output-dir', meson.current_build_dir() / 'output',
       '--reference-path', meson.current_source_dir() / 'reference',
+      '--endian', host_machine.endian(),
       '--input-file', mipmap_test_image,
       '--gegl-exe', gegl_bin,
       '--gegl-scale', '0.33',
diff --git a/tests/opencl/meson.build b/tests/opencl/meson.build
index 7c8fb04ae..3dffaff73 100644
--- a/tests/opencl/meson.build
+++ b/tests/opencl/meson.build
@@ -28,6 +28,7 @@ foreach _test : opencl_tests
       '--test-name', _test,
       '--output-dir', meson.current_build_dir() / 'output',
       '--reference-path', meson.current_build_dir() / 'reference',
+      '--endian', host_machine.endian(),
       '--generate-reference',
       '--input-file', files('@0@.xml'.format(_test)),
       '--gegl-exe', gegl_bin,
diff --git a/tests/test-runner.py b/tests/test-runner.py
index 3068dfb6a..8fbb9f877 100644
--- a/tests/test-runner.py
+++ b/tests/test-runner.py
@@ -44,6 +44,12 @@ class Args():
             metavar='REF_PATH',
             help='reference file or directory'
         )
+        parser.add_argument(
+            '--endian',
+            metavar='big|little',
+            help='endianness of reference files to use',
+            default='unknown',
+        )
         parser.add_argument(
             '--input-file',
             required=True,
@@ -129,6 +135,7 @@ class Args():
                 os.path.join(self.source_dir, 'reference')
             )
         if self.verbose: print('ref path: %s' % self.reference_path)
+        self.endian = parser.parse_args().endian
 
         # input file from parameter
         if parser.parse_args().input_file:
@@ -265,7 +272,11 @@ def main():
             file_ext = os.path.splitext(ref_file)[1]
         elif os.path.isdir(args.reference_path):
             # find reference file matching test name in ref dir
-            for file_ext in ['.png', '.hdr', '.gegl']:
+            for file_ext in [
+                '.png',
+                '.hdr',
+                '.%s-endian.gegl' % args.endian,
+            ]:
                 ref_file = os.path.join(
                     args.reference_path, args.test_name + file_ext
                 )
@@ -334,4 +345,4 @@ def main():
 
 
 if __name__ == '__main__':
-  main()
\ No newline at end of file
+  main()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]