apache / celix

Apache Celix is a framework for C and C++14 to develop dynamic modular software applications using component and in-process service-oriented programming.
https://celix.apache.org/
Apache License 2.0
158 stars 85 forks source link

Error Handling and Coverage Improvement of the Framework Library #686

Open PengZheng opened 7 months ago

PengZheng commented 7 months ago

Currently, the overall coverage of the framework library is around 85%. Utilizing error injector, we shall try to increase the code coverage to 90% or more. This should happen after deprecated APIs have been removed.

I believe by increasing the overall coverage, we can eliminate many corner case bugs like the following:

/**
 * @brief Register a service to the Celix framework.
 *
 * Note: Please use the celix_bundleContext_registerServiceAsync instead.
 *
 * @param ctx The bundle context
 * @param svc the service object. Normally a pointer to a service struct (i.e. a struct with function pointers)
 * @param serviceName the service name, cannot be NULL
 * @param properties The meta properties associated with the service. The service registration will take ownership of the properties (i.e. no destroy needed)
 * @return The serviceId (>=0) or -1 if the registration was unsuccessful.
 */
CELIX_FRAMEWORK_EXPORT long celix_bundleContext_registerService(celix_bundle_context_t *ctx, void *svc, const char* serviceName, celix_properties_t *properties);

celix_bundleContext_registerService will leak properties when serviceName == NULL.