diff options
author | Ingo Huerner <ingo.huerner@xse.de> | 2013-08-13 17:58:04 +0200 |
---|---|---|
committer | Ingo Huerner <ingo.huerner@xse.de> | 2013-08-13 17:58:04 +0200 |
commit | 43bbe147e4e39d29df50ab94c4e2ac3bd2763407 (patch) | |
tree | 658ffaecc480d6192a279b3bb15e3779f60c87d4 | |
parent | 09e3b9119b67c0fef70e8c18ff0c316d6d3264ee (diff) | |
download | persistence-client-library-43bbe147e4e39d29df50ab94c4e2ac3bd2763407.tar.gz |
Removed findings after code review; removed memset for arrays, let the compiler do the work
-rw-r--r-- | src/persistence_client_library.c | 28 | ||||
-rw-r--r-- | src/persistence_client_library_custom_loader.c | 1 | ||||
-rw-r--r-- | src/persistence_client_library_db_access.c | 8 | ||||
-rw-r--r-- | src/persistence_client_library_dbus_service.c | 19 | ||||
-rw-r--r-- | src/persistence_client_library_file.c | 40 | ||||
-rw-r--r-- | src/persistence_client_library_handle.c | 2 | ||||
-rw-r--r-- | src/persistence_client_library_key.c | 43 | ||||
-rw-r--r-- | src/persistence_client_library_lc_interface.c | 8 | ||||
-rw-r--r-- | src/persistence_client_library_pas_interface.c | 8 | ||||
-rw-r--r-- | src/persistence_client_library_prct_access.c | 3 | ||||
-rw-r--r-- | test/persistence_admin_service_mockup.c | 6 | ||||
-rw-r--r-- | test/persistence_client_library_test.c | 4 | ||||
-rw-r--r-- | test/persistence_lifeCycle_mockup.c | 20 |
13 files changed, 88 insertions, 102 deletions
diff --git a/src/persistence_client_library.c b/src/persistence_client_library.c index 52168ba..0608539 100644 --- a/src/persistence_client_library.c +++ b/src/persistence_client_library.c @@ -48,7 +48,7 @@ void invalidateCustomPlugin(int idx); int pclInitLibrary(const char* appName, int shutdownMode) { int status = 0; - int i = 0, rval = 0; + int i = 0, rval = 1; if(gPclInitialized == PCLnotInitialized) { @@ -71,16 +71,26 @@ int pclInitLibrary(const char* appName, int shutdownMode) gMaxKeyValDataSize = atoi(pDataSize); } - setup_dbus_mainloop(); + if( setup_dbus_mainloop() == -1) + { + DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pclInitLibrary => Failed to setup main loop")); + return -1; + } #if USE_DBUS // register for lifecycle and persistence admin service dbus messages - register_lifecycle(shutdownMode); - register_pers_admin_service(); -#endif + if(register_lifecycle(shutdownMode) == -1) + { + DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pclInitLibrary => Failed to register to lifecycle dbus interface")); + return -1; + } - // clear the open file descriptor array - memset(gOpenFdArray, 0, MaxPersHandle * sizeof(int)); + rval = register_pers_admin_service(); + { + DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pclInitLibrary => Failed to register to pers admin dbus interface")); + return -1; + } +#endif /// get custom library names to load status = get_custom_libraries(); @@ -164,8 +174,8 @@ int pclDeinitLibrary(void) // unregister for lifecycle and persistence admin service dbus messages #if USE_DBUS - unregister_lifecycle(gShutdownMode); - unregister_pers_admin_service(); + rval = unregister_lifecycle(gShutdownMode); + rval = unregister_pers_admin_service(); #endif // unload custom client libraries diff --git a/src/persistence_client_library_custom_loader.c b/src/persistence_client_library_custom_loader.c index b12a131..64526e5 100644 --- a/src/persistence_client_library_custom_loader.c +++ b/src/persistence_client_library_custom_loader.c @@ -351,6 +351,7 @@ int load_custom_library(PersistenceCustomLibs_e customLib, Pers_custom_functs_s } else { + error = dlerror(); DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("load_custom_library - error:"), DLT_STRING(error)); rval = EPERS_DLOPENERROR; } diff --git a/src/persistence_client_library_db_access.c b/src/persistence_client_library_db_access.c index 15ff7a6..e5aad0e 100644 --- a/src/persistence_client_library_db_access.c +++ b/src/persistence_client_library_db_access.c @@ -202,7 +202,7 @@ int pers_db_read_key(char* dbPath, char* key, PersistenceInfo_s* info, unsigned char workaroundPath[128]; // workaround, because /sys/ can not be accessed on host!!!! snprintf(workaroundPath, 128, "%s%s", "/Data", dbPath ); - if( (idx < PersCustomLib_LastEntry) && (gPersCustomFuncs[idx].custom_plugin_handle_get_data != NULL) ) + if( (idx < PersCustomLib_LastEntry) && (gPersCustomFuncs[idx].custom_plugin_get_data != NULL) ) { if(info->configKey.customID[0] == '\0') // if we have not a customID we use the key { @@ -306,7 +306,7 @@ int pers_db_write_key(char* dbPath, char* key, PersistenceInfo_s* info, unsigned else if(PersistenceStorage_custom == info->configKey.storage) // custom storage implementation via custom library { int idx = custom_client_name_to_id(dbPath, 1); - if((idx < PersCustomLib_LastEntry) && (gPersCustomFuncs[idx].custom_plugin_handle_set_data != NULL) ) + if((idx < PersCustomLib_LastEntry) && (gPersCustomFuncs[idx].custom_plugin_set_data != NULL) ) { if(info->configKey.customID[0] == '\0') // if we have not a customID we use the key { @@ -370,7 +370,7 @@ int pers_db_get_key_size(char* dbPath, char* key, PersistenceInfo_s* info) else if(PersistenceStorage_custom == info->configKey.storage) // custom storage implementation via custom library { int idx = custom_client_name_to_id(dbPath, 1); - if((idx < PersCustomLib_LastEntry) && (gPersCustomFuncs[idx].custom_plugin_handle_set_data != NULL) ) + if((idx < PersCustomLib_LastEntry) && (gPersCustomFuncs[idx].custom_plugin_get_size != NULL) ) { if(info->configKey.customID[0] == '\0') // if we have not a customID we use the key { @@ -444,7 +444,7 @@ int pers_db_delete_key(char* dbPath, char* key, PersistenceInfo_s* info) else // custom storage implementation via custom library { int idx = custom_client_name_to_id(dbPath, 1); - if((idx < PersCustomLib_LastEntry) && (gPersCustomFuncs[idx].custom_plugin_handle_set_data != NULL) ) + if((idx < PersCustomLib_LastEntry) && (gPersCustomFuncs[idx].custom_plugin_delete_data != NULL) ) { if(info->configKey.customID[0] == '\0') // if we have not a customID we use the key { diff --git a/src/persistence_client_library_dbus_service.c b/src/persistence_client_library_dbus_service.c index 5176ba1..6b1d05b 100644 --- a/src/persistence_client_library_dbus_service.c +++ b/src/persistence_client_library_dbus_service.c @@ -28,6 +28,7 @@ #include <unistd.h> #include <stdlib.h> +//#define DEBUG_MODE 1 pthread_mutex_t gDbusInitializedMtx = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t gDbusInitializedCond = PTHREAD_COND_INITIALIZER; @@ -73,16 +74,20 @@ DBusConnection* get_dbus_connection(void) return gDbusConn; } +int bContinue = 0; + //------------------------------------------------------------------------ // debugging only until "correct" exit of main loop is possible!!!!! //------------------------------------------------------------------------ +#ifdef DEBUG_MODE + #include "signal.h" -static int endLoop = 0; void sigHandler(int signo) { - endLoop = 1; + bContinue = FALSE; } +#endif //------------------------------------------------------------------------ @@ -292,6 +297,7 @@ int setup_dbus_mainloop(void) { DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("dbus_connection_open() Error :"), DLT_STRING(err.message) ); dbus_error_free(&err); + return -1; } } else @@ -306,6 +312,7 @@ int setup_dbus_mainloop(void) if(rval) { DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pthread_create( DBUS run_mainloop ) returned an error:"), DLT_INT(rval) ); + return -1; } // wait for condition variable @@ -467,9 +474,10 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2, // lock mutex to make sure dbus main loop is running pthread_mutex_lock(&gDbusInitializedMtx); - signal(SIGTERM, sigHandler); - signal(SIGQUIT, sigHandler); +#if DEBUG_MODE signal(SIGINT, sigHandler); +#endif + DBusConnection* conn = (DBusConnection*)userData; dbus_error_init(&err); @@ -489,7 +497,6 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2, else { int ret; - int bContinue = 0; memset(&gPollInfo, 0 , sizeof(gPollInfo)); gPollInfo.nfds = 1; @@ -610,8 +617,6 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2, } } } - if(endLoop == 1) - break; } while (0!=bContinue); } diff --git a/src/persistence_client_library_file.c b/src/persistence_client_library_file.c index 7b759f9..82e30c7 100644 --- a/src/persistence_client_library_file.c +++ b/src/persistence_client_library_file.c @@ -143,16 +143,13 @@ int pclFileOpen(unsigned int ldbid, const char* resource_id, unsigned int user_n int shared_DB = 0; PersistenceInfo_s dbContext; - char dbKey[DbKeyMaxLen]; // database key - char dbPath[DbPathMaxLen]; // database location - char backupPath[DbKeyMaxLen]; // backup file - char csumPath[DbPathMaxLen]; // checksum file + char dbKey[DbKeyMaxLen] = {0}; // database key + char dbPath[DbPathMaxLen] = {0}; // database location + char backupPath[DbKeyMaxLen] = {0}; // backup file + char csumPath[DbPathMaxLen] = {0}; // checksum file //DLT_LOG(gDLTContext, DLT_LOG_INFO, DLT_STRING("pclFileOpen: "), DLT_INT(ldbid), DLT_STRING(resource_id) ); - memset(dbKey, 0, DbKeyMaxLen); - memset(dbPath, 0, DbPathMaxLen); - dbContext.context.ldbid = ldbid; dbContext.context.seat_no = seat_no; dbContext.context.user_no = user_no; @@ -169,9 +166,6 @@ int pclFileOpen(unsigned int ldbid, const char* resource_id, unsigned int user_n if( dbContext.configKey.permission != PersistencePermission_ReadOnly && pclBackupNeeded(dbPath) ) { - memset(backupPath, 0, DbKeyMaxLen); - memset(csumPath, 0, DbPathMaxLen); - snprintf(backupPath, DbPathMaxLen, "%s%s", dbPath, "~"); snprintf(csumPath, DbPathMaxLen, "%s%s", dbPath, "~.crc"); @@ -223,9 +217,6 @@ int pclFileOpen(unsigned int ldbid, const char* resource_id, unsigned int user_n { if(handle < MaxPersHandle) { - memset(backupPath, 0, DbKeyMaxLen); - memset(csumPath, 0, DbPathMaxLen); - snprintf(backupPath, DbPathMaxLen, "%s%s", dbPath, "~"); snprintf(csumPath, DbPathMaxLen, "%s%s", dbPath, "~.crc"); @@ -276,11 +267,8 @@ int pclFileRemove(unsigned int ldbid, const char* resource_id, unsigned int user int shared_DB = 0; PersistenceInfo_s dbContext; - char dbKey[DbKeyMaxLen]; // database key - char dbPath[DbPathMaxLen]; // database location - - memset(dbKey, 0, DbKeyMaxLen); - memset(dbPath, 0, DbPathMaxLen); + char dbKey[DbKeyMaxLen] = {0}; // database key + char dbPath[DbPathMaxLen] = {0}; // database location dbContext.context.ldbid = ldbid; dbContext.context.seat_no = seat_no; @@ -377,8 +365,7 @@ int pclFileWriteData(int fd, const void * buffer, int buffer_size) if( gFileHandleArray[fd].permission != PersistencePermission_ReadOnly && gFileHandleArray[fd].backupCreated == 0) { - char csumBuf[ChecksumBufSize]; - memset(csumBuf, 0, ChecksumBufSize); + char csumBuf[ChecksumBufSize] = {0}; // calculate checksum pclCalcCrc32Csum(fd, csumBuf); @@ -412,7 +399,6 @@ int pclCreateFile(const char* path) const char* delimiters = "/\n"; // search for blank and end of line char* tokenArray[24]; char* thePath = (char*)path; - char createPath[DbPathMaxLen]; int numTokens = 0, i = 0, validPath = 1; int handle = 0; @@ -437,7 +423,7 @@ int pclCreateFile(const char* path) if(validPath == 1) { - memset(createPath, 0, DbPathMaxLen); + char createPath[DbPathMaxLen] = {0}; snprintf(createPath, DbPathMaxLen, "/%s",tokenArray[0] ); for(i=1; i<numTokens-1; i++) { @@ -478,13 +464,9 @@ int pclVerifyConsistency(const char* origPath, const char* backupPath, const cha int backupAvail = 0, csumAvail = 0; int fdCsum = 0, fdBackup = 0; - char origCsumBuf[ChecksumBufSize]; - char backCsumBuf[ChecksumBufSize]; - char csumBuf[ChecksumBufSize]; - - memset(origCsumBuf, 0, ChecksumBufSize); - memset(backCsumBuf, 0, ChecksumBufSize); - memset(csumBuf, 0, ChecksumBufSize); + char origCsumBuf[ChecksumBufSize] = {0}; + char backCsumBuf[ChecksumBufSize] = {0}; + char csumBuf[ChecksumBufSize] = {0}; // check if we have a backup and checksum file backupAvail = access(backupPath, F_OK); diff --git a/src/persistence_client_library_handle.c b/src/persistence_client_library_handle.c index bad7350..821e9a3 100644 --- a/src/persistence_client_library_handle.c +++ b/src/persistence_client_library_handle.c @@ -29,7 +29,7 @@ static int gHandleIdx = 1; static int gInitialized = 0; /// open file descriptor handle array -int gOpenFdArray[MaxPersHandle]; +int gOpenFdArray[MaxPersHandle] = {0}; /// persistence key handle array PersistenceKeyHandle_s gKeyHandleArray[MaxPersHandle]; diff --git a/src/persistence_client_library_key.c b/src/persistence_client_library_key.c index 83a9efb..2b2f6cd 100644 --- a/src/persistence_client_library_key.c +++ b/src/persistence_client_library_key.c @@ -43,14 +43,10 @@ int pclKeyHandleOpen(unsigned int ldbid, const char* resource_id, unsigned int u { PersistenceInfo_s dbContext; - char dbKey[DbKeyMaxLen]; // database key - char dbPath[DbPathMaxLen]; // database location + char dbKey[DbKeyMaxLen] = {0}; // database key + char dbPath[DbPathMaxLen] = {0}; // database location //DLT_LOG(gDLTContext, DLT_LOG_INFO, DLT_STRING("pclKeyHandleOpen: "), DLT_INT(ldbid), DLT_STRING(resource_id) ); - - memset(dbKey, 0, DbKeyMaxLen); - memset(dbPath, 0, DbPathMaxLen); - dbContext.context.ldbid = ldbid; dbContext.context.seat_no = seat_no; dbContext.context.user_no = user_no; @@ -329,11 +325,8 @@ int pclKeyDelete(unsigned int ldbid, const char* resource_id, unsigned int user_ { PersistenceInfo_s dbContext; - char dbKey[DbKeyMaxLen]; // database key - char dbPath[DbPathMaxLen]; // database location - - memset(dbKey, 0, DbKeyMaxLen); - memset(dbPath, 0, DbPathMaxLen); + char dbKey[DbKeyMaxLen] = {0}; // database key + char dbPath[DbPathMaxLen] = {0}; // database location dbContext.context.ldbid = ldbid; dbContext.context.seat_no = seat_no; @@ -375,11 +368,8 @@ int pclKeyGetSize(unsigned int ldbid, const char* resource_id, unsigned int user { PersistenceInfo_s dbContext; - char dbKey[DbKeyMaxLen]; // database key - char dbPath[DbPathMaxLen]; // database location - - memset(dbKey, 0, DbKeyMaxLen); - memset(dbPath, 0, DbPathMaxLen); + char dbKey[DbKeyMaxLen] = {0}; // database key + char dbPath[DbPathMaxLen] = {0}; // database location dbContext.context.ldbid = ldbid; dbContext.context.seat_no = seat_no; @@ -427,11 +417,8 @@ int pclKeyReadData(unsigned int ldbid, const char* resource_id, unsigned int use { PersistenceInfo_s dbContext; - char dbKey[DbKeyMaxLen]; // database key - char dbPath[DbPathMaxLen]; // database location - - memset(dbKey, 0, DbKeyMaxLen); - memset(dbPath, 0, DbPathMaxLen); + char dbKey[DbKeyMaxLen] = {0}; // database key + char dbPath[DbPathMaxLen] = {0}; // database location dbContext.context.ldbid = ldbid; dbContext.context.seat_no = seat_no; @@ -486,11 +473,8 @@ int pclKeyWriteData(unsigned int ldbid, const char* resource_id, unsigned int us unsigned int hash_val_data = 0; - char dbKey[DbKeyMaxLen]; // database key - char dbPath[DbPathMaxLen]; // database location - - memset(dbKey, 0, DbKeyMaxLen); - memset(dbPath, 0, DbPathMaxLen); + char dbKey[DbKeyMaxLen] = {0}; // database key + char dbPath[DbPathMaxLen] = {0}; // database location dbContext.context.ldbid = ldbid; dbContext.context.seat_no = seat_no; @@ -545,11 +529,8 @@ int pclKeyRegisterNotifyOnChange(unsigned int ldbid, const char* resource_id, un PersistenceInfo_s dbContext; // unsigned int hash_val_data = 0; - char dbKey[DbKeyMaxLen]; // database key - char dbPath[DbPathMaxLen]; // database location - - memset(dbKey, 0, DbKeyMaxLen); - memset(dbPath, 0, DbPathMaxLen); + char dbKey[DbKeyMaxLen] = {0}; // database key + char dbPath[DbPathMaxLen] = {0}; // database location //DLT_LOG(gDLTContext, DLT_LOG_INFO, DLT_STRING("pclKeyRegisterNotifyOnChange: "), DLT_INT(ldbid), DLT_STRING(resource_id) ); diff --git a/src/persistence_client_library_lc_interface.c b/src/persistence_client_library_lc_interface.c index 7e1206e..4e528e3 100644 --- a/src/persistence_client_library_lc_interface.c +++ b/src/persistence_client_library_lc_interface.c @@ -189,6 +189,7 @@ int send_lifecycle_register(const char* method, int shutdownMode, int reg) if(!dbus_connection_send(conn, message, 0)) { DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_register => Access denied"), DLT_STRING(error.message) ); + rval = -1; } dbus_connection_flush(conn); @@ -196,17 +197,20 @@ int send_lifecycle_register(const char* method, int shutdownMode, int reg) else { DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_register => ERROR: Invalid connection")); + rval = -1; } dbus_message_unref(message); } else { DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_register => ERROR: Invalid message")); + rval = -1; } } else { DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_register => ERROR: connection isn NULL")); + rval = -1; } return rval; @@ -240,6 +244,7 @@ int send_lifecycle_request(const char* method, int requestId, int status) if(!dbus_connection_send(conn, message, 0)) { DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_request => Access denied"), DLT_STRING(error.message) ); + rval = -1; } dbus_connection_flush(conn); @@ -247,17 +252,20 @@ int send_lifecycle_request(const char* method, int requestId, int status) else { DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_request => ERROR: Invalid connection")); + rval = -1; } dbus_message_unref(message); } else { DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_request => ERROR: Invalid message")); + rval = -1; } } else { DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_request => ERROR: connection isn NULL")); + rval = -1; } return rval; diff --git a/src/persistence_client_library_pas_interface.c b/src/persistence_client_library_pas_interface.c index b8d360e..ce7b37c 100644 --- a/src/persistence_client_library_pas_interface.c +++ b/src/persistence_client_library_pas_interface.c @@ -244,10 +244,10 @@ int send_pas_register(const char* method, int notificationFlag) if(busName != NULL) { - DBusMessage* message = dbus_message_new_method_call("org.genivi.persistence", // destination - "/org/genivi/persistence", // path - "org.genivi.persistence.admin", // interface - method); // method + DBusMessage* message = dbus_message_new_method_call("org.genivi.persistence.admin", // destination + "/org/genivi/persistence/admin", // path + "org.genivi.persistence.admin", // interface + method); // method if(message != NULL) { diff --git a/src/persistence_client_library_prct_access.c b/src/persistence_client_library_prct_access.c index f45d392..e9a2991 100644 --- a/src/persistence_client_library_prct_access.c +++ b/src/persistence_client_library_prct_access.c @@ -81,8 +81,7 @@ itzam_btree* get_resource_cfg_table(PersistenceRCT_e rct, int group) if(gResourceOpen[arrayIdx] == 0) // check if database is already open { itzam_state state; - char filename[DbPathMaxLen]; - memset(filename, 0, DbPathMaxLen); + char filename[DbPathMaxLen] = {0}; switch(rct) // create db name { diff --git a/test/persistence_admin_service_mockup.c b/test/persistence_admin_service_mockup.c index e8cf693..b5ebc8f 100644 --- a/test/persistence_admin_service_mockup.c +++ b/test/persistence_admin_service_mockup.c @@ -310,7 +310,7 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtableFallback, v gPollInfo.fds[0].events = POLLIN; // register for messages - if ( (TRUE==dbus_connection_register_object_path(conn, "/org/genivi/persistence", &vtable, userData)) + if ( (TRUE==dbus_connection_register_object_path(conn, "/org/genivi/persistence/admin", &vtable, userData)) && (TRUE==dbus_connection_register_fallback(conn, "/", &vtableFallback, userData)) ) { if (TRUE!=dbus_connection_set_watch_functions(conn, addWatch, removeWatch, watchToggled, NULL, NULL)) @@ -359,9 +359,9 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtableFallback, v switch (buf[0]) { case CMD_REQUEST_NAME: - if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER !=dbus_bus_request_name(conn, "org.genivi.persistence", DBUS_NAME_FLAG_DO_NOT_QUEUE, &err)) + if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER !=dbus_bus_request_name(conn, "org.genivi.persistence.admin", DBUS_NAME_FLAG_DO_NOT_QUEUE, &err)) { - fprintf(stderr, "Cannot acquire name 'org.genivi.persistence': \n \"(%s)\". Bailing out!\n", err.message); + fprintf(stderr, "Cannot acquire name 'org.genivi.persistence.admin': \n \"(%s)\". Bailing out!\n", err.message); dbus_error_free(&err); bContinue = FALSE; } diff --git a/test/persistence_client_library_test.c b/test/persistence_client_library_test.c index d2d5a38..a77f0e5 100644 --- a/test/persistence_client_library_test.c +++ b/test/persistence_client_library_test.c @@ -658,7 +658,7 @@ START_TEST(test_DataHandle) fail_unless(ret != -1, "Failed to close handle!!"); ret = pclKeyHandleClose(1024); - fail_unless(ret == -1, "Could close, but should not!!"); + fail_unless(ret == -4, "Max handle!!"); pclDeinitLibrary(); } @@ -898,6 +898,7 @@ static Suite * persistencyClientLib_suite() TCase * tc_Plugin = tcase_create("Plugin"); tcase_add_test(tc_Plugin, test_Plugin); + suite_add_tcase(s, tc_persGetData); suite_add_tcase(s, tc_persSetData); suite_add_tcase(s, tc_persSetDataNoPRCT); @@ -911,7 +912,6 @@ static Suite * persistencyClientLib_suite() suite_add_tcase(s, tc_Cursor); suite_add_tcase(s, tc_Plugin); // activate only if the plugins are available - return s; } diff --git a/test/persistence_lifeCycle_mockup.c b/test/persistence_lifeCycle_mockup.c index 1438837..d26cfa0 100644 --- a/test/persistence_lifeCycle_mockup.c +++ b/test/persistence_lifeCycle_mockup.c @@ -191,30 +191,30 @@ DBusHandlerResult checkPersAdminMsg(DBusConnection * connection, DBusMessage * m DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED; //printf("checkPersAdminMsg '%s' -> '%s'\n", dbus_message_get_interface(message), dbus_message_get_member(message)); - if((0==strcmp("org.genivi.NodeStateManager.Consumer", dbus_message_get_interface(message)))) + if((0==strcmp("org.genivi.NodeStateManager.LifeCycleConsumer", dbus_message_get_interface(message)))) { if((0==strcmp("RegisterShutdownClient", dbus_message_get_member(message)))) { - printf(" ==> org.genivi.NodeStateManager.Consumer - received - ==> RegisterShutdownClient \n"); + printf(" ==> org.genivi.NodeStateManager.LifeCycleConsumer - received - ==> RegisterShutdownClient \n"); result = checkAdminMsg(connection, message, 1); } else if((0==strcmp("UnRegisterShutdownClient", dbus_message_get_member(message)))) { - printf(" ==> org.genivi.NodeStateManager.Consumer - received - ==> UnRegisterShutdownClient \n"); + printf(" ==> org.genivi.NodeStateManager.LifeCycleConsumer - received - ==> UnRegisterShutdownClient \n"); result = checkAdminMsg(connection, message, 0); } else if((0==strcmp("LifecycleRequestComplete", dbus_message_get_member(message)))) { - printf(" ==> org.genivi.NodeStateManager.Consumer - received - ==> LifecycleRequestComplete \n"); + printf(" ==> org.genivi.NodeStateManager.LifeCycleConsumer - received - ==> LifecycleRequestComplete \n"); result = checkAdminMsg(connection, message, 0); } else { - printf(" ==> org.genivi.NodeStateManager.Consumer - received U N KN O W N-'%s'\n", dbus_message_get_interface(message)); + printf(" ==> org.genivi.NodeStateManager.LifeCycleConsumer - received U N KN O W N-'%s'\n", dbus_message_get_interface(message)); } } else @@ -346,7 +346,7 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtableFallback, v gPollInfo.fds[0].events = POLLIN; // register for messages - if ( (TRUE==dbus_connection_register_object_path(conn, "/org/genivi/NodeStateManager", &vtable, userData)) + if ( (TRUE==dbus_connection_register_object_path(conn, "/org/genivi/NodeStateManager/LifecycleConsumer", &vtable, userData)) && (TRUE==dbus_connection_register_fallback(conn, "/", &vtableFallback, userData)) ) { if (TRUE!=dbus_connection_set_watch_functions(conn, addWatch, removeWatch, watchToggled, NULL, NULL)) @@ -395,9 +395,9 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtableFallback, v switch (buf[0]) { case CMD_REQUEST_NAME: - if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER !=dbus_bus_request_name(conn, "org.genivi.NodeStateManager", DBUS_NAME_FLAG_DO_NOT_QUEUE, &err)) + if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER !=dbus_bus_request_name(conn, "org.genivi.NodeStateManager.LifecycleConsumer", DBUS_NAME_FLAG_DO_NOT_QUEUE, &err)) { - fprintf(stderr, "Cannot acquire name 'org.genivi.NodeStateManager.Consumer': \n \"(%s)\". Bailing out!\n", err.message); + fprintf(stderr, "Cannot acquire name 'org.genivi.NodeStateManager.LifeCycleConsumer': \n \"(%s)\". Bailing out!\n", err.message); dbus_error_free(&err); bContinue = FALSE; } @@ -442,7 +442,7 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtableFallback, v } while (0!=bContinue); } - dbus_connection_unregister_object_path(conn, "/org/genivi/NodeStateManager/Consumer"); + dbus_connection_unregister_object_path(conn, "/org/genivi/NodeStateManager/LifeCycleConsumer"); dbus_connection_unregister_object_path(conn, "/"); } close(gEfds); @@ -543,7 +543,7 @@ int main(int argc, char *argv[]) printf("Wait, press enter to exit!!\n"); getchar(); - printf("Exiting Persistence Admin mockup!!\n"); + printf("Exiting Persistence Lifecycle mockup!!\n"); return 0; } |