summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2015-05-04 07:34:19 +0200
committerJakub Hrozek <jhrozek@redhat.com>2015-05-04 15:21:27 +0200
commit21d34cf3c25de9e39f3947059f65b56c8e7dbe25 (patch)
tree1878f71507613bcbb62a3b53b3cce7159b8c3f18
parent7c8c34c1ad152892f93d8e01336258bfd0bc35b9 (diff)
downloadsssd-21d34cf3c25de9e39f3947059f65b56c8e7dbe25.tar.gz
sssd-21d34cf3c25de9e39f3947059f65b56c8e7dbe25.tar.xz
sssd-21d34cf3c25de9e39f3947059f65b56c8e7dbe25.zip
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)
-rw-r--r--src/tests/cmocka/sss_nss_idmap-tests.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tests/cmocka/sss_nss_idmap-tests.c b/src/tests/cmocka/sss_nss_idmap-tests.c
index 4ba8f2f92..8807eca61 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,