tests: Assert that byte-order is swapped on LE but not BE CPUs
Closes: #1392 Signed-off-by: Simon McVittie <smcv@collabora.com> Closes: #1393 Approved by: cgwalters
This commit is contained in:
parent
95f9b392a4
commit
994cd66744
|
|
@ -130,7 +130,13 @@ experimental_test_scripts = \
|
||||||
tests/test-summary-collections.sh \
|
tests/test-summary-collections.sh \
|
||||||
tests/test-pull-collections.sh \
|
tests/test-pull-collections.sh \
|
||||||
$(NULL)
|
$(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_SOURCES = tests/repo-finder-mount.c
|
||||||
tests_repo_finder_mount_CFLAGS = $(common_tests_cflags)
|
tests_repo_finder_mount_CFLAGS = $(common_tests_cflags)
|
||||||
|
|
|
||||||
|
|
@ -759,8 +759,20 @@ $OSTREE show --print-metadata-key=FOO test2 > test2-meta
|
||||||
assert_file_has_content test2-meta "BAR"
|
assert_file_has_content test2-meta "BAR"
|
||||||
$OSTREE show --print-metadata-key=KITTENS test2 > test2-meta
|
$OSTREE show --print-metadata-key=KITTENS test2 > test2-meta
|
||||||
assert_file_has_content test2-meta "CUTE"
|
assert_file_has_content test2-meta "CUTE"
|
||||||
|
|
||||||
$OSTREE show --print-metadata-key=SOMENUM test2 > test2-meta
|
$OSTREE show --print-metadata-key=SOMENUM test2 > test2-meta
|
||||||
|
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"
|
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
|
$OSTREE show -B --print-metadata-key=SOMENUM test2 > test2-meta
|
||||||
assert_file_has_content test2-meta "uint64 42"
|
assert_file_has_content test2-meta "uint64 42"
|
||||||
$OSTREE show --print-detached-metadata-key=SIGNATURE test2 > test2-meta
|
$OSTREE show --print-detached-metadata-key=SIGNATURE test2 > test2-meta
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
/* Helper for OSTree tests: return host byte order */
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
g_print ("%d\n", G_BYTE_ORDER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue