Loading logd/tests/logd_test.cpp +39 −14 Original line number Diff line number Diff line Loading @@ -649,12 +649,34 @@ TEST(logd, benchmark) { ASSERT_NE(0UL, nowSpamSize); // Determine if we have the spam filter enabled int sock = socket_local_client("logd", ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_STREAM); ASSERT_TRUE(sock >= 0); static const char getPruneList[] = "getPruneList"; if (write(sock, getPruneList, sizeof(getPruneList)) > 0) { char buffer[80]; memset(buffer, 0, sizeof(buffer)); read(sock, buffer, sizeof(buffer)); char *cp = strchr(buffer, '\n'); if (!cp || (cp[1] != '~') || (cp[2] != '!')) { close(sock); fprintf(stderr, "WARNING: " "Logger has SPAM filtration turned off \"%s\"\n", buffer); return; } } else { int save_errno = errno; close(sock); FAIL() << "Can not send " << getPruneList << " to logger -- " << strerror(save_errno); } static const unsigned long expected_absolute_minimum_log_size = 65536UL; unsigned long totalSize = expected_absolute_minimum_log_size; if (sock >= 0) { static const char getSize[] = { 'g', 'e', 't', 'L', 'o', 'g', 'S', 'i', 'z', 'e', ' ', LOG_ID_MAIN + '0', '\0' Loading @@ -665,11 +687,14 @@ TEST(logd, benchmark) { read(sock, buffer, sizeof(buffer)); totalSize = atol(buffer); if (totalSize < expected_absolute_minimum_log_size) { fprintf(stderr, "WARNING: " "Logger had unexpected referenced size \"%s\"\n", buffer); totalSize = expected_absolute_minimum_log_size; } } close(sock); } // logd allows excursions to 110% of total size totalSize = (totalSize * 11 ) / 10; Loading Loading
logd/tests/logd_test.cpp +39 −14 Original line number Diff line number Diff line Loading @@ -649,12 +649,34 @@ TEST(logd, benchmark) { ASSERT_NE(0UL, nowSpamSize); // Determine if we have the spam filter enabled int sock = socket_local_client("logd", ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_STREAM); ASSERT_TRUE(sock >= 0); static const char getPruneList[] = "getPruneList"; if (write(sock, getPruneList, sizeof(getPruneList)) > 0) { char buffer[80]; memset(buffer, 0, sizeof(buffer)); read(sock, buffer, sizeof(buffer)); char *cp = strchr(buffer, '\n'); if (!cp || (cp[1] != '~') || (cp[2] != '!')) { close(sock); fprintf(stderr, "WARNING: " "Logger has SPAM filtration turned off \"%s\"\n", buffer); return; } } else { int save_errno = errno; close(sock); FAIL() << "Can not send " << getPruneList << " to logger -- " << strerror(save_errno); } static const unsigned long expected_absolute_minimum_log_size = 65536UL; unsigned long totalSize = expected_absolute_minimum_log_size; if (sock >= 0) { static const char getSize[] = { 'g', 'e', 't', 'L', 'o', 'g', 'S', 'i', 'z', 'e', ' ', LOG_ID_MAIN + '0', '\0' Loading @@ -665,11 +687,14 @@ TEST(logd, benchmark) { read(sock, buffer, sizeof(buffer)); totalSize = atol(buffer); if (totalSize < expected_absolute_minimum_log_size) { fprintf(stderr, "WARNING: " "Logger had unexpected referenced size \"%s\"\n", buffer); totalSize = expected_absolute_minimum_log_size; } } close(sock); } // logd allows excursions to 110% of total size totalSize = (totalSize * 11 ) / 10; Loading