From: Jan Olszak Date: Thu, 4 Jul 2013 13:01:22 +0000 (+0200) Subject: Changed dlog logging buffer. X-Git-Tag: security-manager_5.5_testing~387 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=de7e96f1b45aca7b080bd4a69ac205cc63102e1c;p=platform%2Fcore%2Ftest%2Fsecurity-tests.git Changed dlog logging buffer. [Issue#] dlog logged in a wrong buffer. [Bug/Feature] Recent prevent bugs need fix. [Cause] N/A [Solution] N/A [Verification] Build, install, run "dlogutil -c", run tests, run "dlogutil -b main PRIVILEGE_CONTROL" (no loggs), "dlogutil -b system PRIVILEGE_CONTROL" (loggs..). Repeat for SECURITY_SERVER. Change-Id: I9b1a9c2f139cb1984c22013c6d2c871b31ff63a1 --- diff --git a/tests/security-server-tests/security_server_tests_label.cpp b/tests/security-server-tests/security_server_tests_label.cpp index f5ca3b1..19f3148 100644 --- a/tests/security-server-tests/security_server_tests_label.cpp +++ b/tests/security-server-tests/security_server_tests_label.cpp @@ -32,13 +32,13 @@ RUNNER_TEST(tc_security_server_get_smacklabel_cookie) { int COOKIESIZE = security_server_get_cookie_size(); RUNNER_ASSERT_MSG(20 == COOKIESIZE, "Wrong cookie size from security-server"); - LOGD("%s %d", "Cookie size:", COOKIESIZE); + SLOGD("%s %d", "Cookie size:", COOKIESIZE); cookie = (char*) calloc(COOKIESIZE, 1); RUNNER_ASSERT_MSG(NULL != cookie, "Memory allocation error"); mypid = getpid(); - LOGD("%s %d", "This binary PID is:", mypid); + SLOGD("%s %d", "This binary PID is:", mypid); res = smack_new_label_from_self(&label_smack); if (0 != res) { @@ -62,7 +62,7 @@ RUNNER_TEST(tc_security_server_get_smacklabel_cookie) { RUNNER_ASSERT_MSG(false, "Error in requesting cookie from security-server"); } - LOGD("%s", "Received cookie:"); + SLOGD("%s", "Received cookie:"); printhex((unsigned char*) cookie, COOKIESIZE); label_ss = security_server_get_smacklabel_cookie(cookie); @@ -76,8 +76,8 @@ RUNNER_TEST(tc_security_server_get_smacklabel_cookie) { RUNNER_ASSERT_MSG(false, "Error in getting label by cookie"); } - LOGD("%s %s", "Label from SMACK:", label_smack); - LOGD("%s %s", "Label from SS:", label_ss); + SLOGD("%s %s", "Label from SMACK:", label_smack); + SLOGD("%s %s", "Label from SS:", label_ss); if (sizeof(label_smack) != sizeof(label_ss)) { if (NULL != label_smack) diff --git a/tests/security-server-tests/security_server_tests_password.cpp b/tests/security-server-tests/security_server_tests_password.cpp index 82f65cb..c3628fd 100644 --- a/tests/security-server-tests/security_server_tests_password.cpp +++ b/tests/security-server-tests/security_server_tests_password.cpp @@ -52,8 +52,8 @@ RUNNER_TEST(tc01_clear_environment) } else { - LOGD("To run the test as non root user, please remove password files (/opt/data/security-server/*) in root shell\n"); - LOGD("If not, you will see some failures\n"); + SLOGD("To run the test as non root user, please remove password files (/opt/data/security-server/*) in root shell\n"); + SLOGD("If not, you will see some failures\n"); RUNNER_IGNORED_MSG("I'm not root"); } diff --git a/tests/security-server-tests/security_server_tests_pid_reuser.cpp b/tests/security-server-tests/security_server_tests_pid_reuser.cpp index b9f9714..d1d316d 100644 --- a/tests/security-server-tests/security_server_tests_pid_reuser.cpp +++ b/tests/security-server-tests/security_server_tests_pid_reuser.cpp @@ -88,7 +88,7 @@ void cycle_pid(int pid) { dotval = cur_pid % 1000; if (dotval == 0) - LOGD("."); + SLOGD("."); exit(0); } cur_pid = getpid(); @@ -101,14 +101,14 @@ RUNNER_TEST_GROUP_INIT(SECURITY_SERVER_TESTS_PID); RUNNER_TEST(tc_security_server_request_cookie) { RUNNER_IGNORED_MSG("needs FIX, check FIXME comment"); - LOGD("Cycling PID to %d\n", target_pid); + 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); - LOGD("\nTarget PID: %d, Target UID: %d\n", target_pid, target_uid); - LOGD("Previous cookie:\n"); + SLOGD("\nTarget PID: %d, Target UID: %d\n", target_pid, target_uid); + SLOGD("Previous cookie:\n"); printhex(prev_cookie, 20); - LOGD("Newly issued cookie:\n"); + SLOGD("Newly issued cookie:\n"); printhex(new_cookie, 20); RUNNER_ASSERT_MSG(memcmp(prev_cookie, new_cookie, cookie_size) != 0, "cookies are the same"); } @@ -139,7 +139,7 @@ int main(int argc, char *argv[]) printf("%s\n", "cannot convert string uid to integer"); exit(1); } - LOGD("Target UID is %d. change user...\n", target_uid); + SLOGD("Target UID is %d. change user...\n", target_uid); setuid(target_uid); errno = 0; diff --git a/tests/security-server-tests/security_server_tests_server.cpp b/tests/security-server-tests/security_server_tests_server.cpp index cdf71ba..e2d1162 100644 --- a/tests/security-server-tests/security_server_tests_server.cpp +++ b/tests/security-server-tests/security_server_tests_server.cpp @@ -95,14 +95,14 @@ int create_new_socket() mode_t sock_mode; if (unlink(SECURITY_SERVER_TEST_SOCK_PATH) == -1 && errno != ENOENT) { - LOGE("%s : %s\n", "unlink()", strerror(errno)); + SLOGE("%s : %s\n", "unlink()", strerror(errno)); goto error; } /* Create Unix domain socket */ if ((localsockfd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) { - LOGE("%s : %s\n", "socket()", strerror(errno)); + SLOGE("%s : %s\n", "socket()", strerror(errno)); goto error; } @@ -110,7 +110,7 @@ int create_new_socket() if ((flags = fcntl(localsockfd, F_GETFL, 0)) < 0 || fcntl(localsockfd, F_SETFL, flags | O_NONBLOCK) < 0) { - LOGE("%s : %s\n", "fcntl()", strerror(errno)); + SLOGE("%s : %s\n", "fcntl()", strerror(errno)); goto error; } @@ -122,7 +122,7 @@ int create_new_socket() /* Bind the socket */ if ((bind(localsockfd, (struct sockaddr*)&serveraddr, sizeof(serveraddr))) < 0) { - LOGE("%s : %s\n", "bind()", strerror(errno)); + SLOGE("%s : %s\n", "bind()", strerror(errno)); goto error; } @@ -133,7 +133,7 @@ int create_new_socket() * But, fchmod doesn't work on socket file so there is no other choice at this point */ if (chmod(SECURITY_SERVER_TEST_SOCK_PATH, sock_mode) < 0) /* Flawfinder: ignore */ { - LOGE("%s : %s\n", "chmod()", strerror(errno)); + SLOGE("%s : %s\n", "chmod()", strerror(errno)); goto error; } @@ -155,14 +155,14 @@ int check_socket_poll(int sockfd, int event, int timeout) retval = poll(poll_fd, 1, timeout); if (retval < 0) { - LOGE("%s : %s\n", "poll()", strerror(errno)); + SLOGE("%s : %s\n", "poll()", strerror(errno)); return -1; } /* Timed out */ if (retval == 0) { - LOGE("%s", "poll() timeout"); + SLOGE("%s", "poll() timeout"); return 0; } return 1; @@ -183,7 +183,7 @@ int send_gid_request(int sock_fd, const char *object) buf = (unsigned char*) malloc(send_len); if (buf == NULL) { - LOGE("%s\n", "out of memory"); + SLOGE("%s\n", "out of memory"); return -1; } @@ -194,14 +194,14 @@ int send_gid_request(int sock_fd, const char *object) retval = check_socket_poll(sock_fd, POLLOUT, 1000); if (retval == -1) { - LOGE("%s\n", "poll() error"); + SLOGE("%s\n", "poll() error"); if (buf != NULL) free(buf); return -1; } if (retval == 0) { - LOGE("%s\n", "poll() timeout"); + SLOGE("%s\n", "poll() timeout"); if (buf != NULL) free(buf); return -1; @@ -211,7 +211,7 @@ int send_gid_request(int sock_fd, const char *object) if (retval < send_len) { /* Write error */ - LOGE("Error on write(): %d. errno=%d, sockfd=%d\n", retval, errno, sock_fd); + SLOGE("Error on write(): %d. errno=%d, sockfd=%d\n", retval, errno, sock_fd); if (buf != NULL) free(buf); return -1; @@ -232,7 +232,7 @@ int connect_to_server(int *fd) localsockfd = socket(AF_UNIX, SOCK_STREAM, 0); if (localsockfd < 0) { - LOGE("%s : %s\n", "socket()", strerror(errno)); + SLOGE("%s : %s\n", "socket()", strerror(errno)); return -1; } @@ -241,7 +241,7 @@ int connect_to_server(int *fd) fcntl(localsockfd, F_SETFL, flags | O_NONBLOCK) < 0) { close(localsockfd); - LOGE("%s : %s\n", "fcntl()", strerror(errno)); + SLOGE("%s : %s\n", "fcntl()", strerror(errno)); return -1; } @@ -256,25 +256,25 @@ int connect_to_server(int *fd) { if (errno == EINPROGRESS) { - LOGD("%s\n", "Connection is in progress"); + SLOGD("%s\n", "Connection is in progress"); check_socket_poll(localsockfd, POLLOUT, 1000); if (ret == -1) { - LOGE("%s\n", "poll() error"); + SLOGE("%s\n", "poll() error"); close(localsockfd); return -1; } ret = connect(localsockfd, (struct sockaddr*)&clientaddr, client_len); if (ret < 0) { - LOGE("%s\n", "connection failed"); + SLOGE("%s\n", "connection failed"); close(localsockfd); return -1; } } else { - LOGE("%s\n", "Connection failed"); + SLOGE("%s\n", "Connection failed"); close(localsockfd); return -1; } @@ -294,7 +294,7 @@ int fake_get_gid(const char *object) if (retval != 0) { /* Error on socket */ - LOGE("Connection failed: %d\n", retval); + SLOGE("Connection failed: %d\n", retval); goto error; } @@ -303,10 +303,10 @@ int fake_get_gid(const char *object) if (retval != 0) { /* Error on socket */ - LOGE("Send request failed: %d\n", retval); + SLOGE("Send request failed: %d\n", retval); goto error; } - LOGD("%s", "Just closing the socket and exit\n"); + SLOGD("%s", "Just closing the socket and exit\n"); error: if (sockfd > 0) @@ -413,7 +413,7 @@ RUNNER_TEST(tc_security_server_get_gid_wrong_object_name_teltel) RUNNER_TEST(tc_security_server_get_object_name_normal_case_trying_6001) { ret = security_server_get_object_name(6001, obj_name, sizeof(obj_name)); - LOGD("Result: %s\n", obj_name); + SLOGD("Result: %s\n", obj_name); RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS); }