summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2017-02-28 15:54:06 +0100
committerLukas Slebodnik <lslebodn@redhat.com>2017-02-28 23:28:51 +0100
commitbc07967636135e48252198936ac8975510918e99 (patch)
tree5bd50f92268a3dfafe47abee0c5c18dabe90d922 /src/tests
parentfe079dfc0779f154c11d5a3c8ff664f717a5de3d (diff)
downloadsssd-bc07967636135e48252198936ac8975510918e99.tar.gz
sssd-bc07967636135e48252198936ac8975510918e99.tar.xz
sssd-bc07967636135e48252198936ac8975510918e99.zip
authtok: fix tests on big-endian
Related to https://pagure.io/SSSD/sssd/issue/3270 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/cmocka/test_authtok.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/tests/cmocka/test_authtok.c b/src/tests/cmocka/test_authtok.c
index b2ef08a1c..79b01be13 100644
--- a/src/tests/cmocka/test_authtok.c
+++ b/src/tests/cmocka/test_authtok.c
@@ -604,8 +604,15 @@ void test_sss_authtok_sc_pin(void **state)
SSS_AUTHTOK_TYPE_SC_PIN);
size = sss_authtok_get_size(ts->authtoken);
assert_int_equal(size, 28);
- assert_memory_equal(sss_authtok_get_data(ts->authtoken), "\11\0\0\0\1\0\0\0\1\0\0\0\1\0\0\0" "12345678\0\0\0\0",
- size);
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ assert_memory_equal(sss_authtok_get_data(ts->authtoken),
+ "\11\0\0\0\1\0\0\0\1\0\0\0\1\0\0\0" "12345678\0\0\0\0",
+ size);
+#else
+ assert_memory_equal(sss_authtok_get_data(ts->authtoken),
+ "\0\0\0\11\0\0\0\1\0\0\0\1\0\0\0\1" "12345678\0\0\0\0",
+ size);
+#endif
ret = sss_authtok_set_sc_pin(ts->authtoken, "12345678", 5);
assert_int_equal(ret, EOK);
@@ -613,8 +620,15 @@ void test_sss_authtok_sc_pin(void **state)
SSS_AUTHTOK_TYPE_SC_PIN);
size = sss_authtok_get_size(ts->authtoken);
assert_int_equal(size, 25);
- assert_memory_equal(sss_authtok_get_data(ts->authtoken), "\6\0\0\0\1\0\0\0\1\0\0\0\1\0\0\0" "12345\0\0\0\0",
- size);
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ assert_memory_equal(sss_authtok_get_data(ts->authtoken),
+ "\6\0\0\0\1\0\0\0\1\0\0\0\1\0\0\0" "12345\0\0\0\0",
+ size);
+#else
+ assert_memory_equal(sss_authtok_get_data(ts->authtoken),
+ "\0\0\0\6\0\0\0\1\0\0\0\1\0\0\0\1" "12345\0\0\0\0",
+ size);
+#endif
ret = sss_authtok_get_sc_pin(ts->authtoken, &pin, &len);
assert_int_equal(ret, EOK);