summaryrefslogtreecommitdiffstats
path: root/liblog/tests
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2016-08-23 10:23:36 -0700
committergitbuildkicker <android-build@google.com>2016-09-27 15:59:28 -0700
commite8ee40302200c1bd1fd6537c80bf5e8aab744d42 (patch)
treeeca27ff2ff73c9cfda70fb03a3c2f73d968e195a /liblog/tests
parentb825f1148cc78fa853da964de2e7e2de1b3b03b2 (diff)
downloadsystem_core-e8ee40302200c1bd1fd6537c80bf5e8aab744d42.zip
system_core-e8ee40302200c1bd1fd6537c80bf5e8aab744d42.tar.gz
system_core-e8ee40302200c1bd1fd6537c80bf5e8aab744d42.tar.bz2
liblog: add __android_log_close()
Bug: 30963384 (cherry picked from commit df7a4c6bae5f85532d79a93b7d9197a2aab17825) Change-Id: I2255486e84dd55af0f4e7fbbfb616c2deb1765d0 (cherry picked from commit 2d149691552676968b7de337f543463b920578b0)
Diffstat (limited to 'liblog/tests')
-rw-r--r--liblog/tests/liblog_test.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/liblog/tests/liblog_test.cpp b/liblog/tests/liblog_test.cpp
index c987041..0e7fec4 100644
--- a/liblog/tests/liblog_test.cpp
+++ b/liblog/tests/liblog_test.cpp
@@ -127,12 +127,17 @@ TEST(liblog, __android_log_btwrite__android_logger_list_read) {
ASSERT_TRUE(NULL != (logger_list = android_logger_list_open(
LOG_ID_EVENTS, ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK, 1000, pid)));
+ // Check that we can close and reopen the logger
log_time ts(CLOCK_MONOTONIC);
-
ASSERT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts, sizeof(ts)));
+ __android_log_close();
+
+ log_time ts1(CLOCK_MONOTONIC);
+ ASSERT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts1, sizeof(ts1)));
usleep(1000000);
int count = 0;
+ int second_count = 0;
for (;;) {
log_msg log_msg;
@@ -156,10 +161,13 @@ TEST(liblog, __android_log_btwrite__android_logger_list_read) {
log_time tx(eventData + 4 + 1);
if (ts == tx) {
++count;
+ } else if (ts1 == tx) {
+ ++second_count;
}
}
EXPECT_EQ(1, count);
+ EXPECT_EQ(1, second_count);
android_logger_list_close(logger_list);
}