summaryrefslogtreecommitdiffstats
path: root/logcat
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2016-10-24 23:08:46 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-10-24 23:08:47 +0000
commit9fa133cc286f7d2f1c565668d7675b7d7d4bdc0e (patch)
tree56a9d9f745e9d7785ae5d35bbfc1b337ce600305 /logcat
parent291fd678e507777e5fd1c1d690a998b0ca7ccb27 (diff)
parent9f53cac1b4e397c42bf640eec0eed4a2ffae6f60 (diff)
downloadsystem_core-9fa133cc286f7d2f1c565668d7675b7d7d4bdc0e.tar.gz
system_core-9fa133cc286f7d2f1c565668d7675b7d7d4bdc0e.tar.bz2
system_core-9fa133cc286f7d2f1c565668d7675b7d7d4bdc0e.zip
Merge "fix regression from android_lookupEventTag_len()"
Diffstat (limited to 'logcat')
-rw-r--r--logcat/logcat.cpp4
-rw-r--r--logcat/tests/logcat_test.cpp20
2 files changed, 23 insertions, 1 deletions
diff --git a/logcat/logcat.cpp b/logcat/logcat.cpp
index 51d1a3afa..f08a6cdac 100644
--- a/logcat/logcat.cpp
+++ b/logcat/logcat.cpp
@@ -186,7 +186,9 @@ static void processBuffer(log_device_t* dev, struct log_msg *buf)
goto error;
}
- if (android_log_shouldPrintLine(g_logformat, entry.tag, entry.priority)) {
+ if (android_log_shouldPrintLine(g_logformat,
+ std::string(entry.tag, entry.tagLen).c_str(),
+ entry.priority)) {
bool match = regexOk(entry);
g_printCount += match;
diff --git a/logcat/tests/logcat_test.cpp b/logcat/tests/logcat_test.cpp
index 1baaf11cc..bc0ea525c 100644
--- a/logcat/tests/logcat_test.cpp
+++ b/logcat/tests/logcat_test.cpp
@@ -78,6 +78,26 @@ TEST(logcat, buckets) {
EXPECT_EQ(4, count);
}
+TEST(logcat, event_tag_filter) {
+ FILE *fp;
+
+ ASSERT_TRUE(NULL != (fp = popen(
+ "logcat -b events -d -s auditd am_proc_start am_pss am_proc_bound dvm_lock_sample am_wtf 2>/dev/null",
+ "r")));
+
+ char buffer[BIG_BUFFER];
+
+ int count = 0;
+
+ while (fgets(buffer, sizeof(buffer), fp)) {
+ ++count;
+ }
+
+ pclose(fp);
+
+ EXPECT_LT(4, count);
+}
+
TEST(logcat, year) {
if (android_log_clockid() == CLOCK_MONOTONIC) {