From 1338d9e910e71387f8c836b23f95c5cfc4061b3e Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Thu, 6 Oct 2016 14:46:29 +0100 Subject: [PATCH] Fix up nbdtypes test to correctly use htobe64 Previous change hadn't taken this into account, and hopefully this makes our test a little clearer. --- tests/unit/check_nbdtypes.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/unit/check_nbdtypes.c b/tests/unit/check_nbdtypes.c index 262d166..63ab4e8 100644 --- a/tests/unit/check_nbdtypes.c +++ b/tests/unit/check_nbdtypes.c @@ -189,12 +189,14 @@ START_TEST( test_convert_from ) struct nbd_request_raw request_raw; struct nbd_request request; - request_raw.from = 0x8000000000000000; + uint64_t target = 0x8000000000000000; + /* this is stored big-endian */ + request_raw.from = htobe64(target); + + /* We expect this to convert big-endian to the host format */ nbd_r2h_request( &request_raw, &request ); - uint64_t target = 1; - target <<= 63; fail_unless( target == request.from, "from was wrong" ); } END_TEST