History log of /sssd/src/tests/sbus_codegen_tests.c
Revision Date Author Comments Expand
b9941359b3181c42f415530d5ccad0f4664d85fa 21-Sep-2016 Lukas Slebodnik <lslebodn@redhat.com>

Remove double semicolon at the end of line Reviewed-by: Pavel Březina <pbrezina@redhat.com>

626d8217a2e578ba641ae3c968752aa15284a210 19-Sep-2016 Petr Čech <pcech@redhat.com>

TESTS: Fixing of 'const' warnings in sbus tests Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>

8dc21698c4ed699801d2b6f9135b3d6cb8512917 20-Nov-2015 Lukas Slebodnik <lslebodn@redhat.com>

sbus_codegen_tests: Use portable definition of large constants There were warnings on 32 bit architecture related to 64bit integer constants. /home/build/sssd/src/tests/sbus_codegen_tests.c:257: warning: integer constant is too large for ‘long’ type /home/build/sssd/src/tests/sbus_codegen_tests.c:259: warning: integer constant is too large for ‘long’ type INT${N}_C(value) are defined in the standard c99 Reviewed-by: Michal Židek <mzidek@redhat.com>

617d5161d4ec454afc673ce1836b02f82435b347 26-Oct-2015 Lukas Slebodnik <lslebodn@redhat.com>

sbus_codegen_tests: Suppress warning Wmaybe-uninitialized There is a warning with gcc 4.8 src/tests/sbus_codegen_tests.c:1131:18: warning: 'exp_values' may be used uninitialized in this function [-Wmaybe-uninitialized] const char **exp_values; ^ Reviewed-by: Pavel Březina <pbrezina@redhat.com>

e51143e3e67c70b86dd9a67cb7e802dd96f989e1 02-Oct-2015 Pavel Březina <pbrezina@redhat.com>

sbus codegen tests: free ctx Memory context was not freed therefore we got stuck in tevent loop that mocks D-Bus. Resolves: https://fedorahosted.org/sssd/ticket/2759 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>

429f8454a40b939604e9a96d780661a94a38da2e 15-Jul-2015 Jakub Hrozek <jhrozek@redhat.com>

tests: Move N_ELEMENTS definition to tests/common.h Avoids code duplication Reviewed-by: Pavel Březina <pbrezina@redhat.com>

ac744223411099a862a747e7168a30255c003bf7 22-May-2015 Pavel Březina <pbrezina@redhat.com>

sbus: add a{sas} get invoker Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

4e5d19f659d8c545c4ed3c307c95cfe4f2ca33cb 17-Feb-2015 Pavel Březina <pbrezina@redhat.com>

sbus codegen: do not prefix getters with iface name Prefixing getters with C name of the interface is just redundant since it is the same as the name of the structure that contains those fields. The following structure: struct test_pilot { $type test_pilot_get_name; } changes to: struct test_pilot { $type get_name; } Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

b742179ac0790068380618ab72a06af18544f09c 23-Jan-2015 Pavel Březina <pbrezina@redhat.com>

sbus: support org.freedesktop.DBus.Properties Bring back org.freedesktop.DBus.Properties with support of multiple interfaces on single object path. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

46ee931314e6a5517f5c6b6b14f759364be119cc 23-Jan-2015 Pavel Březina <pbrezina@redhat.com>

sbus: support multiple interfaces on single path This patch removes the old message handler which is replaced with a new one that supports multiple interfaces registered on single object path. A hash table is used to store registered object paths and their interfaces. When an entry or the table itself is destroyed, registered object path is unregistered through delete callback. It temporarily removes support of Introspect and Properties standard D-Bus interfaces and disables unit tests of those interfaces. The support is brought back by following patches. Resolves: https://fedorahosted.org/sssd/ticket/2339 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

9fa95168d80beba04b333b06edc492ecb8b085a1 23-Jan-2015 Pavel Březina <pbrezina@redhat.com>

sbus: add new iface via sbus_conn_register_iface() Rename sbus_conn_add_interface() to sbus_conn_register_iface() and remove sbus_new_interface() calls since it is just one more unnecessary call outside the sbus code. The function sbus_new_interface() is made static and used directly in sbus_conn_register_iface(). The name was chosen to better describe what the function is doing. That it registers an interface on a given object path. The same interface can be used with different paths so it is not really about adding an interface. Preparation for: https://fedorahosted.org/sssd/ticket/2339 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

ba99aa00a305d298f65379e3add7536553c82455 18-Jun-2014 Pavel Březina <pbrezina@redhat.com>

sbus_codegen_tests: free memory context The memory context was not freed and therefore a destructor that closes connection to D-Bus and performs cleanup task was not executed. Resolves: https://fedorahosted.org/sssd/ticket/2347 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>

d8c2d3c5e6d9fa36bd6a53a40549af016924dfc3 27-May-2014 Jakub Hrozek <jhrozek@redhat.com>

TESTS: check dbus mock result Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>

9b0e541f37f780c31c69c22c663589b87e4e788b 27-May-2014 Jakub Hrozek <jhrozek@redhat.com>

TESTS: check allocation result Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>

4f7f714e118e95896fac5239c7a8b529c39a4758 27-May-2014 Jakub Hrozek <jhrozek@redhat.com>

SBUS: Implement org.freedesktop.DBus.Properties.GetAll for primitive types This patch implements the GetAll method of the org.freedesktop.DBus.Properties interface by iterating over the available getters and putting all the results into a single getter. The patch includes a unit test that exercies all currently supported array types. Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>

c3c6eb141d6a288b3da20ad6a2e5718844b2d4ad 26-May-2014 Pavel Reichl <preichl@redhat.com>

TEST: fix warning in sbus_codegen_tests Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>

5de968e80ade1c02d1907834dcff95e9fc9ad10a 22-May-2014 Jakub Hrozek <jhrozek@redhat.com>

SBUS: Return / if an object path getter returns NULL Reviewed-by: Stef Walter <stefw@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com>

58229439447d5617913a5a2e173b78105c694842 22-May-2014 Pavel Březina <pbrezina@redhat.com>

SBUS: Return empty string if a string getter returns NULL In line with getters never returning errors, a getter should return an empty string instead of NULL in case a string-like property in SSSD is not set. Reviewed-by: Stef Walter <stefw@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com>

90e04eae7e54ec892a6f239783df94dab5d1ed9a 22-May-2014 Jakub Hrozek <jhrozek@redhat.com>

SBUS: Implement org.freedesktop.DBus.Properties.Get for primitive types This patch implements type-safe getters for primitive types and their arrays. The patch includes unit tests of all supported types and arrays of these types. All getter are synchronous. The getters never fail, instead, they return a default or 'not defined' value. Making the getters synchronous and always returning a value will make it significantly easier to implement the GetAll method. Reviewed-by: Stef Walter <stefw@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com>

1a94716209e40a9ccaedc7e70f9de961d1cced48 25-Apr-2014 Lukas Slebodnik <lslebodn@redhat.com>

TEST: Some macros aren't defined in older version of check. src/tests/sbus_codegen_tests-sbus_codegen_tests.o: In function `eject_handler': tests/sbus_codegen_tests.c:229: undefined reference to `ck_assert_uint_eq' tests/sbus_codegen_tests.c:235: undefined reference to `ck_assert_uint_eq' tests/sbus_codegen_tests.c:239: undefined reference to `ck_assert_uint_eq' src/tests/sbus_codegen_tests-sbus_codegen_tests.o: In function `test_marshal_basic_types': src/tests/sbus_codegen_tests.c:446: undefined reference to `ck_assert_uint_eq' src/tests/sbus_codegen_tests.c:449: undefined reference to `ck_assert_uint_eq' src/tests/sbus_codegen_tests-sbus_codegen_tests.o: src/tests/sbus_codegen_tests.c:451: more undefined references to `ck_assert_uint_eq' follow collect2: ld returned 1 exit status make[3]: *** [sbus_codegen_tests] Error 1 Macro ck_assert_uint_eq was added in check-0.9.10 Resolves: https://fedorahosted.org/sssd/ticket/2319 Reviewed-by: Michal Židek <mzidek@redhat.com>

1203e462650f035b0df2304075d60b9a99e36715 19-Apr-2014 Stef Walter <stefw@redhat.com>

sbus_codegen_tests: Add test case type-safe handler args This adds a big test case for invoking a handler with all supported basic arguments, and constructing a reply with the same. Lots of tedious code, but worth it to make sure things work well.

dff909d473f43a6bd0f0286fa2d279c0ebe945c6 19-Apr-2014 Stef Walter <stefw@redhat.com>

sbus: Add type-safe DBus method handlers and finish functions Type safe method handlers allow methods not to have to do tedious unwrapping and wrapping of DBus method call messages or replies. Arguments of the following DBus types are supported in type-safe method handlers. In addition arrays of these are supported. y: uint8_t b: bool (but no arrays, yet) n: int16_t q: uint16_t i: int32_t u: uint32_t x: int64_t t: uint64_t d: double s: char * (utf8 string) o: char * (object path) As an exception, arrays of booleans are not supported, but could be added later. Other more complex types could be added later if desired. If a method has other argument types, then it must be marked as having a raw handler (see below). Internally each method can have a type specific invoker function which unpacks the incoming arguments and invokes the method handler with the correct arguments. Each method also has a finish which accepts the type-safe out arguments (ie: return values) and builds the reply message. Like other request 'finish' functions, these free the request talloc context, and are to be used in place of sbus_request_finish() or friends. Raw method handlers parse their own method arguments, and prepare their own reply (ideally using sbus_request_finish() helpers). They can also do strange things like have variable arguments. To mark a DBus method as having a raw method handler use the following annotation: <annotation name="org.freedesktop.sssd.RawHandler" value="true"/> Raw methods do not have invokers or finish functions. I've left all of the internal peer to peer communication using raw method handlers. No code changes here.

a8f6a9dd171f89ecfb41822901805b5c73b5ea77 10-Apr-2014 Jakub Hrozek <jhrozek@redhat.com>

tests: Don't set the check fork mode explicitly Instead, let the user pick the fork mode with CK_FORK variable (see info check) Reviewed-by: Sumit Bose <sbose@redhat.com>

07e941c1bbdc752142bbd3b838c540bc7ecd0ed7 14-Mar-2014 Stef Walter <stefw@redhat.com>

sbus: Refactor how we export DBus interfaces Most importantly, stop using per connection private data. This doesn't scale when you have more than one thing exporting or exported on a connection. Remove struct sbus_interface and expand sbus_conn_add_interface() function. Remove various struct sbus_interface args to connection initialization functions and make callers use sbus_conn_add_interface() directly. The old method was optimized for exporting one interface on a connection. We'll have connections that export zero, one or more interfaces. To export an interface on a DBus server, call sbus_conn_add_interface() from within the sbus_server_conn_init_fn. To export an interface on a DBus client, call sbus_conn_add_interface() after sbus_new_connection() returns. As before struct sbus_interface represents an object exported via DBus. However it is now talloc allocated. One can set instance data on the struct sbus_interface. This instance data is passed to the various handlers and used in their implementation. However, we now have type safe interface exporting in the various high level sss_process_init() sss_monitor_init() and so on. Introspection support was not in use, and is now gone until we implement it using the metadata (future patch). Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>

d9577dbd92555b0755881e37724019ef9c578404 14-Mar-2014 Stef Walter <stefw@gnome.org>

sbus: Add struct sbus_request to represent a DBus invocation struct sbus_request represents a request from a dbus client being handled by a dbus server implementation. The struct contains the message, connection and method (and in the future teh property) which is being requested. In the future it will contain caller information as well. sbus_request is a talloc memory context, and is a good place to attach any allocations and memory specific to the request. Each handler accepts an sbus_request. If a handler returns EOK, it is assumed that the handler will finish the request. Any of the sbus_request_*finish() methods can be used to complete the request and send back a reply. sbus_request_return_and_finish() uses the same argument varargs syntax as dbus_message_append_args(), which isn't a great syntax. Document it a bit, but don't try to redesign: The marshalling work (will follow this patch set) will remove the need to use varargs for most DBus implementation code. This patch migrates the monitor and data provider dbus code to use sbus_request, but does not try to rework the talloc context's to use it. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>

c2cc119de8eac712c040b3993f41c967ff2278de 24-Feb-2014 Stef Walter <stefw@redhat.com>

sbus: Generate constants from interface definitions This is not strictly necessary, but avoids duplicating data in mulitple places, and makes the interface definitions benefit dbus callers (a little). After applying this commit you may need to 'make clean' as the codegen has changed. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Sumit Bose <sbose@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>

fcd8093c58638dc7c4f9cddfc97f273b94ce2ead 24-Feb-2014 Stef Walter <stefw@redhat.com>

sbus: Add sbus_vtable and update codegen to support it Each interface is a vtable structure derived from sbus_vtable, in the sense that it has an sbus_vtable struct as its first argument. This lets us upcast the interface vtable structure to an sbus_vtable and dispatch to it dynamically and cleanly. The interface metadata contains information about which vtable offset in the interface metadata should be dispatched to for a given function. This is a common scheme, not only among dbus implementations, but also compiled languages. Currently all the vtable functions are of type sbus_msg_handler_fn. These are the handlers we are familiar with and perform raw processing of the message. Later commits will introduce type safe handlers that levelage compile checking and automatic argument packing/unpacking. Although this may seem contrived now, the remainder of the dbus infrastructure work will build on this, including ofd.Properties, ofd.ObjectManager, ofd.Introspect, compiler checked type safe unpacking/packing, etc. The codegen now generates vtable structures for each interface along-side the metadata, and fills in vtable offsets appropriately. It is obviously still possible to hand-craft such vtables and metadata if needed for a special case. Once again examples output can be found at: src/tests/sbus_codegen_tests_generated.h Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Sumit Bose <sbose@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>

b699c4d7f85a5404be1d1ee9450331aea869b886 24-Feb-2014 Stef Walter <stefw@redhat.com>

sbus: Add meta data structures and code generator These metadata structures hold the information about all the details of a DBus interface. They are typically generated from the canonical XML form of the DBus interface, although they may also be hand crafted. Add some handy functions for looking up methods, props, signals, in the metadata of an interface. Currently lookups are just done by looking through an array. If performance becomes an issue (ie: very large interfaces) it would be really easy to sort things and use bsearch(). Later commits will include some definitions using this metadata and related functions. DBus interfaces are defined here: http://dbus.freedesktop.org/doc/dbus-specification.html#introspection-format The introspection data format has become the standard way to represent a DBus interface. For many examples see /usr/share/dbus-1/interfaces/ on a typical linux machine. A word about annotations. These are extra flags or values that can be assigned to anything. So far, the codegen supports this annotation: org.freedesktop.DBus.GLib.CSymbol - An annotation specified in the specification that tells us what C symbol to generate for a given interface or method. By default the codegen will build up a symbol name from the DBus name. It is possible to confuse the code generator into producing invalid C code (with strange method names, for example), but the C compiler catches such silliness right away. Add tests testing basic features of the codegen and poking through the metadata it creates. Also test the metadata lookup functions. Generated code is checked in for easy discovery. An example of the XML interface definitions can be found at: src/tests/sbus_codegen_tests.xml And an example of the generated header can be found here: src/tests/sbus_codegen_tests_generated.h Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Sumit Bose <sbose@redhat.com> Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>