diff options
author | Mark Salyzyn <salyzyn@google.com> | 2016-10-24 13:11:46 -0700 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2016-10-24 13:39:19 -0700 |
commit | 9f53cac1b4e397c42bf640eec0eed4a2ffae6f60 (patch) | |
tree | ef164a303d2906874c7319fa1554defbcf1ad478 /logcat/tests/logcat_test.cpp | |
parent | 8cf0bd75f79ed641b5841dea1d34af18c6b4d40d (diff) | |
download | core-9f53cac1b4e397c42bf640eec0eed4a2ffae6f60.tar.gz core-9f53cac1b4e397c42bf640eec0eed4a2ffae6f60.tar.bz2 core-9f53cac1b4e397c42bf640eec0eed4a2ffae6f60.zip |
fix regression from android_lookupEventTag_len()
Commit 807e40ecc9786755e2f74a7a6a9b20c812588119 'liblog: logd: Add
android_lookupEventTag_len()' which addressed a Dirty Shared memory
leak resulted in a regression. Most notably logcat <tag> stopped
working for the events log buffer.
AndroidLogEntry::tag also requires callers to check out
AndroidLogEntry::tagLen as tag is no longer guaranteed to be
nul terminated.
Test: logcat-unit-tests --gtest_filter=logcat.event_tag_filter
Bug: 31456426
Change-Id: Ibe5236131b640eb5b7e3df0ab4b5f3e25b85ad45
Diffstat (limited to 'logcat/tests/logcat_test.cpp')
-rw-r--r-- | logcat/tests/logcat_test.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/logcat/tests/logcat_test.cpp b/logcat/tests/logcat_test.cpp index 66800b15e..fd4e2fbef 100644 --- a/logcat/tests/logcat_test.cpp +++ b/logcat/tests/logcat_test.cpp @@ -79,6 +79,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) { |