check_expected_ptr() fails with stack pointer on QEMU arm32v7
Some tests are failing on a QEMU arm32v7 build. I've pared the source down to the following.
I've tried passing 0x00000000fffde6c0
to expect_value()
but the error is the same so I expect some truncating and then casting is causing all the top bits to be set.
Using check_expected()
instead of check_expected_ptr()
works in this case but not in my full test program.
root@33a9b0448d46:/shared# cat t.c
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <cmocka.h>
void fn(char *t)
{
check_expected_ptr(t);
}
void test()
{
char *s = "";
expect_value(fn, t, s);
fn(s);
}
int main()
{
const struct CMUnitTest tests[] =
{
cmocka_unit_test(test),
};
return cmocka_run_group_tests_name("", tests, NULL, NULL);
}
root@33a9b0448d46:/shared# LD_LIBRARY_PATH=./cmocka/build/src/ ./t
[==========] : Running 1 test(s).
[ RUN ] test
[ ERROR ] --- 0xfffde6c0 != 0xfffffffffffde6c0
t.c:8: error: Check of parameter t, function fn failed
t.c:14: note: Expected parameter declared here
[ LINE ] --- t.c:8: error: Failure!
[ FAILED ] test
[==========] : 1 test(s) run.
[ PASSED ] 0 test(s).
[ FAILED ] : 1 test(s), listed below:
[ FAILED ] test
1 FAILED TEST(S)