test_generate_signed_pre_key fails on big-endian architectures
Closed this issue · 3 comments
I have:
- searched open and closed issues for duplicates
Bug description
On big-endian architectures (s390x and ppc64) one test fails with the following error:
libsignal-protocol-c-2.3.2/tests/test_key_helper.c:248:F:case:test_generate_signed_pre_key:0: Assertion 'memcmp(signedPreKey, data, len) == 0' failed: memcmp(signedPreKey, data, len) == 1, 0 == 0
Device info
Device: Virtual machine run by openSUSE Build Service
libsignal-protocol-c version: 2.3.2
Link to logs
Build log for s390x: https://build.opensuse.org/package/live_build_log/devel:libraries:c_c++/libsignal-protocol-c/SLE_12_SP4/s390x
Build log for ppc64: https://build.opensuse.org/package/live_build_log/devel:libraries:c_c++/libsignal-protocol-c/openSUSE_Factory_PowerPC/ppc64
Will investigate further, as soon as I finish getting an OpenSUSE/ppc64 install going in qemu.
From what little info has been provided, its unclear if this is an endian issue or an architecture/platform issue. However, I'll report my findings once I've dug deeper.
I managed to get OpenSUSE/ppc64 up and running inside qemu, and I've successfully reproduced the test failure. I'll update the issue once I've investigated the cause.
Okay, your initial assumption was correct. Its an endian issue, specifically inside the protobuf-c code. There's a flag that code uses to know whether it has to swap byte order for certain types, yet there's nothing in the build configuration process to detect endian-ness and set that flag. If I manually set the flag, all tests pass.
Hopefully the fix for this will just involve a change to the CMake configuration files.