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:
Simon McVittie authored and Atomic Bot committed 2018-01-04 12:32:47 +00:00
1 parent 95f9b392a4
commit 994cd66744
3 files changed
+32 -2

No files matched your search

+13 -1
View File
@@ -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
+12
View File
@@ -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;
}