Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unit_test failed. #45

Open
tercelcn opened this issue Jun 1, 2022 · 5 comments
Open

unit_test failed. #45

tercelcn opened this issue Jun 1, 2022 · 5 comments

Comments

@tercelcn
Copy link

tercelcn commented Jun 1, 2022

I run the unit_test.c in arm clang. test_printf fail because "%M" point to jsonrpc_print_methods.

@cpq
Copy link
Member

cpq commented Jun 5, 2022

Care to share the output?

@tercelcn
Copy link
Author

tercelcn commented Jun 6, 2022

#define MJSON_ENABLE_RPC 0
run the main in unit_test.c, and run code
{ char *s = NULL; const char *fmt = "{\"a\":%d, \"b\":%u, \"c\":%ld, \"d\":%lu, \"e\":%M}"; ASSERT(mjson_printf(&mjson_print_dynamic_buf, &s, fmt, -1, 3456789012, (long) -1, (unsigned long) 3456789012, f1, 1234) == 60); ASSERT(s != NULL); str = "{\"a\":-1, \"b\":3456789012, \"c\":-1, \"d\":3456789012, " "\"e\":[1234]}"; ASSERT(memcmp(s, str, 60) == 0); free(s); }
when code run to } else if (fc == 'M') { mjson_vprint_fn_t vfn = va_arg(*ap, mjson_vprint_fn_t); n += vfn(fn, fnd, ap); }
vfn should point to f1, but vfn point to 0xCE0A6A14 which isn't a funciton.

@cpq
Copy link
Member

cpq commented Jun 6, 2022

I have added an armlinux target which builds and tests on aarch64 linux - and tests pass:

make -C test armlinux

What hardware are you using? Is that a raspi or cortex-m device?

@tercelcn
Copy link
Author

tercelcn commented Jun 7, 2022

My hardware is stm32f103 and mdk IDE, compiler is armclang 6.

@cpq
Copy link
Member

cpq commented Jun 7, 2022

Thank you @tercelcn .
Is there any chance to try it with GCC, just to narrow down the issue to armclang?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants