summaryrefslogtreecommitdiffstats
path: root/liblog
diff options
context:
space:
mode:
authorElliott Hughes2018-06-19 17:06:53 -0500
committerElliott Hughes2018-06-19 17:06:53 -0500
commit6427c363dfba0f5de286c0b9846a6547ca591871 (patch)
treea32e13bd281d9b45f18cc061e58e17c9aa0ba74c /liblog
parent9040b888a6ede99b56be8a1f54650198f0739f37 (diff)
downloadplatform-system-core-6427c363dfba0f5de286c0b9846a6547ca591871.tar.gz
platform-system-core-6427c363dfba0f5de286c0b9846a6547ca591871.tar.xz
platform-system-core-6427c363dfba0f5de286c0b9846a6547ca591871.zip
logd: remove failing test.
Bug: N/A Test: ran tests manually Change-Id: I3ebb97d757077acaab1b51809a1c2be90ceb1ad9
Diffstat (limited to 'liblog')
-rw-r--r--liblog/tests/liblog_test.cpp107
1 files changed, 0 insertions, 107 deletions
diff --git a/liblog/tests/liblog_test.cpp b/liblog/tests/liblog_test.cpp
index 597a6bb90..a8a9a120a 100644
--- a/liblog/tests/liblog_test.cpp
+++ b/liblog/tests/liblog_test.cpp
@@ -3180,113 +3180,6 @@ TEST(liblog, __android_log_pmsg_file_read) {
3180} 3180}
3181#endif // USING_LOGGER_DEFAULT 3181#endif // USING_LOGGER_DEFAULT
3182 3182
3183#ifdef USING_LOGGER_DEFAULT // Do not retest event mapping functionality
3184#ifdef __ANDROID__
3185// must be: '<needle:> 0 kB'
3186static bool isZero(const std::string& content, std::string::size_type pos,
3187 const char* needle) {
3188 std::string::size_type offset = content.find(needle, pos);
3189 return (offset != std::string::npos) &&
3190 ((offset = content.find_first_not_of(" \t", offset + strlen(needle))) !=
3191 std::string::npos) &&
3192 (content.find_first_not_of('0', offset) != offset);
3193}
3194
3195// must not be: '<needle:> 0 kB'
3196static bool isNotZero(const std::string& content, std::string::size_type pos,
3197 const char* needle) {
3198 std::string::size_type offset = content.find(needle, pos);
3199 return (offset != std::string::npos) &&
3200 ((offset = content.find_first_not_of(" \t", offset + strlen(needle))) !=
3201 std::string::npos) &&
3202 (content.find_first_not_of("123456789", offset) != offset);
3203}
3204
3205static void event_log_tags_test_smap(pid_t pid) {
3206 std::string filename = android::base::StringPrintf("/proc/%d/smaps", pid);
3207
3208 std::string content;
3209 if (!android::base::ReadFileToString(filename, &content)) return;
3210
3211 bool shared_ok = false;
3212 bool private_ok = false;
3213 bool anonymous_ok = false;
3214 bool pass_ok = false;
3215
3216 static const char event_log_tags[] = "event-log-tags";
3217 std::string::size_type pos = 0;
3218 while ((pos = content.find(event_log_tags, pos)) != std::string::npos) {
3219 pos += strlen(event_log_tags);
3220
3221 // must not be: 'Shared_Clean: 0 kB'
3222 bool ok =
3223 isNotZero(content, pos, "Shared_Clean:") ||
3224 // If not /etc/event-log-tags, thus r/w, then half points
3225 // back for not 'Shared_Dirty: 0 kB'
3226 ((content.substr(pos - 5 - strlen(event_log_tags), 5) != "/etc/") &&
3227 isNotZero(content, pos, "Shared_Dirty:"));
3228 if (ok && !pass_ok) {
3229 shared_ok = true;
3230 } else if (!ok) {
3231 shared_ok = false;
3232 }
3233
3234 // must be: 'Private_Dirty: 0 kB' and 'Private_Clean: 0 kB'
3235 ok = isZero(content, pos, "Private_Dirty:") ||
3236 isZero(content, pos, "Private_Clean:");
3237 if (ok && !pass_ok) {
3238 private_ok = true;
3239 } else if (!ok) {
3240 private_ok = false;
3241 }
3242
3243 // must be: 'Anonymous: 0 kB'
3244 ok = isZero(content, pos, "Anonymous:");
3245 if (ok && !pass_ok) {
3246 anonymous_ok = true;
3247 } else if (!ok) {
3248 anonymous_ok = false;
3249 }
3250
3251 pass_ok = true;
3252 }
3253 content = "";
3254
3255 if (!pass_ok) return;
3256 if (shared_ok && anonymous_ok && private_ok) return;
3257
3258 filename = android::base::StringPrintf("/proc/%d/comm", pid);
3259 android::base::ReadFileToString(filename, &content);
3260 content = android::base::StringPrintf(
3261 "%d:%s", pid, content.substr(0, content.find('\n')).c_str());
3262
3263 EXPECT_TRUE(IsOk(shared_ok, content));
3264 EXPECT_TRUE(IsOk(private_ok, content));
3265 EXPECT_TRUE(IsOk(anonymous_ok, content));
3266}
3267#endif // __ANDROID__
3268
3269TEST(liblog, event_log_tags) {
3270#ifdef __ANDROID__
3271 std::unique_ptr<DIR, int (*)(DIR*)> proc_dir(opendir("/proc"), closedir);
3272 ASSERT_FALSE(!proc_dir);
3273
3274 dirent* e;
3275 while ((e = readdir(proc_dir.get()))) {
3276 if (e->d_type != DT_DIR) continue;
3277 if (!isdigit(e->d_name[0])) continue;
3278 long long id = atoll(e->d_name);
3279 if (id <= 0) continue;
3280 pid_t pid = id;
3281 if (id != pid) continue;
3282 event_log_tags_test_smap(pid);
3283 }
3284#else
3285 GTEST_LOG_(INFO) << "This test does nothing.\n";
3286#endif
3287}
3288#endif // USING_LOGGER_DEFAULT
3289
3290#ifdef USING_LOGGER_DEFAULT // Do not retest ratelimit 3183#ifdef USING_LOGGER_DEFAULT // Do not retest ratelimit
3291TEST(liblog, __android_log_ratelimit) { 3184TEST(liblog, __android_log_ratelimit) {
3292 time_t state = 0; 3185 time_t state = 0;