From 5df15ec59471c63f9cd0cd2c5b05aeb808404f0f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 4 Jan 2018 13:01:49 +0000 Subject: [PATCH] d/p/2018.1/tests-Assert-that-byte-order-[etc.].patch: Add patch to fix test failures on big-endian machines (Closes: #886218) --- debian/changelog | 3 + ...e-order-is-swapped-on-LE-but-not-BE-.patch | 79 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 83 insertions(+) create mode 100644 debian/patches/2018.1/tests-Assert-that-byte-order-is-swapped-on-LE-but-not-BE-.patch diff --git a/debian/changelog b/debian/changelog index bd2be187..8e953ea3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,9 @@ ostree (2017.15-2) UNRELEASED; urgency=medium * d/p/2018.1/tests-Don-t-assume-uid-primary-gid.patch: Mark as applied upstream in 2018.1 + * d/p/2018.1/tests-Assert-that-byte-order-[etc.].patch: + Add patch to fix test failures on big-endian machines + (Closes: #886218) -- Simon McVittie Thu, 04 Jan 2018 12:58:50 +0000 diff --git a/debian/patches/2018.1/tests-Assert-that-byte-order-is-swapped-on-LE-but-not-BE-.patch b/debian/patches/2018.1/tests-Assert-that-byte-order-is-swapped-on-LE-but-not-BE-.patch new file mode 100644 index 00000000..1c659239 --- /dev/null +++ b/debian/patches/2018.1/tests-Assert-that-byte-order-is-swapped-on-LE-but-not-BE-.patch @@ -0,0 +1,79 @@ +From: Simon McVittie +Date: Wed, 3 Jan 2018 08:23:10 +0000 +Subject: tests: Assert that byte-order is swapped on LE but not BE CPUs + +Closes: #1392 +Signed-off-by: Simon McVittie +Closes: #1393 +Approved by: cgwalters +Applied-upstream: 2018.1, commit:https://github.com/ostreedev/ostree/commit/994cd66744e559c92644f36028c6c262605ad75a +--- + Makefile-tests.am | 8 +++++++- + tests/basic-test.sh | 14 +++++++++++++- + tests/get-byte-order.c | 12 ++++++++++++ + 3 files changed, 32 insertions(+), 2 deletions(-) + create mode 100644 tests/get-byte-order.c + +diff --git a/Makefile-tests.am b/Makefile-tests.am +index 2b33555..25a8d08 100644 +--- a/Makefile-tests.am ++++ b/Makefile-tests.am +@@ -130,7 +130,13 @@ experimental_test_scripts = \ + tests/test-summary-collections.sh \ + tests/test-pull-collections.sh \ + $(NULL) +-test_extra_programs = $(NULL) ++test_extra_programs = \ ++ tests/get-byte-order \ ++ $(NULL) ++ ++tests_get_byte_order_SOURCES = tests/get-byte-order.c ++tests_get_byte_order_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) ++tests_get_byte_order_LDADD = $(GLIB_LIBS) + + tests_repo_finder_mount_SOURCES = tests/repo-finder-mount.c + tests_repo_finder_mount_CFLAGS = $(common_tests_cflags) +diff --git a/tests/basic-test.sh b/tests/basic-test.sh +index 87cb9fa..c4eb9ca 100644 +--- a/tests/basic-test.sh ++++ b/tests/basic-test.sh +@@ -759,8 +759,20 @@ $OSTREE show --print-metadata-key=FOO test2 > test2-meta + assert_file_has_content test2-meta "BAR" + $OSTREE show --print-metadata-key=KITTENS test2 > test2-meta + assert_file_has_content test2-meta "CUTE" ++ + $OSTREE show --print-metadata-key=SOMENUM test2 > test2-meta +-assert_file_has_content test2-meta "uint64 3026418949592973312" ++case "$("${test_builddir}/get-byte-order")" in ++ (4321) ++ assert_file_has_content test2-meta "uint64 42" ++ ;; ++ (1234) ++ assert_file_has_content test2-meta "uint64 3026418949592973312" ++ ;; ++ (*) ++ fatal "neither little-endian nor big-endian?" ++ ;; ++esac ++ + $OSTREE show -B --print-metadata-key=SOMENUM test2 > test2-meta + assert_file_has_content test2-meta "uint64 42" + $OSTREE show --print-detached-metadata-key=SIGNATURE test2 > test2-meta +diff --git a/tests/get-byte-order.c b/tests/get-byte-order.c +new file mode 100644 +index 0000000..7e7ba31 +--- /dev/null ++++ b/tests/get-byte-order.c +@@ -0,0 +1,12 @@ ++/* Helper for OSTree tests: return host byte order */ ++ ++#include "config.h" ++ ++#include ++ ++int ++main (void) ++{ ++ g_print ("%d\n", G_BYTE_ORDER); ++ return 0; ++} diff --git a/debian/patches/series b/debian/patches/series index c5896f0c..18f048f7 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ 2018.1/tests-Don-t-assume-uid-primary-gid.patch +2018.1/tests-Assert-that-byte-order-is-swapped-on-LE-but-not-BE-.patch