Remove unused test for PID reusage
authorMarcin Lis <m.lis@samsung.com>
Fri, 2 Aug 2013 11:00:11 +0000 (13:00 +0200)
committerMarcin Niesluchowski <m.niesluchow@samsung.com>
Thu, 23 Jan 2014 14:07:37 +0000 (15:07 +0100)
[Issue#] SSDWSSP-423
[Bug/Feature] -
[Cause] This test suite is no longer needed
[Solution] Removing files and build entries associated with this test
        suite

[Verification] Build and run all tests.
        Verify that the test suite: security-server-tests-pid-reuser
        is no longer present in test scripts and system binaries.

Change-Id: I9448fc298c64c8aad451441e9eff949d0222a898

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

index e51b20e..ba55f0b 100644 (file)
@@ -70,7 +70,6 @@ osp-installer --uninstall=V5LKqDFBXm
 /usr/bin/libprivilege-control-test
 /usr/bin/security-server-tests-client-smack
 /usr/bin/security-server-tests-label
-/usr/bin/security-server-tests-pid-reuser
 /usr/bin/security-server-tests-server
 /usr/bin/security-server-tests-password
 /usr/bin/security-server-tests-dbus
index 875f28c..2279dae 100644 (file)
@@ -35,7 +35,6 @@ PKG_CHECK_MODULES(SEC_SRV_TESTS_DEP
 
 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")
 SET(TARGET_SEC_SRV_TC_SERVER_TESTS "security-server-tests-server")
 SET(TARGET_SEC_SRV_PWD_TESTS "security-server-tests-password")
 SET(TARGET_SEC_SRV_MT_TESTS "security-server-tests-mt")
@@ -54,10 +53,6 @@ SET(SEC_SRV_LABEL_SOURCES
     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_tests_label.cpp
    )
 
-SET(SEC_SRV_PID_SOURCES
-    ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_tests_pid_reuser.cpp
-   )
-
 SET(SEC_SRV_TC_SERVER_SOURCES
     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_tests_server.cpp
     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_tests_weird_arguments.cpp
@@ -91,7 +86,6 @@ ADD_DEFINITIONS("-I/usr/include/dbus-1.0/dbus")
 
 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})
 ADD_EXECUTABLE(${TARGET_SEC_SRV_TC_SERVER_TESTS} ${SEC_SRV_TC_SERVER_SOURCES})
 ADD_EXECUTABLE(${TARGET_SEC_SRV_PWD_TESTS} ${SEC_SRV_PWD_SOURCES})
 ADD_EXECUTABLE(${TARGET_SEC_SRV_MT_TESTS} ${SEC_SRV_MT_SOURCES})
@@ -107,10 +101,6 @@ TARGET_LINK_LIBRARIES(${TARGET_SEC_SRV_LABEL_TESTS}
     ${SEC_SRV_TESTS_DEP_LIBRARIES}
     tests-common)
 
-TARGET_LINK_LIBRARIES(${TARGET_SEC_SRV_PID_TESTS}
-    ${SEC_SRV_TESTS_DEP_LIBRARIES}
-    tests-common)
-
 TARGET_LINK_LIBRARIES(${TARGET_SEC_SRV_TC_SERVER_TESTS}
     ${SEC_SRV_TESTS_DEP_LIBRARIES}
     tests-common)
@@ -135,7 +125,6 @@ TARGET_LINK_LIBRARIES(${TARGET_SEC_SRV_MEASURER}
 
 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)
 INSTALL(TARGETS ${TARGET_SEC_SRV_TC_SERVER_TESTS} DESTINATION /usr/bin)
 INSTALL(TARGETS ${TARGET_SEC_SRV_PWD_TESTS} DESTINATION /usr/bin)
 INSTALL(TARGETS ${TARGET_SEC_SRV_MT_TESTS} DESTINATION /usr/bin)
diff --git a/tests/security-server-tests/security_server_tests_pid_reuser.cpp b/tests/security-server-tests/security_server_tests_pid_reuser.cpp
deleted file mode 100644 (file)
index 3332499..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
- */
-/*
- * @file    security_server_tests_pid_reuser.cpp
- * @author  Bumjin Im (bj.im@samsung.com)
- * @author  Mariusz Domanski (m.domanski@samsung.com)
- * @version 1.0
- * @brief   Test cases for security server
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include "security-server.h"
-#include <dpl/test/test_runner.h>
-#include <dlog.h>
-#include "test.h"
-
-unsigned int target_pid, target_uid;
-unsigned char *prev_cookie, *new_cookie;
-int cookie_size;
-
-/* deprecated info for old c-style binary
- * still useful for understanding the test itself
- *
- * Usage:
- * cmd uid pid hexa_decimal_cookie
- * pid: PID want to be reused
- * hexa_decimal_cookie: Cookie value which is issued to the previous process
- *                      with the [pid] for comparison\nThe cookie must be hexa
- *                      decimal, with lower case and without whitespace and
- *                      new line characters
- * This test program must be executed as root process
- */
-
-void convert_prev_cookie(const char * /*cmdline*/, const char *prev, unsigned char *now)
-{
-    int i, cnt;
-    char tmphexnum[3] = {0};
-    cnt = security_server_get_cookie_size();
-    cnt = cnt * 2;
-    if ((int)strlen(prev) != cnt)
-    {
-        printf("%s\n", "Cookie length is wrong");
-        exit(1);
-    }
-
-    for (i = 0, cnt = 0; i < (int)strlen(prev); i = i + 2)
-    {
-        strncpy(tmphexnum, prev + i, 2);
-        tmphexnum[2] = 0;
-        errno = 0;
-        now[cnt] = strtoul(tmphexnum, 0, 16);
-        if (errno != 0)
-        {
-            printf("%s\n", "cannot convert hex cookie to binary");
-            exit(1);
-        }
-        cnt++;
-    }
-}
-
-void check_status()
-{
-    struct stat statbuf;
-    int ret;
-    ret = stat("/opt/home/root/pid_cycle", &statbuf);
-    if (ret != 0)
-    {
-        printf("Interrupt encountered. exiting...\n");
-        exit(0);
-    }
-}
-
-void cycle_pid(int pid)
-{
-    int cur_pid = getpid();
-    int dotval;
-
-    while (cur_pid != pid)
-    {
-        if (fork() != 0)
-        {
-            dotval = cur_pid % 1000;
-            if (dotval == 0)
-                SLOGD(".");
-            exit(0);
-        }
-        cur_pid = getpid();
-        check_status();
-    }
-}
-
-RUNNER_TEST_GROUP_INIT(SECURITY_SERVER_TESTS_PID);
-
-RUNNER_TEST(tc_security_server_request_cookie)
-{
-    RUNNER_IGNORED_MSG("needs FIX, check FIXME comment");
-    SLOGD("Cycling PID to %d\n", target_pid);
-    cycle_pid(target_pid);
-    unlink("/opt/home/root/pid_cycle");
-    RUNNER_ASSERT(security_server_request_cookie((char*)new_cookie, 20) == SECURITY_SERVER_API_SUCCESS);
-    SLOGD("\nTarget PID: %d, Target UID: %d\n", target_pid, target_uid);
-    SLOGD("Previous cookie:\n");
-    printhex(prev_cookie, 20);
-    SLOGD("Newly issued cookie:\n");
-    printhex(new_cookie, 20);
-    RUNNER_ASSERT_MSG(memcmp(prev_cookie, new_cookie, cookie_size) != 0, "cookies are the same");
-}
-
-int main(int argc, char *argv[])
-{
-    /* FIXME: proper parameters needed (these below are fake)
-     *        or better idea for this test case...*/
-    const char *argvv[] = {argv[0], "12345", "5000", "abcdefabcdefabcdefabcdefabcdefabcdefabcd"};
-
-    target_uid = getuid();
-    if (target_uid != 0)
-    {
-        printf("Error: %s must be executed by root\n", argv[0]);
-        exit(1);
-    }
-
-    cookie_size = security_server_get_cookie_size();
-    unsigned char prev_cookie_tmp[cookie_size], new_cookie_tmp[cookie_size];
-    prev_cookie = prev_cookie_tmp;
-    new_cookie = new_cookie_tmp;
-
-    errno = 0;
-    target_uid = strtoul(argvv[1], 0, 10);
-    if (errno != 0)
-    {
-        printf("%s\n", "cannot convert string uid to integer");
-        exit(1);
-    }
-    SLOGD("Target UID is %d. change user...\n", target_uid);
-    setuid(target_uid);
-
-    errno = 0;
-    target_pid = strtoul(argvv[2], 0, 10);
-    if (errno != 0)
-    {
-        printf("%s\n", "cannot convert string pid to integer");
-        exit(1);
-    }
-    convert_prev_cookie(argvv[0], argvv[3], prev_cookie);
-    check_status();
-
-    int status =
-        DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
-
-    return status;
-}
index a37fbdd..46eaed8 100644 (file)
@@ -12,7 +12,6 @@ security-tests.sh smack --output=text $ign
 security-tests.sh libprivilege-control --output=text $ign
 security-tests.sh ss-clientsmack --output=text $ign
 security-tests.sh ss-label --output=text $ign
-security-tests.sh ss-pid --output=text $ign
 security-tests.sh ss-server --output=text $ign
 security-tests.sh ss-password --output=text $ign
 security-tests.sh ss-dbus --output=text $ign
index bc09ce5..c60986a 100644 (file)
@@ -47,12 +47,6 @@ case $1 in
     echo
     security-server-tests-label $2 $3
     ;;
-"ss-pid")
-    echo "========================================================================="
-    echo "SECURITY SERVER TEST PID"
-    echo
-    security-server-tests-pid-reuser $2 $3
-    ;;
 "ss-server")
     echo "========================================================================="
     echo "SECURITY SERVER TEST SERVER"
@@ -83,7 +77,7 @@ case $1 in
     echo "    security_test.sh <module> <args_for_module>"
     echo
     echo "modules: smack, libprivilege-control, ss-clientsmack"
-    echo "         ss-label, ss-pid, ss-server, ss-api-speed, ss-password"
+    echo "         ss-label, ss-server, ss-api-speed, ss-password"
     ;;
 
 esac