From a3cbe2eab29b3a2b25bff1f822c06d85f5f2def9 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Tue, 3 Nov 2020 13:07:32 +0100 Subject: [PATCH] [ceph-nautilus] Fix fuzzer test on big-endian systems Currently, the test_expand_random_binary test fails on big-endian systems. It turns out that this is because the special_random routine in RepeatExpandingFormatter uses struct.pack in a manner where the returned byte sequence depends on host byte order. Fixed this to enforce the same output across platforms. --- s3tests/fuzz/headers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s3tests/fuzz/headers.py b/s3tests/fuzz/headers.py index a491928..9532984 100644 --- a/s3tests/fuzz/headers.py +++ b/s3tests/fuzz/headers.py @@ -189,7 +189,7 @@ class RepeatExpandingFormatter(string.Formatter): if charset_arg == 'binary' or charset_arg == 'binary_no_whitespace': num_bytes = length + 8 tmplist = [self.prng.getrandbits(64) for _ in xrange(num_bytes / 8)] - tmpstring = struct.pack((num_bytes / 8) * 'Q', *tmplist) + tmpstring = struct.pack('<' + (num_bytes / 8) * 'Q', *tmplist) if charset_arg == 'binary_no_whitespace': tmpstring = ''.join(c for c in tmpstring if c not in string.whitespace) return tmpstring[0:length]