diff options
author | Mark Salyzyn <salyzyn@google.com> | 2017-05-23 13:59:42 -0700 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2017-05-24 12:50:38 -0700 |
commit | 558f2a166b229499a2c804a3b8bd388189835d47 (patch) | |
tree | 2cb542618b24e411fb690a3559324a244adbcf24 /liblog | |
parent | 928e606d5af52ed4f253bda95451ff990b9a9f82 (diff) | |
download | core-558f2a166b229499a2c804a3b8bd388189835d47.tar.gz core-558f2a166b229499a2c804a3b8bd388189835d47.tar.bz2 core-558f2a166b229499a2c804a3b8bd388189835d47.zip |
liblog: test: android_logger_get_ "kernel" log buffer can be empty
(cherry picked from commit 37eaefa9a0792ece4db77bbc0cf03cc0b6793c54)
If user build and for the "kernel" log buffer, allow an empty report.
Test: CTS: User: liblog#android_logger_get_
Test: remove ro.debuggable line from /default.prop,
run liblog-unit-tests --gtest_filter=*.android_logger_get_
Bug: 62030309
Change-Id: I5f91af07608988f322b3c46574becc308e1d8b13
Diffstat (limited to 'liblog')
-rw-r--r-- | liblog/tests/log_read_test.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/liblog/tests/log_read_test.cpp b/liblog/tests/log_read_test.cpp index a63ab8e88..6ed568aa4 100644 --- a/liblog/tests/log_read_test.cpp +++ b/liblog/tests/log_read_test.cpp @@ -23,6 +23,7 @@ #include <android-base/stringprintf.h> #include <android/log.h> // minimal logging API #include <gtest/gtest.h> +#include <log/log_properties.h> // Test the APIs in this standalone include file #include <log/log_read.h> // Do not use anything in log/log_time.h despite side effects of the above. @@ -97,9 +98,12 @@ TEST(liblog, android_logger_get_) { /* security buffer is allowed to be denied */ if (strcmp("security", name)) { EXPECT_LT(0, get_log_size); - /* crash buffer is allowed to be empty, that is actually healthy! */ - EXPECT_LE((strcmp("crash", name)) != 0, - android_logger_get_log_readable_size(logger)); + // crash buffer is allowed to be empty, that is actually healthy! + // kernel buffer is allowed to be empty on "user" builds + EXPECT_LE( // boolean 1 or 0 depending on expected content or empty + !!((strcmp("crash", name) != 0) && + ((strcmp("kernel", name) != 0) || __android_log_is_debuggable())), + android_logger_get_log_readable_size(logger)); } else { EXPECT_NE(0, get_log_size); if (get_log_size < 0) { |