summaryrefslogtreecommitdiffstats
path: root/test/vtable/vtable_c.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix vtable CI errorLei YU2020-01-151-9/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The CI reports failure in VtableTest.SameContent, where the case is comparing the binary of example vtables constructed from sdbusplus and macros defined in systemd. The root cause has two parts. Part I: When systemd is updated, the members in struct sd_bus_vtable is updated, e.g. * From v239 to v242, sd_bus_vtable.x.start is updated from struct { size_t element_size; } start; to: struct { size_t element_size; uint64_t features; } start; and sd_bus_vtable.x.method is updated from struct { const char *member; const char *signature; const char *result; sd_bus_message_handler_t handler; size_t offset; } method; to: struct { const char *member; const char *signature; const char *result; sd_bus_message_handler_t handler; size_t offset; const char *names; } method; * From v242 to v243, sd_bus_vtable.x.start is updated to struct { size_t element_size; uint64_t features; const unsigned *vtable_format_reference; } start; The code in vtable.hpp only assign the members in v239, the new members are intialized with 0, so it differs from the vtable constructed from macros defined by systemd. The fix is to use macros from systemd in vtable.hpp as well, which is suggested by systemd: > Please do not initialize this structure directly, use the > macros below instead Part II: The `const char *names` in struct method and signal introduced between systemd v239 and v242 is a pointer to const strings. By default they are "empty" strings, but there is no guarantee that the compiler will use the same pointer for the same string. So the test case can not assume the binaries are the same for two vtables even they are constructed with the same parameters. Update the test case to use real `const char*` and handler/get/set functions and check each member of the struct instead of comparing the binary data by memcmp. Tested: Verify the CI passes. Change-Id: I9e94ff16075dd3f12d73e96438c0d864203bdcf4 Signed-off-by: Lei YU <mine260309@gmail.com>
* Update repo to conform to openbmc code standardAndrew Geissler2018-02-051-17/+13
| | | | | Change-Id: If1d6b1f04514367cc544c2507a845b3e9d6d3435 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
* Add vtable supportPatrick Williams2016-09-271-0/+21
The sd-bus interfaces for creating a VTABLE require C-only syntax, which prevents them from being used in C++ code. Create constexpr wrappers that emit VTABLE entries so that a VTABLE can be created in C++ code. Change-Id: I22892de1e87448ab9dce48034c9f030bc5bab9af Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
OpenPOWER on IntegriCloud