Finished switch to single threaded dbus communication
authorIngo Huerner <ingo.huerner@xse.de>
Thu, 14 Nov 2013 13:05:40 +0000 (14:05 +0100)
committerIngo Huerner <ingo.huerner@xse.de>
Thu, 14 Nov 2013 13:05:40 +0000 (14:05 +0100)
src/persistence_client_library.c
src/persistence_client_library_db_access.c
src/persistence_client_library_dbus_cmd.c
src/persistence_client_library_dbus_service.c
src/persistence_client_library_dbus_service.h
src/persistence_client_library_lc_interface.c
src/persistence_client_library_pas_interface.c
test/persistence_client_library_test.c

index 0a0104b..f723083 100644 (file)
@@ -69,9 +69,7 @@ int pclInitLibrary(const char* appName, int shutdownMode)
       /// blacklist path environment variable
       const char *pBlacklistPath = getenv("PERS_BLACKLIST_PATH");
 
-      printf("\nInitial => Mutex Lock\n");
       pthread_mutex_lock(&gDbusPendingRegMtx);   // block until pending received
-      printf("Initial <= Mutex Lock\n");
 
       if(pDataSize != NULL)
       {
@@ -94,15 +92,6 @@ int pclInitLibrary(const char* appName, int shutdownMode)
          return EPERS_DBUS_MAINLOOP;
       }
 
-#if 1
-      if(register_pers_admin_service() == -1)
-      {
-         DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pclInitLibrary => Failed to register to pers admin dbus interface"));
-         return EPERS_REGISTER_ADMIN;
-      }
-#endif
-
-#if 1
       if(gShutdownMode != PCL_SHUTDOWN_TYPE_NONE)
       {
          // register for lifecycle and persistence admin service dbus messages
@@ -112,7 +101,12 @@ int pclInitLibrary(const char* appName, int shutdownMode)
             return EPERS_REGISTER_LIFECYCLE;
          }
       }
-#endif
+
+      if(register_pers_admin_service() == -1)
+      {
+         DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pclInitLibrary => Failed to register to pers admin dbus interface"));
+         return EPERS_REGISTER_ADMIN;
+      }
 
       /// get custom library names to load
       status = get_custom_libraries();
@@ -194,8 +188,8 @@ int pclDeinitLibrary(void)
                                          DLT_STRING("- init counter: "), DLT_INT(gPclInitialized));
 
       // unregister for lifecycle and persistence admin service dbus messages
-      rval = unregister_pers_admin_service();
       rval = unregister_lifecycle(gShutdownMode);
+      rval = unregister_pers_admin_service();
 
       // unload custom client libraries
       for(i=0; i<PersCustomLib_LastEntry; i++)
index e9a8689..2f6aec7 100644 (file)
@@ -607,7 +607,6 @@ int persistence_notify_on_change(char* key, unsigned int ldbid, unsigned int use
                                  pclChangeNotifyCallback_t callback, PersNotifyRegPolicy_e regPolicy)
 {
    int rval = 0;
-   uint64_t cmd;
 
    if(regPolicy < Notify_lastEntry)
    {
@@ -628,10 +627,7 @@ int persistence_notify_on_change(char* key, unsigned int ldbid, unsigned int use
          gChangeNotifyCallback = NULL;
       }
 
-      // add command and data to queue
-      cmd = (uint64_t)CMD_REG_NOTIFY_SIGNAL;
-
-      if(-1 == write(gEfds, &cmd, (sizeof(uint64_t))))
+      if(-1 == deliverToMainloop(CMD_REG_NOTIFY_SIGNAL, 0, 0))
       {
          DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("persistence_notify_on_change => failed to write to pipe"), DLT_INT(errno));
          rval = -1;
@@ -662,13 +658,7 @@ int pers_send_Notification_Signal(const char* key, PersistenceDbContext_s* conte
       gSendNotifySeatNo = context->seat_no;
       gSendNotifyReason = reason;
 
-      //printf("pers_send_Notification_Signal => key: %s | lbid: %d | gUserNo: %d | gSeatNo: %d | gReason: %d \n", key, gLdbid, gUserNo, gSeatNo, gReason);
-
-      uint64_t cmd;
-      // add command and data to queue
-      cmd = (uint64_t)CMD_SEND_NOTIFY_SIGNAL;
-
-      if(-1 == write(gEfds, &cmd, (sizeof(uint64_t))))
+      if(-1 == deliverToMainloop(CMD_SEND_NOTIFY_SIGNAL, 0,0) )
       {
          DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pers_send_Notification_Signal => failed to write to pipe"), DLT_INT(errno));
          rval = EPERS_NOTIFY_SIG;
index a032351..cb627f9 100644 (file)
@@ -254,7 +254,7 @@ void process_send_pas_request(DBusConnection* conn, unsigned int requestID, int
 
          if(!dbus_pending_call_set_notify(pending, msg_pending_func, "PersistenceAdminRequestCompleted", NULL))
          {
-            printf("process_send_pas_request => dbus_pending_call_set_notify: FAILED\n");
+            DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("process_send_pas_request => dbus_pending_call_set_notify: FAILED\n"));
          }
          dbus_pending_call_unref(pending);
       }
@@ -278,7 +278,6 @@ void process_send_pas_register(DBusConnection* conn, int regType, int notificati
    DBusPendingCall* pending = NULL;
 
    char* method = NULL;
-   printf("    process_send_pas_register => regType: %d | notificaiton flag: %d\n", regType, notificationFlag);
 
    if(regType == 0)
       method = "UnRegisterPersAdminNotification";
@@ -344,7 +343,6 @@ void process_send_lifecycle_register(DBusConnection* conn, int regType, int shut
    dbus_error_init (&error);
 
    char* method = NULL;
-   printf("    process_send_lifecycle_register => reg: %d | shutdownMode flag: %d\n", regType, shutdownMode);
 
    if(regType == 1)
       method = "RegisterShutdownClient";
@@ -411,8 +409,6 @@ void process_send_lifecycle_request(DBusConnection* conn, int requestId, int sta
    DBusError error;
    dbus_error_init (&error);
 
-   printf("    process_send_lifecycle_request => requestID: %d | status: %d\n", requestId, status);
-
    if(conn != NULL)
    {
       DBusMessage* message = dbus_message_new_method_call("org.genivi.NodeStateManager",           // destination
@@ -471,7 +467,7 @@ void msg_pending_func(DBusPendingCall *call, void *data)
    }
    else
    {
-      DLT_LOG(gDLTContext, DLT_LOG_INFO, DLT_STRING("msg_pending_func ==> UNlock mutex") );
+      //DLT_LOG(gDLTContext, DLT_LOG_INFO, DLT_STRING("msg_pending_func ==> UNlock mutex") );
       dbus_message_get_args(message, &err, DBUS_TYPE_INT32, &replyArg, DBUS_TYPE_INVALID);
    }
 
@@ -479,9 +475,7 @@ void msg_pending_func(DBusPendingCall *call, void *data)
    dbus_message_unref(message);
 
    // unlock the mutex because we have received the reply to the dbus message
-   printf("msg_pending_func => mutex unlock: %s \n",(char*)(data));
    pthread_mutex_unlock(&gDbusPendingRegMtx);
-   printf("msg_pending_func <= mutex unlock\n");
 }
 
 
index aab33da..deaa397 100644 (file)
 pthread_cond_t  gDbusInitializedCond = PTHREAD_COND_INITIALIZER;
 pthread_mutex_t gDbusInitializedMtx  = PTHREAD_MUTEX_INITIALIZER;
 pthread_mutex_t gDbusPendingRegMtx   = PTHREAD_MUTEX_INITIALIZER;
-int gEfds = 0;
+pthread_mutex_t gMainLoopMtx         = PTHREAD_MUTEX_INITIALIZER;
+
+int gEfds;
+
 
 typedef enum EDBusObjectType
 {
@@ -248,7 +251,6 @@ int setup_dbus_mainloop(void)
 
    // enable locking of data structures in the D-Bus library for multi threading.
    dbus_threads_init_default();
-
    dbus_error_init(&err);
 
    // wain until dbus main loop has been setup and running
@@ -474,7 +476,7 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2,
    else if (NULL != conn)
    {
       dbus_connection_set_exit_on_disconnect(conn, FALSE);
-      if (-1 == (gEfds = eventfd(0, EFD_NONBLOCK)))
+      if (-1 == (gEfds = eventfd(0, 0)))
       {
          DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("mainLoop => eventfd() failed w/ errno:"), DLT_INT(errno) );
       }
@@ -555,42 +557,33 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2,
                                  if (0>ret)
                                  {
                                     DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("mainLoop => read() failed"), DLT_STRING(strerror(errno)) );
-                                    printf(" * mainloop: read F A I L E D\n");
                                  }
                                  else if (ret != -1)
                                  {
-                                    printf(" * mainloop: dispatch command => [0]: %d | [1]: %d | [2]: %d\n", buf[0], buf[1], buf[2]);
                                     switch (buf[0])
                                     {
                                        case CMD_PAS_BLOCK_AND_WRITE_BACK:
                                           process_block_and_write_data_back((buf[2]), buf[1]);
                                           break;
                                        case CMD_LC_PREPARE_SHUTDOWN:
-                                          printf(" CMD => Prepare shutdown\n");
                                           process_prepare_shutdown((buf[2]), buf[1]);
                                           break;
                                        case CMD_SEND_NOTIFY_SIGNAL:
-                                          printf(" CMD => Send notification signal\n");
                                           process_send_notification_signal(conn);
                                           break;
                                        case CMD_REG_NOTIFY_SIGNAL:
-                                          printf(" CMD => Register notification signal\n");
                                           process_reg_notification_signal(conn);
                                           break;
                                        case CMD_SEND_PAS_REQUEST:
-                                          printf(" CMD => Admin request => request: %d | status: %d\n", (buf[2]), buf[1]);
                                           process_send_pas_request(conn, (buf[2]), buf[1]);
                                           break;
                                        case CMD_SEND_PAS_REGISTER:
-                                          printf(" CMD => Admin register => mode: %d | type: %d\n", (buf[2]), buf[1]);
                                           process_send_pas_register(conn, (buf[1]), buf[2]);
                                           break;
                                        case CMD_SEND_LC_REQUEST:
-                                          printf(" CMD => Lifecycle request => request: %d | status\n", (buf[2]), buf[1]);
                                           process_send_lifecycle_request(conn, (buf[2]), buf[1]);
                                           break;
                                        case CMD_SEND_LC_REGISTER:
-                                          printf(" CMD => Lifecycle register => mode: %d | type: %d\n", (buf[2]), buf[1]);
                                           process_send_lifecycle_register(conn, (buf[1]), buf[2]);
                                           break;
                                        case CMD_QUIT:
@@ -600,6 +593,7 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2,
                                           DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("mainLoop => command not handled"), DLT_INT(buf[0]) );
                                           break;
                                     }
+                                    pthread_mutex_unlock(&gMainLoopMtx);
                                  }
                               }
                            }
@@ -647,3 +641,24 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2,
    return 0;
 }
 
+
+
+int deliverToMainloop(tCmd mainloopCmd, unsigned int param1, unsigned int param2)
+{
+   int rval = 0;
+   uint64_t cmd;
+   uint16_t* cmd_chk;
+
+   pthread_mutex_lock(&gMainLoopMtx);
+
+   cmd = ( ((uint64_t)param2 << 32) | ((uint64_t)param1 << 16) | mainloopCmd);
+
+   if(-1 == write(gEfds, &cmd, (sizeof(uint64_t))))
+   {
+     DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("deliverToMainloop => failed to write to pipe"), DLT_INT(errno));
+     rval = -1;
+   }
+
+   return rval;
+}
+
index 5ebd643..f80c7c9 100644 (file)
@@ -73,4 +73,6 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2,
 int setup_dbus_mainloop(void);
 
 
+int deliverToMainloop(tCmd mainloopCmd, unsigned int param1, unsigned int param2);
+
 #endif /* PERSISTENCE_CLIENT_LIBRARY_DBUS_SERVICE_H_ */
index 0b9d00e..50324a2 100644 (file)
@@ -44,11 +44,7 @@ int check_lc_request(int request, int requestID)
    {
       case NsmShutdownNormal:
       {
-         uint64_t cmd;
-         // add command and data to queue
-         cmd = ( ((uint64_t)requestID << 32) | ((uint64_t)request << 16) | CMD_LC_PREPARE_SHUTDOWN);
-
-         if(-1 == write(gEfds, &cmd, (sizeof(uint64_t))))
+         if(-1 == deliverToMainloop(CMD_LC_PREPARE_SHUTDOWN, request, requestID) )
          {
             DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("check_lc_request => failed to write to pipe"), DLT_INT(errno));
             rval = NsmErrorStatus_Fail;
@@ -151,60 +147,20 @@ DBusHandlerResult checkLifecycleMsg(DBusConnection * connection, DBusMessage * m
 
 int register_lifecycle(int shutdownMode)
 {
-   int rval =  0;
-   uint64_t cmd;
-   uint16_t* cmd_chk;
-
-   cmd = ( ((uint64_t)shutdownMode << 32) | ((uint64_t)1 << 16) | CMD_SEND_LC_REGISTER);
-   cmd_chk = &cmd;
-   printf("register_lifecycle => cmd_chk: [0]: %d | [1]: %d  | [2]: %d \n", cmd_chk[0],cmd_chk[1],cmd_chk[2]);
-
-   if(-1 == write(gEfds, &cmd, (sizeof(uint64_t))))
-   {
-     DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("register_lifecycle => failed to write to pipe"), DLT_INT(errno));
-     rval = -1;
-   }
-   printf("register_lifecycle <= \n\n");
-   return rval;
+   return deliverToMainloop(CMD_SEND_LC_REGISTER, 1, shutdownMode);
 }
 
 
 
 int unregister_lifecycle(int shutdownMode)
 {
-   int rval =  0;
-   uint64_t cmd;
-   uint16_t* cmd_chk;
-
-   cmd = ( ((uint64_t)shutdownMode << 32) | ((uint64_t)0 << 16) | CMD_SEND_LC_REGISTER);
-   cmd_chk = &cmd;
-   printf("unregister_lifecycle => cmd_chk: [0]: %d | [1]: %d  | [2]: %d \n", cmd_chk[0],cmd_chk[1],cmd_chk[2]);
-   if(-1 == write(gEfds, &cmd, (sizeof(uint64_t))))
-   {
-     DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("unregister_lifecycle => failed to write to pipe"), DLT_INT(errno));
-     rval = -1;
-   }
-   printf("unregister_lifecycle <= \n\n");
-   return rval;
+   return deliverToMainloop(CMD_SEND_LC_REGISTER, 0, shutdownMode);
 }
 
 
 
 int send_prepare_shutdown_complete(int requestId, int status)
 {
-   int rval =  0;
-   uint64_t cmd;
-   uint16_t* cmd_chk;
-
-   cmd = ( ((uint64_t)requestId << 32) | ((uint64_t)status << 16) | CMD_SEND_LC_REQUEST);
-   cmd_chk = &cmd;
-   //printf("cmd_chk: [0]: %d | [1]: %d  | [2]: %d \n", cmd_chk[0],cmd_chk[1],cmd_chk[2]);
-   if(-1 == write(gEfds, &cmd, (sizeof(uint64_t))))
-   {
-     DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_prepare_shutdown_complete => failed to write to pipe"), DLT_INT(errno));
-     rval = -1;
-   }
-
-   return rval;
+   return deliverToMainloop(CMD_SEND_LC_REQUEST, status, requestId);
 }
 
index 56d8818..f9a7099 100644 (file)
@@ -58,11 +58,7 @@ int check_pas_request(unsigned int request, unsigned int requestID)
    {
       case (PasMsg_Block|PasMsg_WriteBack):
       {
-         uint64_t cmd;
-         // add command and data to queue
-         cmd = ( ((uint64_t)requestID << 32) | ((uint64_t)request << 16) | CMD_PAS_BLOCK_AND_WRITE_BACK);
-
-         if(-1 == write(gEfds, &cmd, (sizeof(uint64_t))))
+         if(-1 == deliverToMainloop(CMD_PAS_BLOCK_AND_WRITE_BACK, request, requestID))
          {
             DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("write failed w/ errno "), DLT_INT(errno), DLT_STRING(strerror(errno)));
             rval = PasErrorStatus_FAIL;
@@ -230,29 +226,17 @@ DBusHandlerResult checkPersAdminMsg(DBusConnection * connection, DBusMessage * m
 int register_pers_admin_service(void)
 {
    int rval =  0;
-   uint64_t cmd;
-   uint16_t* cmd_chk;
-
-
-   // register for everything
-   int notificationFlag = PasMsg_Block | PasMsg_WriteBack | PasMsg_Unblock;
 
-   cmd = ( ((uint64_t)notificationFlag << 32) | ((uint64_t)1 << 16) | CMD_SEND_PAS_REGISTER);
-   cmd_chk = &cmd;
-   printf("register_pers_admin_service => cmd_chk: [0]: %d | [1]: %d  | [2]: %d \n", cmd_chk[0],cmd_chk[1],cmd_chk[2]);
-   if(-1 == write(gEfds, &cmd, (sizeof(uint64_t))))
+   if(-1 == deliverToMainloop(CMD_SEND_PAS_REGISTER, 1,  (PasMsg_Block | PasMsg_WriteBack | PasMsg_Unblock)))
    {
     DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("register_pers_admin_service => failed to write to pipe"), DLT_INT(errno));
     rval = -1;
    }
    else
    {
-      printf(" register_pers_admin_service => Mutex Lock\n");
       pthread_mutex_lock(&gDbusPendingRegMtx);   // block until pending received
-      printf(" register_pers_admin_service <= Mutex Lock\n");
       rval = gDbusPendingRvalue;
    }
-   printf("register_pers_admin_service <= \n\n");
    return rval;
 }
 
@@ -261,29 +245,17 @@ int register_pers_admin_service(void)
 int unregister_pers_admin_service(void)
 {
    int rval =  0;
-   uint64_t cmd;
-   uint16_t* cmd_chk;
-   // register for everything
-   int notificationFlag = PasMsg_Block | PasMsg_WriteBack | PasMsg_Unblock;
 
-
-   cmd = ( ((uint64_t)notificationFlag << 32) | ((uint64_t)0 << 16) | CMD_SEND_PAS_REGISTER);
-   cmd_chk = &cmd;
-   printf("unregister_pers_admin_service => cmd_chk: [0]: %d | [1]: %d  | [2]: %d \n", cmd_chk[0],cmd_chk[1],cmd_chk[2]);
-
-   if(-1 == write(gEfds, &cmd, (sizeof(uint64_t))))
+   if(-1 == deliverToMainloop(CMD_SEND_PAS_REGISTER, 0,  (PasMsg_Block | PasMsg_WriteBack | PasMsg_Unblock)))
    {
      DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("unregister_pers_admin_service => failed to write to pipe"), DLT_INT(errno));
      rval = -1;
    }
    else
    {
-      printf(" UnRegister admin => Mutex Lock\n");
       pthread_mutex_lock(&gDbusPendingRegMtx);   // block until pending received
-      printf(" UnRegister admin<= Mutex Lock\n");
       rval = gDbusPendingRvalue;
    }
-   printf("unregister_pers_admin_service <=\n\n");
    return rval;
 }
 
@@ -292,13 +264,10 @@ int unregister_pers_admin_service(void)
 int pers_admin_service_data_sync_complete(unsigned int requestID, unsigned int status)
 {
    int rval =  0;
-   uint64_t cmd;
-   // add command and data to queue
-   cmd = ( ((uint64_t)requestID << 32) | ((uint64_t)status << 16) | CMD_SEND_PAS_REQUEST);
-   if(-1 == write(gEfds, &cmd, (sizeof(uint64_t))))
+
+   if(-1 == deliverToMainloop(CMD_SEND_PAS_REQUEST, status, requestID))
    {
       DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pers_admin_service_data_sync_complete => failed to write to pipe"), DLT_INT(errno));
-      printf("pers_admin_service_data_sync_complete => f a i l e  d  to write to pipe\n");
       rval = -1;
    }
    else
index e7a3cc1..358c431 100644 (file)
@@ -66,7 +66,7 @@ START_TEST (test_GetData)
    ret = pclInitLibrary(gTheAppId, shutdownReg);
    fail_unless(ret <= 1, "Failed to init PCL");
 
-#if 0
+#if 1
    /**
     * Logical DB ID: 0xFF with user 0 and seat 0
     *       ==> local value accessible by all users (user 0, seat 0)
@@ -165,7 +165,7 @@ START_TEST (test_GetDataHandle)
 
    ret = pclInitLibrary(gTheAppId, shutdownReg);
    fail_unless(ret <= 1, "Failed to init PCL");
-#if 0
+#if 1
    time_t t = time(0);
 
    locTime = localtime(&t);
@@ -271,7 +271,7 @@ START_TEST(test_SetData)
 
    ret = pclInitLibrary(gTheAppId, shutdownReg);
    fail_unless(ret <= 1, "Failed to init PCL");
-#if 0
+#if 1
    time_t t = time(0);
 
    locTime = localtime(&t);
@@ -384,7 +384,7 @@ START_TEST(test_SetDataNoPRCT)
 
    ret = pclInitLibrary(gTheAppId, shutdownReg);
    fail_unless(ret <= 1, "Failed to init PCL");
-#if 0
+#if 1
    time_t t = time(0);
 
    char sysTimeBuffer[128];
@@ -428,7 +428,7 @@ START_TEST(test_GetDataSize)
 
    ret = pclInitLibrary(gTheAppId, shutdownReg);
    fail_unless(ret <= 1, "Failed to init PCL");
-#if 0
+#if 1
    /**
     * Logical DB ID: 0xFF with user 3 and seat 2
     *       ==> local USER value (user 3, seat 2)
@@ -462,7 +462,7 @@ START_TEST(test_DeleteData)
 
    rval = pclInitLibrary(gTheAppId, shutdownReg);
    fail_unless(rval <= 1, "Failed to init PCL");
-#if 0
+#if 1
    // read data from key
    rval = pclKeyReadData(0xFF, "key_70", 1, 2, buffer, READ_SIZE);
    fail_unless(rval != EPERS_NOKEY, "Read form key key_70 fails");
@@ -517,7 +517,7 @@ START_TEST(test_DataFile)
 
    ret = pclInitLibrary(gTheAppId, shutdownReg);
    fail_unless(ret <= 1, "Failed to init PCL");
-#if 0
+#if 1
    writeBuffer = malloc(writeSize);
 
 
@@ -609,7 +609,7 @@ START_TEST(test_DataFileRecovery)
 
    ret = pclInitLibrary(gTheAppId, shutdownReg);
    fail_unless(ret <= 1, "Failed to init PCL");
-#if 0
+#if 1
    // test backup creation --------------------------------------------
    fd_RO = pclFileOpen(0xFF, "media/mediaDB_ReadOnly.db", 1, 1);
    fail_unless(fd_RO != -1, "Could not open file ==> /media/mediaDB_ReadOnly.db");
@@ -640,7 +640,7 @@ START_TEST(test_DataHandle)
 
    ret = pclInitLibrary(gTheAppId, shutdownReg);
    fail_unless(ret <= 1, "Failed to init PCL");
-#if 0
+#if 1
    // test file handles
    handle1 = pclFileOpen(0xFF, "media/mediaDB.db", 1, 1);
    fail_unless(handle1 != -1, "Could not open file ==> /media/mediaDB.db");
@@ -684,7 +684,7 @@ START_TEST(test_DataHandleOpen)
 
    ret = pclInitLibrary(gTheAppId, shutdownReg);
    fail_unless(ret <= 1, "Failed to init PCL");
-#if 0
+#if 1
    // open handles ----------------------------------------------------
    hd1 = pclKeyHandleOpen(0xFF, "posHandle/last_position1", 0, 0);
    fail_unless(hd1 == 1, "Failed to open handle ==> /posHandle/last_position1");
@@ -764,7 +764,7 @@ START_TEST(test_Cursor)
 
    rval = pclInitLibrary(gTheAppId, shutdownReg);
    fail_unless(rval <= 1, "Failed to init PCL");
-#if 0
+#if 1
    // create cursor
    handle = pers_db_cursor_create("/Data/mnt-c/lt-persistence_client_library_test/cached.itz");
    fail_unless(handle != -1, "Failed to create cursor!!");
@@ -826,7 +826,7 @@ START_TEST(test_Plugin)
 
    ret = pclInitLibrary(gTheAppId, shutdownReg);
    fail_unless(ret <= 1, "Failed to init PCL");
-#if 0
+#if 1
        ret = pclKeyReadData(0xFF, "language/country_code",           0, 0, buffer, READ_SIZE);
        fail_unless(ret != EPERS_NOT_INITIALIZED);
    fail_unless(strncmp((char*)buffer,"Custom plugin -> plugin_get_data: secure!",
@@ -874,7 +874,7 @@ START_TEST(test_ReadDefault)
 
    ret = pclInitLibrary(gTheAppId, shutdownReg);
    fail_unless(ret <= 1, "Failed to init PCL");
-#if 0
+#if 1
    ret = pclKeyReadData(0xFF, "statusHandle/default01", 3, 2, buffer, READ_SIZE);
    fail_unless(ret != EPERS_NOT_INITIALIZED);
    //printf("B U F F E R: %s\n", buffer);
@@ -900,7 +900,7 @@ START_TEST(test_ReadConfDefault)
 
    ret = pclInitLibrary(gTheAppId, shutdownReg);
    fail_unless(ret <= 1, "Failed to init PCL");
-#if 0
+#if 1
    ret = pclKeyReadData(0xFF, "statusHandle/confdefault01",     3, 2, buffer, READ_SIZE);
    fail_unless(ret != EPERS_NOT_INITIALIZED);
    fail_unless(strncmp((char*)buffer,"CONF_DEFAULT_01!", strlen((char*)buffer)) == 0, "Buffer not correctly read");
@@ -926,7 +926,7 @@ START_TEST(test_GetPath)
 
    ret = pclInitLibrary(gTheAppId, shutdownReg);
    fail_unless(ret <= 1, "Failed to init PCL");
-#if 0
+#if 1
    ret = pclFileCreatePath(0xFF, "media/mediaDB.db", 1, 1, &path, &pathSize);
    //printf("PATH: %s \n", path);
    fail_unless(strncmp((char*)path, thePath, strlen((char*)path)) == 0, "Path not correct");