Remove duplicated tests
authorJanusz Kozerski <j.kozerski@samsung.com>
Mon, 11 Feb 2013 11:00:29 +0000 (12:00 +0100)
committerGerrit Code Review <gerrit2@localhost>
Thu, 14 Feb 2013 07:41:22 +0000 (16:41 +0900)
[Issue#]   SSDSWSSP-82
[Cause]    Duplicated tests: SS Client and SS Client Smack
[Solution] Remove tests
[Problem]  N/A

[Verification] Run all security test. And run ss client smack test (security-tests.sh ss-client-smack --output=text), 6 test should pass.

Change-Id: Id916134ec8821528c76e21a446c6a7db326aa78d

packaging/security-tests.spec
tests/security-server-tests/CMakeLists.txt
tests/security-server-tests/security_server_tests_client.cpp [deleted file]
tests/security-server-tests/security_server_tests_client.h
tests/security-tests-all.sh
tests/security-tests.sh

index 26abcec..4c510cc 100644 (file)
@@ -50,7 +50,6 @@ echo "security-tests postinst done ..."
 /usr/bin/security-tests-all.sh
 /usr/bin/libsmack-test
 /usr/bin/libprivilege-control-test
-/usr/bin/security-server-tests-client
 /usr/bin/security-server-tests-client-smack
 /usr/bin/security-server-tests-label
 /usr/bin/security-server-tests-pid-reuser
index 1a997b0..6f3e2fe 100644 (file)
@@ -31,7 +31,6 @@ PKG_CHECK_MODULES(SEC_SRV_TESTS_DEP
 
 # Targets definition
 
-SET(TARGET_SEC_SRV_CLIENT_TESTS "security-server-tests-client")
 SET(TARGET_SEC_SRV_CLIENT_SMACK_TESTS "security-server-tests-client-smack")
 SET(TARGET_SEC_SRV_LABEL_TESTS "security-server-tests-label")
 SET(TARGET_SEC_SRV_PID_TESTS "security-server-tests-pid-reuser")
@@ -40,10 +39,6 @@ SET(TARGET_SEC_SRV_PWD_TESTS "security-server-tests-password")
 
 # Sources definition
 
-SET(SEC_SRV_CLIENT_SOURCES
-    ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_tests_client.cpp
-   )
-
 SET(SEC_SRV_CLIENT_SMACK_SOURCES
     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_tests_client_smack.cpp
     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_mockup.cpp
@@ -72,7 +67,6 @@ INCLUDE_DIRECTORIES(
 
 #LINK_DIRECTORIES(${SEC_SRV_PKGS_LIBRARY_DIRS})
 
-ADD_EXECUTABLE(${TARGET_SEC_SRV_CLIENT_TESTS} ${SEC_SRV_CLIENT_SOURCES})
 ADD_EXECUTABLE(${TARGET_SEC_SRV_CLIENT_SMACK_TESTS} ${SEC_SRV_CLIENT_SMACK_SOURCES})
 ADD_EXECUTABLE(${TARGET_SEC_SRV_LABEL_TESTS} ${SEC_SRV_LABEL_SOURCES})
 ADD_EXECUTABLE(${TARGET_SEC_SRV_PID_TESTS} ${SEC_SRV_PID_SOURCES})
@@ -80,9 +74,6 @@ ADD_EXECUTABLE(${TARGET_SEC_SRV_TC_SERVER_TESTS} ${SEC_SRV_TC_SERVER_SOURCES})
 ADD_EXECUTABLE(${TARGET_SEC_SRV_PWD_TESTS} ${SEC_SRV_PWD_SOURCES})
 
 
-TARGET_LINK_LIBRARIES(${TARGET_SEC_SRV_CLIENT_TESTS}
-    ${SEC_SRV_TESTS_DEP_LIBRARIES})
-
 TARGET_LINK_LIBRARIES(${TARGET_SEC_SRV_CLIENT_SMACK_TESTS}
     ${SEC_SRV_TESTS_DEP_LIBRARIES})
 
@@ -100,7 +91,6 @@ TARGET_LINK_LIBRARIES(${TARGET_SEC_SRV_PWD_TESTS}
 
 # Installation
 
-INSTALL(TARGETS ${TARGET_SEC_SRV_CLIENT_TESTS} DESTINATION /usr/bin)
 INSTALL(TARGETS ${TARGET_SEC_SRV_CLIENT_SMACK_TESTS} DESTINATION /usr/bin)
 INSTALL(TARGETS ${TARGET_SEC_SRV_LABEL_TESTS} DESTINATION /usr/bin)
 INSTALL(TARGETS ${TARGET_SEC_SRV_PID_TESTS} DESTINATION /usr/bin)
diff --git a/tests/security-server-tests/security_server_tests_client.cpp b/tests/security-server-tests/security_server_tests_client.cpp
deleted file mode 100644 (file)
index 5a89ea0..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
- */
-/*
- * @file    security_server_tests_client.cpp
- * @author  Bumjin Im (bj.im@samsung.com)
- * @author  Mariusz Domanski (m.domanski@samsung.com)
- * @version 1.0
- * @brief   Test cases for security server client
- */
-
-#include <dpl/test/test_runner.h>
-#include <dlog.h>
-#include "security_server_tests_client.h"
-
-RUNNER_TEST_GROUP_INIT(SECURITY_SERVER_TESTS_CLIENT)
-
-RUNNER_TEST(tc_security_server_get_cookie_size)
-{
-    int ret = security_server_get_cookie_size();
-    LOGD("ret = %d", ret);
-    RUNNER_ASSERT(ret == 20);
-}
-
-RUNNER_TEST(tc_security_server_request_cookie_normal_case)
-{
-    int ret = security_server_request_cookie(cookie, 20);
-    LOGD("ret = %d", ret);
-    RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
-}
-
-RUNNER_TEST(tc_security_server_request_cookie_too_small_buffer_size)
-{
-    int ret = security_server_request_cookie(cookie, 10);
-    LOGD("ret = %d", ret);
-    RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_BUFFER_TOO_SMALL);
-}
-
-RUNNER_TEST(tc_security_server_check_privilege_client_is_not_allowed)
-{
-    int ret = security_server_check_privilege(cookie, g_permissions[0]);
-    LOGD("ret = %d", ret);
-    RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_AUTHENTICATION_FAILED);
-}
-
-RUNNER_TEST(tc_security_server_get_gid_client_is_not_allowed)
-{
-    int ret = security_server_get_gid("telephony");
-    LOGD("ret = %d", ret);
-    RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_AUTHENTICATION_FAILED);
-}
-
-RUNNER_TEST(tc_security_server_get_object_name_client_is_not_allowed)
-{
-    int ret = security_server_get_object_name(g_groups[0], tmpchar,
-            sizeof(tmpchar));
-    LOGD("ret = %d", ret);
-    RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_AUTHENTICATION_FAILED);
-}
-
-RUNNER_TEST(tc_requesting_access_to_test_server_via_security_server)
-{
-    for(i=0;i<g_perm_num;i++)
-    {
-        sock_fd = connect_to_testserver();
-        if(sock_fd < 1)
-        {
-            LOGD("sock_fd = %d", sock_fd);
-            RUNNER_ASSERT_MSG(false, "Socket connection error");
-        }
-        LOGD("%d: requesting %d permission...sockfd=%d\n", i, g_permissions[i],
-                sock_fd);
-        int ret = send_request(sock_fd, (unsigned char *) cookie,
-                g_permissions[i]);
-
-        if(ret != 0)
-        {
-            close(sock_fd);
-            LOGD("ret = %d", ret);
-            RUNNER_ASSERT_MSG(false, "send failed");
-        }
-
-        ret = recv_result(sock_fd);
-        close(sock_fd);
-        sock_fd = 0;
-        if(ret == SECURITY_SERVER_API_SUCCESS)
-        {
-            LOGD("Permission granted\n");
-        }
-        else if(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED)
-        {
-            LOGD("Permission denied\n\n");
-            RUNNER_ASSERT_MSG(false, "Permission denied");
-        }
-        else
-        {
-            LOGD("ret = %d", ret);
-            RUNNER_ASSERT_MSG(false, "Recv error");
-        }
-    }
-}
-
-RUNNER_TEST(tc_requesting_cookie_for_same_pid_with_different_path)
-{
-    LOGI("       Exiting this process to cycle different process as same PID.\n");
-    LOGI("       Please look at the test server's terminal for the result\n");
-    cur_pid = getpid();
-    sock_fd = connect_to_testserver();
-    if(sock_fd < 1)
-    {
-        RUNNER_ASSERT_MSG(false, "Socket connection error");
-    }
-
-    unsigned char buf[32] = {255, 255, 255, 255, };
-    int size;
-
-    memcpy(buf + 4, cookie, 20);
-    memcpy(buf + 24, &cur_pid, sizeof(int));
-    int ret = getuid();
-    memcpy(buf + 28, &ret, sizeof(int));
-
-    size = write(sock_fd, buf, 32);
-    if(size < 32)
-    {
-        close(sock_fd);
-        LOGD("size = %d", size);
-        RUNNER_ASSERT_MSG(false, "Cannot send");
-    }
-    if(sock_fd > 0)
-        close(sock_fd);
-}
-
-
-int main(int argc, char *argv[])
-{
-    /* needed for dlog to work properly
-     * during tests guid changes and dlog looses permission to write logs
-     * printing log now opens file descriptor with proper privileges */
-    LOGD("%s starts", argv[0]);
-
-    g_group_num = 0;
-    g_perm_num = 0;
-
-    int ret = getuid();
-    if(ret != 0)
-    {
-        printf("You must be root to test. Current UID: %d\nExiting...\n", ret);
-        exit(1);
-    }
-
-    int argcc = 15;
-    char *argvv[] = {argv[0], "-u", "5000",
-            "-g", "6001", "6002", "6003", "6004", "6005", "6006", "6007",
-            "-p", "6001", "6002", "6010"};
-
-    system("touch /opt/home/root/pid_cycle");
-    privilege_control(argcc, argvv);
-
-    LOGI("Strting test. My PID is %d", getpid());
-
-    int status =
-        DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
-
-    if(g_groups != NULL)
-        free(g_groups);
-    if(g_permissions != NULL)
-        free(g_permissions);
-    return status;
-}
index 0a8adc1..377d243 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <unistd.h>
 #include <errno.h>
+#include <string.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/param.h>
@@ -224,7 +225,6 @@ int connect_to_testserver()
     return localsockfd;
 }
 
-
 int send_request(int sock_fd, unsigned char *cookie, int perm)
 {
     unsigned char buf[28] = {0, 0, 0, 0, };
index db7a500..12cecf4 100644 (file)
@@ -2,7 +2,6 @@
 echo "[Trigerring all tests...]"
 security-tests.sh smack --output=text
 security-tests.sh libprivilege-control --output=text
-security-tests.sh ss-client --output=text
 security-tests.sh ss-clientsmack --output=text
 security-tests.sh ss-label --output=text
 security-tests.sh ss-pid --output=text
index 539db9c..6a9abda 100644 (file)
@@ -35,12 +35,6 @@ case $1 in
     echo
     libprivilege-control-test $2 $3
     ;;
-"ss-client")
-    echo "========================================================================="
-    echo "SECURITY SERVER TEST CLIENT"
-    echo
-    security-server-tests-client $2 $3
-    ;;
 "ss-clientsmack")
     echo "========================================================================="
     echo "SECURITY SERVER TEST CLIENT SMACK"
@@ -76,7 +70,7 @@ case $1 in
     echo "Correct using:"
     echo "    security_test.sh <module> <args_for_module>"
     echo
-    echo "modules: smack, libprivilege-control, ss-client, ss-clientsmack"
+    echo "modules: smack, libprivilege-control, ss-clientsmack"
     echo "         ss-label, ss-pid, ss-server, ss-password"
     ;;