kdbus-test: fix test-policy-priv for non-TIZEN
authorKonrad Lipinski <konrad.l@samsung.com>
Thu, 15 Sep 2016 08:50:40 +0000 (10:50 +0200)
committerKonrad Lipinski <konrad.l@samsung.com>
Thu, 15 Sep 2016 08:50:40 +0000 (10:50 +0200)
tools/testing/selftests/kdbus/kdbus-util.h
tools/testing/selftests/kdbus/test-policy-priv.c

index 09c559aaa7a011c3fc1ae38ac90c5ad45fea5640..3ca545cf89b564477069e5f0c7d22b286bf570eb 100644 (file)
@@ -16,7 +16,8 @@
 #include <stdbool.h>
 #include <linux/kdbus.h>
 
-#define TIZEN /* backwards-incompatible tizen customizations */
+/* backwards-incompatible tizen customizations */
+#define TIZEN
 #ifdef TIZEN
        #define ONTIZEN(TIZEN,NONTIZEN) TIZEN
 #else
index 4f8f9b360b7a7cdaf8fbff40bcf2933a9f21e912..78412470284b8a9e0429ba3cd7f8d4bdb6c027f6 100644 (file)
@@ -75,13 +75,14 @@ static wur int test_policy_priv_by_broadcast(const char *bus,
                 * If we expect the child to get the broadcast
                 * message, then check the received cookie.
                 */
-               if (child_status == 0)
+               if (!child_status) {
                        ASSERT_EXIT(expected_cookie,==,msg->cookie);
+                       kdbus_msg_free(msg);
+               }
 
                /* Use expected_cookie since 'msg' might be NULL */
                ASSERT_EXIT_ZERO(kdbus_msg_send(child, NULL, expected_cookie + 1, 0, 0, 0, KDBUS_DST_ID_BROADCAST));
 
-               kdbus_msg_free(msg);
                kdbus_conn_free(child);
        }),
        ({
@@ -94,16 +95,17 @@ static wur int test_policy_priv_by_broadcast(const char *bus,
                        ASSERT_ZERO(kdbus_msg_send(child_2, NULL, expected_cookie, 0, 0, 0, KDBUS_DST_ID_BROADCAST));
 
                        /* Use a little bit high time */
-                       ASSERT_RETURN(parent_status,==,kdbus_msg_recv_poll(child_2, 1000, &msg, NULL));
+                       ret = kdbus_msg_recv_poll(child_2, 1000, &msg, NULL);
+                       ASSERT_RETURN(parent_status,==,ret);
 
                        /*
                         * Check returned cookie in case we expect
                         * success.
                         */
-                       if (ret == 0)
+                       if (!ret) {
                                ASSERT_RETURN(msg->cookie,==,expected_cookie + 1);
-
-                       kdbus_msg_free(msg);
+                               kdbus_msg_free(msg);
+                       }
                } else {
                        /*
                         * Two unprivileged users will try to
@@ -127,10 +129,11 @@ static wur int test_policy_priv_by_broadcast(const char *bus,
                                 * Check returned cookie in case we expect
                                 * success.
                                 */
-                               if (ret == 0)
+                               if (!ret) {
                                        ASSERT_EXIT(msg->cookie,==,expected_cookie + 1);
+                                       kdbus_msg_free(msg);
+                               }
 
-                               kdbus_msg_free(msg);
                                kdbus_conn_free(child_2);
                        }),
                        ({}));