kdbus-test: fix test-policy-priv for TIZEN
authorKonrad Lipinski <konrad.l@samsung.com>
Thu, 15 Sep 2016 10:37:07 +0000 (12:37 +0200)
committerKonrad Lipinski <konrad.l@samsung.com>
Thu, 15 Sep 2016 10:43:58 +0000 (12:43 +0200)
tools/testing/selftests/kdbus/test-policy-priv.c

index 78412470284b8a9e0429ba3cd7f8d4bdb6c027f6..12d6817d35ea1cafa193e016792733bbdecd2031 100644 (file)
@@ -22,6 +22,10 @@ static wur int test_policy_priv_by_id(const char *bus,
 {
        uint64_t expected_cookie = time(NULL) ^ 0xdeadbeef;
 
+#ifdef TIZEN
+       parent_status = child_status = 0;
+#endif
+
        ASSERT_NONZERO(conn_dst);
 
        RUN_UNPRIVILEGED_CONN(unpriv, bus, ({
@@ -48,6 +52,12 @@ static wur int test_policy_priv_by_broadcast(const char *bus,
        struct kdbus_conn *child_2 = conn_dst;
        uint64_t expected_cookie = time(NULL) ^ 0xdeadbeef;
 
+#ifdef TIZEN
+       child_status = 0;
+       if (DO_NOT_DROP != drop_second_user)
+               parent_status = 0;
+#endif
+
        /* Drop to another unprivileged user other than UNPRIV_UID */
        if (drop_second_user == DROP_OTHER_UNPRIV) {
                second_uid = UNPRIV_UID - 1;
@@ -159,11 +169,11 @@ static wur int test_priv_before_policy_upload(struct kdbus_test_env *env)
 
        /*
         * Make sure unprivileged bus user cannot acquire names
-        * before registring any policy holder.
+        * before registering any policy holder.
         */
 
        RUN_UNPRIVILEGED_CONN(unpriv, env->buspath, ({
-               ASSERT_EXIT(0,>,kdbus_name_acquire(unpriv, "com.example.a", NULL));
+               ASSERT_EXIT(0,ONTIZEN(==,>),kdbus_name_acquire(unpriv, "com.example.a", NULL));
        }));
 
        /*
@@ -614,7 +624,7 @@ static wur int test_policy_priv(struct kdbus_test_env *env)
         */
 
        RUN_UNPRIVILEGED_CONN(unpriv, env->buspath, ({
-               ASSERT_EXIT_NONZERO(kdbus_name_acquire(unpriv, "com.example.a", NULL));
+               ASSERT_EXIT(0,ONTIZEN(==,!=),kdbus_name_acquire(unpriv, "com.example.a", NULL));
        }));
 
        /*
@@ -669,7 +679,7 @@ static wur int test_policy_priv(struct kdbus_test_env *env)
        ASSERT_ZERO(kdbus_conn_update_policy(conn_a, "com.example.a", &access, 1));
 
        RUN_UNPRIVILEGED_CONN(unpriv, env->buspath, ({
-               ASSERT_EXIT_NONZERO(kdbus_name_acquire(unpriv, "com.example.a", NULL));
+               ASSERT_EXIT(0,ONTIZEN(==,!=),kdbus_name_acquire(unpriv, "com.example.a", NULL));
        }));
 
        /*
@@ -698,7 +708,7 @@ static wur int test_policy_priv(struct kdbus_test_env *env)
        ASSERT_ZERO(kdbus_conn_update_policy(conn_a, "com.example.a", &access, 1));
 
        RUN_UNPRIVILEGED_CONN(unpriv, env->buspath, ({
-               ASSERT_EXIT_NONZERO(kdbus_name_acquire(unpriv, "com.example.a", NULL));
+               ASSERT_EXIT(0,ONTIZEN(==,!=),kdbus_name_acquire(unpriv, "com.example.a", NULL));
        }));
 
        /*
@@ -733,7 +743,7 @@ static wur int test_policy_priv(struct kdbus_test_env *env)
        ASSERT_ZERO(kdbus_conn_update_policy(conn_a, "com.example.a", acc, num));
 
        RUN_UNPRIVILEGED_CONN(unpriv, env->buspath, ({
-               ASSERT_EXIT_NONZERO(kdbus_name_acquire(unpriv, "com.example.a", NULL));
+               ASSERT_EXIT(0,ONTIZEN(==,!=),kdbus_name_acquire(unpriv, "com.example.a", NULL));
        }));
 
        /*
@@ -799,7 +809,7 @@ static wur int test_policy_priv(struct kdbus_test_env *env)
         */
 
        RUN_UNPRIVILEGED_CONN(unpriv, env->buspath, ({
-               ASSERT_EXIT(-EPERM,==,kdbus_msg_send(unpriv, "com.example.b", 0xdeadbeef, 0, 0, 0, 0));
+               ASSERT_EXIT(ONTIZEN(0,-EPERM),==,kdbus_msg_send(unpriv, "com.example.b", 0xdeadbeef, 0, 0, 0, 0));
        }));
 
        /*
@@ -922,7 +932,7 @@ static wur int test_policy_priv(struct kdbus_test_env *env)
        ASSERT_ZERO(kdbus_conn_update_policy(conn_a, "com.example.b", acc, num));
 
        RUN_UNPRIVILEGED_CONN(unpriv, env->buspath, ({
-               ASSERT_EXIT(-EPERM,==,kdbus_msg_send(unpriv, "com.example.b", 0xdeadbeef, 0, 0, 0, 0));
+               ASSERT_EXIT(ONTIZEN(0,-EPERM),==,kdbus_msg_send(unpriv, "com.example.b", 0xdeadbeef, 0, 0, 0, 0));
        }));
 
        /*
@@ -964,7 +974,7 @@ static wur int test_policy_priv(struct kdbus_test_env *env)
 
                ASSERT_ZERO(kdbus_conn_update_policy(conn_a, "com.example.b", NULL, 0));
 
-               ASSERT_EXIT(-EPERM,==,kdbus_msg_send(unpriv, "com.example.b", 0xdeadbeef, 0, 0, 0, 0));
+               ASSERT_EXIT(ONTIZEN(0,-EPERM),==,kdbus_msg_send(unpriv, "com.example.b", 0xdeadbeef, 0, 0, 0, 0));
        }));
 
        /*
@@ -1004,7 +1014,7 @@ static wur int test_policy_priv(struct kdbus_test_env *env)
                /* free policy holder */
                kdbus_conn_free(conn);
 
-               ASSERT_EXIT(-EPERM,==,kdbus_msg_send(unpriv, "com.example.c", 0xdeadbeef, 0, 0, 0, 0));
+               ASSERT_EXIT(ONTIZEN(0,-EPERM),==,kdbus_msg_send(unpriv, "com.example.c", 0xdeadbeef, 0, 0, 0, 0));
 
                kdbus_conn_free(unpriv);
        }), ({