sssd/0075-sss_nss_idmap-tests-Us...

66 lines
2.8 KiB
Diff

From 21d34cf3c25de9e39f3947059f65b56c8e7dbe25 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: Mon, 4 May 2015 07:34:19 +0200
Subject: [PATCH 75/99] sss_nss_idmap-tests: Use different prepared buffers for
big endian
We get error EBADMSG instead of EOK due to endianess issue
[==========] Running 2 test(s).
[ RUN ] test_getsidbyname
0x4a != 0
src/tests/cmocka/sss_nss_idmap-tests.c:108: error: Failure!
[ FAILED ] test_getsidbyname
[ RUN ] test_getorigbyname
0x4a != 0
src/tests/cmocka/sss_nss_idmap-tests.c:127: error: Failure!
[ FAILED ] test_getorigbyname
Reviewed-by: Sumit Bose <sbose@redhat.com>
(cherry picked from commit 582f6b1d15d216a39a66b70f0b3ecdf5b0f47673)
---
src/tests/cmocka/sss_nss_idmap-tests.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/tests/cmocka/sss_nss_idmap-tests.c b/src/tests/cmocka/sss_nss_idmap-tests.c
index 4ba8f2f9265389d63983e44fe14f026c9a7b8d50..8807eca619d7b07d919168e5629042cf38f654ac 100644
--- a/src/tests/cmocka/sss_nss_idmap-tests.c
+++ b/src/tests/cmocka/sss_nss_idmap-tests.c
@@ -28,6 +28,7 @@
#include "util/util.h"
+#include "util/sss_endian.h"
#include "sss_client/idmap/sss_nss_idmap.h"
#include "tests/cmocka/common_mock.h"
@@ -42,12 +43,23 @@ struct sss_nss_make_request_test_data {
enum nss_status nss_status;
};
+#if (__BYTE_ORDER == __LITTLE_ENDIAN)
uint8_t buf1[] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 't', 'e', 's', 't', 0x00};
uint8_t buf2[] = {0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 't', 'e', 's', 't', 0x00};
uint8_t buf3[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 't', 'e', 's', 't', 0x00};
uint8_t buf4[] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 't', 'e', 's', 't', 'x'};
uint8_t buf_orig1[] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 'k', 'e', 'y', 0x00, 'v', 'a', 'l', 'u', 'e', 0x00};
+#elif (__BYTE_ORDER == __BIG_ENDIAN)
+uint8_t buf1[] = {0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 't', 'e', 's', 't', 0x00};
+uint8_t buf2[] = {0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 't', 'e', 's', 't', 0x00};
+uint8_t buf3[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 't', 'e', 's', 't', 0x00};
+uint8_t buf4[] = {0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 't', 'e', 's', 't', 'x'};
+
+uint8_t buf_orig1[] = {0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 'k', 'e', 'y', 0x00, 'v', 'a', 'l', 'u', 'e', 0x00};
+#else
+ #error "unknow endianess"
+#endif
enum nss_status sss_nss_make_request(enum sss_cli_command cmd,
struct sss_cli_req_data *rd,
--
2.4.0