Hello community,

here is the log from the commit of package libqb for openSUSE:Factory checked 
in at 2014-03-31 20:43:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libqb (Old)
 and      /work/SRC/openSUSE:Factory/.libqb.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libqb"

Changes:
--------
--- /work/SRC/openSUSE:Factory/libqb/libqb.changes      2014-02-21 
19:42:17.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.libqb.new/libqb.changes 2014-03-31 
20:43:21.000000000 +0200
@@ -1,0 +2,6 @@
+Fri Mar 21 06:36:02 UTC 2014 - [email protected]
+
+- ipcc: Properly timeout during recv when timeout value is provided
+- Upstream version cs: c6f4fcd778248c41e5b108159d00cf1798a296d4
+
+-------------------------------------------------------------------

Old:
----
  libqb-0.17.0+git20140219.78978d0.tar.bz2

New:
----
  libqb-0.17.0+git20140312.c6f4fcd.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libqb.spec ++++++
--- /var/tmp/diff_new_pack.NwgMRi/_old  2014-03-31 20:43:22.000000000 +0200
+++ /var/tmp/diff_new_pack.NwgMRi/_new  2014-03-31 20:43:22.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           libqb
-Version:        0.17.0+git20140219.78978d0
+Version:        0.17.0+git20140312.c6f4fcd
 Release:        0
 Summary:        An IPC library for high performance servers
 License:        LGPL-2.1+

++++++ _service ++++++
--- /var/tmp/diff_new_pack.NwgMRi/_old  2014-03-31 20:43:22.000000000 +0200
+++ /var/tmp/diff_new_pack.NwgMRi/_new  2014-03-31 20:43:22.000000000 +0200
@@ -11,7 +11,7 @@
     <param name="version">0.17.0</param>
 -->
     <param name="versionformat">0.17.0+git%cd.%h</param>
-    <param name="revision">78978d07ac2f19a801ebde61379ac55359cc17f3</param>
+    <param name="revision">c6f4fcd778248c41e5b108159d00cf1798a296d4</param>
   </service>
 
   <service name="recompress" mode="disabled">

++++++ libqb-0.17.0+git20140219.78978d0.tar.bz2 -> 
libqb-0.17.0+git20140312.c6f4fcd.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libqb-0.17.0+git20140219.78978d0/lib/Makefile.am 
new/libqb-0.17.0+git20140312.c6f4fcd/lib/Makefile.am
--- old/libqb-0.17.0+git20140219.78978d0/lib/Makefile.am        2014-02-20 
12:24:04.000000000 +0100
+++ new/libqb-0.17.0+git20140312.c6f4fcd/lib/Makefile.am        2014-03-21 
07:24:42.000000000 +0100
@@ -42,6 +42,8 @@
 libqb_la_SOURCES       = $(source_to_lint) unix.c
 libqb_la_LIBADD                = @LTLIBOBJS@
 
+LDFLAGS        = $(LDFLAGS_COPY:-Bsymbolic-functions=)
+
 if HAVE_SEM_TIMEDWAIT
 else
   libqb_la_SOURCES+=rpl_sem.c
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libqb-0.17.0+git20140219.78978d0/lib/ipc_setup.c 
new/libqb-0.17.0+git20140312.c6f4fcd/lib/ipc_setup.c
--- old/libqb-0.17.0+git20140219.78978d0/lib/ipc_setup.c        2014-02-20 
12:24:04.000000000 +0100
+++ new/libqb-0.17.0+git20140312.c6f4fcd/lib/ipc_setup.c        2014-03-21 
07:24:42.000000000 +0100
@@ -526,6 +526,9 @@
                if (res == -EACCES) {
                        qb_util_log(LOG_ERR, "Invalid IPC credentials (%s).",
                                    c->description);
+               } else if (res == -EAGAIN) {
+                       qb_util_log(LOG_WARNING, "Denied connection, is not 
ready (%s)",
+                                   c->description);
                } else {
                        errno = -res;
                        qb_util_perror(LOG_ERR,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libqb-0.17.0+git20140219.78978d0/lib/ipc_socket.c 
new/libqb-0.17.0+git20140312.c6f4fcd/lib/ipc_socket.c
--- old/libqb-0.17.0+git20140219.78978d0/lib/ipc_socket.c       2014-02-20 
12:24:04.000000000 +0100
+++ new/libqb-0.17.0+git20140312.c6f4fcd/lib/ipc_socket.c       2014-03-21 
07:24:42.000000000 +0100
@@ -387,13 +387,20 @@
                      MSG_NOSIGNAL | MSG_PEEK);
 
        if (result == -1) {
-               if (errno == EAGAIN && (time_waited < timeout || timeout == 
-1)) {
-                       result = qb_ipc_us_ready(one_way, NULL,
-                                                time_to_wait, POLLIN);
+               if (errno != EAGAIN) {
+                       return -errno;
+               }
+
+               /* check to see if we have enough time left to try again */
+               if (time_waited < timeout || timeout == -1) {
+                       result = qb_ipc_us_ready(one_way, NULL, time_to_wait, 
POLLIN);
+                       if (qb_ipc_us_sock_error_is_disconnected(result)) {
+                               return result;
+                       }
                        time_waited += time_to_wait;
                        goto retry_peek;
-               } else {
-                       return -errno;
+               } else if (time_waited >= timeout) {
+                       return -ETIMEDOUT;
                }
        }
        if (result >= sizeof(struct qb_ipc_request_header)) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libqb-0.17.0+git20140219.78978d0/lib/ipcc.c 
new/libqb-0.17.0+git20140312.c6f4fcd/lib/ipcc.c
--- old/libqb-0.17.0+git20140219.78978d0/lib/ipcc.c     2014-02-20 
12:24:04.000000000 +0100
+++ new/libqb-0.17.0+git20140312.c6f4fcd/lib/ipcc.c     2014-03-21 
07:24:42.000000000 +0100
@@ -118,8 +118,13 @@
                                       res2,
                                       "(from socket) as a disconnect");
                        c->is_connected = QB_FALSE;
+                       res = res2;
+               } else if (res != -ETIMEDOUT) {
+                       /* if the result we're checking against is a TIMEOUT 
error.
+                        * don't override that result with another error that 
does
+                        * not imply a disconnect */
+                       res = res2;
                }
-               res = res2;
        }
        return res;
 }
@@ -260,15 +265,27 @@
             size_t msg_len, int32_t ms_timeout)
 {
        int32_t res = 0;
+       int32_t connect_res = 0;
 
        if (c == NULL) {
                return -EINVAL;
        }
 
        res = c->funcs.recv(&c->response, msg_ptr, msg_len, ms_timeout);
-       return _check_connection_state_with(c, res,
+       if (res >= 0) {
+               return res;
+       }
+
+       /* if we didn't get a msg, check connection state */
+       connect_res = _check_connection_state_with(c, res,
                                            _response_sock_one_way_get(c),
                                            ms_timeout, POLLIN);
+
+       /* only report the connection state check result if an error is 
returned. */
+       if (connect_res < 0) {
+               return connect_res;
+       }
+       return res;
 }
 
 ssize_t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libqb-0.17.0+git20140219.78978d0/tests/check_ipc.c 
new/libqb-0.17.0+git20140312.c6f4fcd/tests/check_ipc.c
--- old/libqb-0.17.0+git20140219.78978d0/tests/check_ipc.c      2014-02-20 
12:24:04.000000000 +0100
+++ new/libqb-0.17.0+git20140312.c6f4fcd/tests/check_ipc.c      2014-03-21 
07:24:42.000000000 +0100
@@ -139,6 +139,7 @@
                int32_t m;
                int32_t num;
                struct qb_ipcs_connection_stats_2 *stats;
+               uint32_t max_size = MAX_MSG_SIZE;
 
                response.size = sizeof(struct qb_ipc_response_header);
                response.error = 0;
@@ -148,8 +149,7 @@
                free(stats);
 
                /* crazy large message */
-               res = qb_ipcs_event_send(c, &response,
-                                        MAX_MSG_SIZE*10);
+               res = qb_ipcs_event_send(c, &response, max_size*10);
                ck_assert_int_eq(res, -EMSGSIZE);
 
                /* send one event before responding */
@@ -157,6 +157,11 @@
                ck_assert_int_eq(res, sizeof(response));
                response.id++;
 
+               /* There should be one more item in the event queue now. */
+               stats = qb_ipcs_connection_stats_get_2(c, QB_FALSE);
+               ck_assert_int_eq(stats->event_q_length - num, 1);
+               free(stats);
+
                /* send response */
                response.id = IPC_MSG_RES_BULK_EVENTS;
                res = qb_ipcs_response_send(c, &response, response.size);
@@ -175,9 +180,6 @@
                        ck_assert_int_eq(res, sizeof(response));
                        response.id++;
                }
-               stats = qb_ipcs_connection_stats_get_2(c, QB_FALSE);
-               ck_assert_int_eq(stats->event_q_length - num, num_bulk_events);
-               free(stats);
 
        } else if (req_pt->id == IPC_MSG_REQ_STRESS_EVENT) {
                struct {
@@ -313,7 +315,7 @@
 static void
 s1_connection_created(qb_ipcs_connection_t *c)
 {
-       int32_t max = MAX_MSG_SIZE;
+       uint32_t max = MAX_MSG_SIZE;
 
        if (send_event_on_created) {
                struct qb_ipc_response_header response;
@@ -362,6 +364,7 @@
                .dispatch_mod = my_dispatch_mod,
                .dispatch_del = my_dispatch_del,
        };
+       uint32_t max_size = MAX_MSG_SIZE;
 
        qb_loop_signal_add(my_loop, QB_LOOP_HIGH, SIGSTOP,
                           NULL, exit_handler, &handle);
@@ -374,7 +377,7 @@
        fail_if(s1 == 0);
 
        if (enforce_server_buffer) {
-               qb_ipcs_enforce_buffer_size(s1, MAX_MSG_SIZE);
+               qb_ipcs_enforce_buffer_size(s1, max_size);
        }
        qb_ipcs_poll_handlers_set(s1, &ph);
 
@@ -402,13 +405,70 @@
        return pid;
 }
 
-static int32_t
-stop_process(pid_t pid)
+static void
+request_server_exit(void)
+{
+       struct qb_ipc_request_header req_header;
+       struct qb_ipc_response_header res_header;
+       struct iovec iov[1];
+       int32_t res;
+
+       /*
+        * tell the server to exit
+        */
+       req_header.id = IPC_MSG_REQ_SERVER_FAIL;
+       req_header.size = sizeof(struct qb_ipc_request_header);
+
+       iov[0].iov_len = req_header.size;
+       iov[0].iov_base = &req_header;
+
+       ck_assert_int_eq(QB_TRUE, qb_ipcc_is_connected(conn));
+
+       res = qb_ipcc_sendv_recv(conn, iov, 1,
+                                &res_header,
+                                sizeof(struct qb_ipc_response_header), -1);
+       /*
+        * confirm we get -ENOTCONN or ECONNRESET
+        */
+       if (res != -ECONNRESET && res != -ENOTCONN) {
+               qb_log(LOG_ERR, "id:%d size:%d", res_header.id, 
res_header.size);
+               ck_assert_int_eq(res, -ENOTCONN);
+       }
+}
+
+static void
+kill_server(pid_t pid)
 {
-       /* wait a bit for the server to shutdown by it's self */
-       usleep(100000);
        kill(pid, SIGTERM);
        waitpid(pid, NULL, 0);
+}
+
+static int32_t
+verify_graceful_stop(pid_t pid)
+{
+       int wait_rc = 0;
+       int status = 0;
+       int rc = 0;
+       int tries;
+
+       /* We need the server to be able to exit by itself */
+       for (tries = 10;  tries >= 0; tries--) {
+               sleep(1);
+               wait_rc = waitpid(pid, &status, WNOHANG);
+               if (wait_rc > 0) {
+                       break;
+               }
+       }
+
+       ck_assert_int_eq(wait_rc, pid);
+       rc = WIFEXITED(status);
+       if (rc) {
+               rc = WEXITSTATUS(status);
+               ck_assert_int_eq(rc, 0);
+       } else {
+               fail_if(rc == 0);
+       }
+       
        return 0;
 }
 
@@ -425,6 +485,7 @@
        struct qb_ipc_response_header res_header;
        int32_t res;
        int32_t try_times = 0;
+       uint32_t max_size = MAX_MSG_SIZE;
 
        request.hdr.id = req_id;
        request.hdr.size = sizeof(struct qb_ipc_request_header) + size;
@@ -432,7 +493,7 @@
        /* check that we can't send a message that is too big
         * and we get the right return code.
         */
-       res = qb_ipcc_send(conn, &request, MAX_MSG_SIZE*2);
+       res = qb_ipcc_send(conn, &request, max_size*2);
        ck_assert_int_eq(res, -EMSGSIZE);
 
 repeat_send:
@@ -476,6 +537,62 @@
        return res;
 }
 
+static void
+test_ipc_txrx_timeout(void)
+{
+       struct qb_ipc_request_header req_header;
+       struct qb_ipc_response_header res_header;
+       struct iovec iov[1];
+       int32_t res;
+       int32_t c = 0;
+       int32_t j = 0;
+       pid_t pid;
+       uint32_t max_size = MAX_MSG_SIZE;
+
+       pid = run_function_in_new_process(run_ipc_server);
+       fail_if(pid == -1);
+       sleep(1);
+
+       do {
+               conn = qb_ipcc_connect(ipc_name, max_size);
+               if (conn == NULL) {
+                       j = waitpid(pid, NULL, WNOHANG);
+                       ck_assert_int_eq(j, 0);
+                       sleep(1);
+                       c++;
+               }
+       } while (conn == NULL && c < 5);
+       fail_if(conn == NULL);
+
+       /* The dispatch response will only come over
+        * the event channel, we want to verify the receive times
+        * out when an event is returned with no response */
+       req_header.id = IPC_MSG_REQ_DISPATCH;
+       req_header.size = sizeof(struct qb_ipc_request_header);
+
+       iov[0].iov_len = req_header.size;
+       iov[0].iov_base = &req_header;
+
+       res = qb_ipcc_sendv_recv(conn, iov, 1,
+                                &res_header,
+                                sizeof(struct qb_ipc_response_header), 5000);
+
+       ck_assert_int_eq(res, -ETIMEDOUT);
+
+       request_server_exit();
+       verify_graceful_stop(pid);
+
+       /*
+        * wait a bit for the server to die.
+        */
+       sleep(1);
+
+       /*
+        * this needs to free up the shared mem
+        */
+       qb_ipcc_disconnect(conn);
+}
+
 static int32_t recv_timeout = -1;
 static void
 test_ipc_txrx(void)
@@ -484,13 +601,14 @@
        int32_t c = 0;
        size_t size;
        pid_t pid;
+       uint32_t max_size = MAX_MSG_SIZE;
 
        pid = run_function_in_new_process(run_ipc_server);
        fail_if(pid == -1);
        sleep(1);
 
        do {
-               conn = qb_ipcc_connect(ipc_name, MAX_MSG_SIZE);
+               conn = qb_ipcc_connect(ipc_name, max_size);
                if (conn == NULL) {
                        j = waitpid(pid, NULL, WNOHANG);
                        ck_assert_int_eq(j, 0);
@@ -503,7 +621,7 @@
        size = QB_MIN(sizeof(struct qb_ipc_request_header), 64);
        for (j = 1; j < 19; j++) {
                size *= 2;
-               if (size >= MAX_MSG_SIZE)
+               if (size >= max_size)
                        break;
                if (send_and_check(IPC_MSG_REQ_TX_RX, size,
                                   recv_timeout, QB_TRUE) < 0) {
@@ -511,10 +629,17 @@
                }
        }
        if (turn_on_fc) {
+               /* can't signal server to shutdown if flow control is on */
                ck_assert_int_eq(fc_enabled, QB_TRUE);
+               qb_ipcc_disconnect(conn);
+               /* TODO - figure out why this sleep is necessary */
+               sleep(1);
+               kill_server(pid);
+       } else {
+               request_server_exit();
+               qb_ipcc_disconnect(conn);
+               verify_graceful_stop(pid);
        }
-       qb_ipcc_disconnect(conn);
-       stop_process(pid);
 }
 
 static void
@@ -527,13 +652,14 @@
        int32_t c = 0;
        int32_t j = 0;
        pid_t pid;
+       uint32_t max_size = MAX_MSG_SIZE;
 
        pid = run_function_in_new_process(run_ipc_server);
        fail_if(pid == -1);
        sleep(1);
 
        do {
-               conn = qb_ipcc_connect(ipc_name, MAX_MSG_SIZE);
+               conn = qb_ipcc_connect(ipc_name, max_size);
                if (conn == NULL) {
                        j = waitpid(pid, NULL, WNOHANG);
                        ck_assert_int_eq(j, 0);
@@ -554,8 +680,8 @@
                                 sizeof(struct qb_ipc_response_header), -1);
        ck_assert_int_eq(res, sizeof(struct qb_ipc_response_header));
 
-       /* kill the server */
-       stop_process(pid);
+       request_server_exit();
+       verify_graceful_stop(pid);
 
        /*
         * wait a bit for the server to die.
@@ -590,6 +716,26 @@
 }
 END_TEST
 
+START_TEST(test_ipc_txrx_shm_timeout)
+{
+       qb_enter();
+       ipc_type = QB_IPC_SHM;
+       ipc_name = __func__;
+       test_ipc_txrx_timeout();
+       qb_leave();
+}
+END_TEST
+
+START_TEST(test_ipc_txrx_us_timeout)
+{
+       qb_enter();
+       ipc_type = QB_IPC_SOCKET;
+       ipc_name = __func__;
+       test_ipc_txrx_timeout();
+       qb_leave();
+}
+END_TEST
+
 START_TEST(test_ipc_txrx_shm_tmo)
 {
        qb_enter();
@@ -674,13 +820,14 @@
        int32_t c = 0;
        pid_t pid;
        int32_t size;
+       uint32_t max_size = MAX_MSG_SIZE;
 
        pid = run_function_in_new_process(run_ipc_server);
        fail_if(pid == -1);
        sleep(1);
 
        do {
-               conn = qb_ipcc_connect(ipc_name, MAX_MSG_SIZE);
+               conn = qb_ipcc_connect(ipc_name, max_size);
                if (conn == NULL) {
                        j = waitpid(pid, NULL, WNOHANG);
                        ck_assert_int_eq(j, 0);
@@ -693,7 +840,7 @@
        size = QB_MIN(sizeof(struct qb_ipc_request_header), 64);
        for (j = 1; j < 19; j++) {
                size *= 2;
-               if (size >= MAX_MSG_SIZE)
+               if (size >= max_size)
                        break;
                if (send_and_check(IPC_MSG_REQ_DISPATCH, size,
                                   recv_timeout, QB_TRUE) < 0) {
@@ -701,8 +848,9 @@
                }
        }
 
+       request_server_exit();
        qb_ipcc_disconnect(conn);
-       stop_process(pid);
+       verify_graceful_stop(pid);
 }
 
 START_TEST(test_ipc_disp_us)
@@ -781,22 +929,20 @@
 static void
 test_ipc_bulk_events(void)
 {
-       struct qb_ipc_request_header req_header;
-       struct qb_ipc_response_header res_header;
-       struct iovec iov[1];
        int32_t c = 0;
        int32_t j = 0;
        pid_t pid;
        int32_t res;
        qb_loop_t *cl;
        int32_t fd;
+       uint32_t max_size = MAX_MSG_SIZE;
 
        pid = run_function_in_new_process(run_ipc_server);
        fail_if(pid == -1);
        sleep(1);
 
        do {
-               conn = qb_ipcc_connect(ipc_name, MAX_MSG_SIZE);
+               conn = qb_ipcc_connect(ipc_name, max_size);
                if (conn == NULL) {
                        j = waitpid(pid, NULL, WNOHANG);
                        ck_assert_int_eq(j, 0);
@@ -823,21 +969,9 @@
        qb_loop_run(cl);
        ck_assert_int_eq(events_received, num_bulk_events);
 
-       req_header.id = IPC_MSG_REQ_SERVER_FAIL;
-       req_header.size = sizeof(struct qb_ipc_request_header);
-
-       iov[0].iov_len = req_header.size;
-       iov[0].iov_base = &req_header;
-       res = qb_ipcc_sendv_recv(conn, iov, 1,
-                                &res_header,
-                                sizeof(struct qb_ipc_response_header), -1);
-       if (res != -ECONNRESET && res != -ENOTCONN) {
-               qb_log(LOG_ERR, "id:%d size:%d", res_header.id, 
res_header.size);
-               ck_assert_int_eq(res, -ENOTCONN);
-       }
-
+       request_server_exit();
        qb_ipcc_disconnect(conn);
-       stop_process(pid);
+       verify_graceful_stop(pid);
 }
 
 static void
@@ -857,13 +991,14 @@
        int32_t res;
        qb_loop_t *cl;
        int32_t fd;
+       uint32_t max_size = MAX_MSG_SIZE;
        /* This looks strange, but it serves an important purpose.
         * This test forces the server to enforce the MAX_MSG_SIZE
         * limit from the server side, which overrides the client's
         * buffer limit.  To verify this functionality is working
         * we set the client limit lower than what the server
         * is enforcing. */
-       int32_t client_buf_size = MAX_MSG_SIZE - 1024;
+       int32_t client_buf_size = max_size - 1024;
        int32_t real_buf_size;
 
        enforce_server_buffer = 1;
@@ -884,7 +1019,7 @@
        fail_if(conn == NULL);
 
        real_buf_size = qb_ipcc_get_buffer_size(conn);
-       ck_assert_int_eq(real_buf_size, MAX_MSG_SIZE);
+       ck_assert_int_eq(real_buf_size, max_size);
 
        qb_log(LOG_DEBUG, "Testing %d iterations of EVENT msg passing.", 
num_stress_events);
 
@@ -920,7 +1055,7 @@
        }
 
        qb_ipcc_disconnect(conn);
-       stop_process(pid);
+       verify_graceful_stop(pid);
 }
 
 START_TEST(test_ipc_stress_test_us)
@@ -954,6 +1089,7 @@
        int32_t res;
        qb_loop_t *cl;
        int32_t fd;
+       uint32_t max_size = MAX_MSG_SIZE;
 
        num_bulk_events = 1;
 
@@ -962,7 +1098,7 @@
        sleep(1);
 
        do {
-               conn = qb_ipcc_connect(ipc_name, MAX_MSG_SIZE);
+               conn = qb_ipcc_connect(ipc_name, max_size);
                if (conn == NULL) {
                        j = waitpid(pid, NULL, WNOHANG);
                        ck_assert_int_eq(j, 0);
@@ -984,8 +1120,9 @@
        qb_loop_run(cl);
        ck_assert_int_eq(events_received, num_bulk_events);
 
+       request_server_exit();
        qb_ipcc_disconnect(conn);
-       stop_process(pid);
+       verify_graceful_stop(pid);
 }
 
 START_TEST(test_ipc_event_on_created_us)
@@ -1009,13 +1146,14 @@
        int32_t j = 0;
        pid_t pid;
        int32_t res;
+       uint32_t max_size = MAX_MSG_SIZE;
 
        pid = run_function_in_new_process(run_ipc_server);
        fail_if(pid == -1);
        sleep(1);
 
        do {
-               conn = qb_ipcc_connect(ipc_name, MAX_MSG_SIZE);
+               conn = qb_ipcc_connect(ipc_name, max_size);
                if (conn == NULL) {
                        j = waitpid(pid, NULL, WNOHANG);
                        ck_assert_int_eq(j, 0);
@@ -1046,7 +1184,7 @@
        ck_assert_int_eq(QB_FALSE, qb_ipcc_is_connected(conn));
 
        qb_ipcc_disconnect(conn);
-       stop_process(pid);
+       kill_server(pid);
 }
 
 START_TEST(test_ipc_disconnect_after_created_us)
@@ -1063,20 +1201,17 @@
 static void
 test_ipc_server_fail(void)
 {
-       struct qb_ipc_request_header req_header;
-       struct qb_ipc_response_header res_header;
-       struct iovec iov[1];
-       int32_t res;
        int32_t j;
        int32_t c = 0;
        pid_t pid;
+       uint32_t max_size = MAX_MSG_SIZE;
 
        pid = run_function_in_new_process(run_ipc_server);
        fail_if(pid == -1);
        sleep(1);
 
        do {
-               conn = qb_ipcc_connect(ipc_name, MAX_MSG_SIZE);
+               conn = qb_ipcc_connect(ipc_name, max_size);
                if (conn == NULL) {
                        j = waitpid(pid, NULL, WNOHANG);
                        ck_assert_int_eq(j, 0);
@@ -1086,31 +1221,10 @@
        } while (conn == NULL && c < 5);
        fail_if(conn == NULL);
 
-       /*
-        * tell the server to exit
-        */
-       req_header.id = IPC_MSG_REQ_SERVER_FAIL;
-       req_header.size = sizeof(struct qb_ipc_request_header);
-
-       iov[0].iov_len = req_header.size;
-       iov[0].iov_base = &req_header;
-
-       ck_assert_int_eq(QB_TRUE, qb_ipcc_is_connected(conn));
-
-       res = qb_ipcc_sendv_recv(conn, iov, 1,
-                                &res_header,
-                                sizeof(struct qb_ipc_response_header), -1);
-       /*
-        * confirm we get -ENOTCONN or ECONNRESET
-        */
-       if (res != -ECONNRESET && res != -ENOTCONN) {
-               qb_log(LOG_ERR, "id:%d size:%d", res_header.id, 
res_header.size);
-               ck_assert_int_eq(res, -ENOTCONN);
-       }
+       request_server_exit();
        ck_assert_int_eq(QB_FALSE, qb_ipcc_is_connected(conn));
-
        qb_ipcc_disconnect(conn);
-       stop_process(pid);
+       verify_graceful_stop(pid);
 }
 
 START_TEST(test_ipc_server_fail_soc)
@@ -1181,6 +1295,7 @@
        int32_t c = 0;
        int32_t j = 0;
        pid_t pid;
+       uint32_t max_size = MAX_MSG_SIZE;
 
        reference_count_test = QB_TRUE;
 
@@ -1189,7 +1304,7 @@
        sleep(1);
 
        do {
-               conn = qb_ipcc_connect(ipc_name, MAX_MSG_SIZE);
+               conn = qb_ipcc_connect(ipc_name, max_size);
                if (conn == NULL) {
                        j = waitpid(pid, NULL, WNOHANG);
                        ck_assert_int_eq(j, 0);
@@ -1201,8 +1316,7 @@
 
        sleep(5);
 
-       qb_ipcc_disconnect(conn);
-       stop_process(pid);
+       kill_server(pid);
 }
 
 
@@ -1263,24 +1377,29 @@
        TCase *tc;
        Suite *s = suite_create("shm");
 
+       tc = tcase_create("ipc_txrx_shm_timeout");
+       tcase_add_test(tc, test_ipc_txrx_shm_timeout);
+       tcase_set_timeout(tc, 30);
+       suite_add_tcase(s, tc);
+
        tc = tcase_create("ipc_server_fail_shm");
        tcase_add_test(tc, test_ipc_server_fail_shm);
-       tcase_set_timeout(tc, 6);
+       tcase_set_timeout(tc, 8);
        suite_add_tcase(s, tc);
 
        tc = tcase_create("ipc_txrx_shm_block");
        tcase_add_test(tc, test_ipc_txrx_shm_block);
-       tcase_set_timeout(tc, 6);
+       tcase_set_timeout(tc, 8);
        suite_add_tcase(s, tc);
 
        tc = tcase_create("ipc_txrx_shm_tmo");
        tcase_add_test(tc, test_ipc_txrx_shm_tmo);
-       tcase_set_timeout(tc, 6);
+       tcase_set_timeout(tc, 8);
        suite_add_tcase(s, tc);
 
        tc = tcase_create("ipc_fc_shm");
        tcase_add_test(tc, test_ipc_fc_shm);
-       tcase_set_timeout(tc, 6);
+       tcase_set_timeout(tc, 8);
        suite_add_tcase(s, tc);
 
        tc = tcase_create("ipc_dispatch_shm");
@@ -1300,11 +1419,12 @@
 
        tc = tcase_create("ipc_exit_shm");
        tcase_add_test(tc, test_ipc_exit_shm);
-       tcase_set_timeout(tc, 3);
+       tcase_set_timeout(tc, 8);
        suite_add_tcase(s, tc);
 
        tc = tcase_create("ipc_event_on_created_shm");
        tcase_add_test(tc, test_ipc_event_on_created_shm);
+       tcase_set_timeout(tc, 10);
        suite_add_tcase(s, tc);
 
        tc = tcase_create("ipc_service_ref_count_shm");
@@ -1321,6 +1441,11 @@
        Suite *s = suite_create("socket");
        TCase *tc;
 
+       tc = tcase_create("ipc_txrx_us_timeout");
+       tcase_add_test(tc, test_ipc_txrx_us_timeout);
+       tcase_set_timeout(tc, 30);
+       suite_add_tcase(s, tc);
+
        tc = tcase_create("ipc_max_dgram_size");
        tcase_add_test(tc, test_ipc_max_dgram_size);
        tcase_set_timeout(tc, 30);
@@ -1328,27 +1453,27 @@
 
        tc = tcase_create("ipc_server_fail_soc");
        tcase_add_test(tc, test_ipc_server_fail_soc);
-       tcase_set_timeout(tc, 6);
+       tcase_set_timeout(tc, 8);
        suite_add_tcase(s, tc);
 
        tc = tcase_create("ipc_txrx_us_block");
        tcase_add_test(tc, test_ipc_txrx_us_block);
-       tcase_set_timeout(tc, 6);
+       tcase_set_timeout(tc, 8);
        suite_add_tcase(s, tc);
 
        tc = tcase_create("ipc_txrx_us_tmo");
        tcase_add_test(tc, test_ipc_txrx_us_tmo);
-       tcase_set_timeout(tc, 6);
+       tcase_set_timeout(tc, 8);
        suite_add_tcase(s, tc);
 
        tc = tcase_create("ipc_fc_us");
        tcase_add_test(tc, test_ipc_fc_us);
-       tcase_set_timeout(tc, 6);
+       tcase_set_timeout(tc, 8);
        suite_add_tcase(s, tc);
 
        tc = tcase_create("ipc_exit_us");
        tcase_add_test(tc, test_ipc_exit_us);
-       tcase_set_timeout(tc, 6);
+       tcase_set_timeout(tc, 8);
        suite_add_tcase(s, tc);
 
        tc = tcase_create("ipc_dispatch_us");
@@ -1368,10 +1493,12 @@
 
        tc = tcase_create("ipc_event_on_created_us");
        tcase_add_test(tc, test_ipc_event_on_created_us);
+       tcase_set_timeout(tc, 10);
        suite_add_tcase(s, tc);
 
        tc = tcase_create("ipc_disconnect_after_created_us");
        tcase_add_test(tc, test_ipc_disconnect_after_created_us);
+       tcase_set_timeout(tc, 10);
        suite_add_tcase(s, tc);
 
        tc = tcase_create("ipc_service_ref_count_us");

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to