liblog: test: *.android_errorWriteWithinfoLog__android_logger_list_read__*
We would experience failures as test runs interfere with each other. Create a unique tag for each test run signature. Switch from using TEST_PREFIX to TEST_LOGGER to identify the logger transport being inspected and make that part of the signature. Make sure 32 bit and 64 bit tests do not interfere. Test: gTest liblog-unit-tests cts-tradefed run cts -m CtsLiblogTestCases Bug: 36232924 Change-Id: I4d58242e5ef8e68e2d4b27cecf538938e17acf3f
This commit is contained in:
parent
cc404b51fc
commit
5707524003
|
@ -42,7 +42,10 @@
|
|||
#include <private/android_logger.h>
|
||||
|
||||
#ifndef TEST_PREFIX
|
||||
#ifdef __ANDROID__ // make sure we always run code if compiled for android
|
||||
#ifdef TEST_LOGGER
|
||||
#define TEST_PREFIX android_set_log_transport(TEST_LOGGER);
|
||||
// make sure we always run code despite overrides if compiled for android
|
||||
#elif defined(__ANDROID__)
|
||||
#define TEST_PREFIX
|
||||
#endif
|
||||
#endif
|
||||
|
@ -2137,10 +2140,19 @@ static void android_errorWriteWithInfoLog_helper(int TAG, const char* SUBTAG,
|
|||
}
|
||||
#endif
|
||||
|
||||
// Make multiple tests and re-tests orthogonal to prevent falsing.
|
||||
#ifdef TEST_LOGGER
|
||||
#define UNIQUE_TAG(X) \
|
||||
(0x12340000 + (((X) + sizeof(int) + sizeof(void*)) << 8) + TEST_LOGGER)
|
||||
#else
|
||||
#define UNIQUE_TAG(X) \
|
||||
(0x12340000 + (((X) + sizeof(int) + sizeof(void*)) << 8) + 0xBA)
|
||||
#endif
|
||||
|
||||
TEST(liblog, android_errorWriteWithInfoLog__android_logger_list_read__typical) {
|
||||
#ifdef TEST_PREFIX
|
||||
int count;
|
||||
android_errorWriteWithInfoLog_helper(123456781, "test-subtag", -1,
|
||||
android_errorWriteWithInfoLog_helper(UNIQUE_TAG(1), "test-subtag", -1,
|
||||
max_payload_buf, 200, count);
|
||||
EXPECT_EQ(SUPPORTS_END_TO_END, count);
|
||||
#else
|
||||
|
@ -2152,7 +2164,7 @@ TEST(liblog,
|
|||
android_errorWriteWithInfoLog__android_logger_list_read__data_too_large) {
|
||||
#ifdef TEST_PREFIX
|
||||
int count;
|
||||
android_errorWriteWithInfoLog_helper(123456782, "test-subtag", -1,
|
||||
android_errorWriteWithInfoLog_helper(UNIQUE_TAG(2), "test-subtag", -1,
|
||||
max_payload_buf, sizeof(max_payload_buf),
|
||||
count);
|
||||
EXPECT_EQ(SUPPORTS_END_TO_END, count);
|
||||
|
@ -2165,8 +2177,8 @@ TEST(liblog,
|
|||
android_errorWriteWithInfoLog__android_logger_list_read__null_data) {
|
||||
#ifdef TEST_PREFIX
|
||||
int count;
|
||||
android_errorWriteWithInfoLog_helper(123456783, "test-subtag", -1, NULL, 200,
|
||||
count);
|
||||
android_errorWriteWithInfoLog_helper(UNIQUE_TAG(3), "test-subtag", -1, NULL,
|
||||
200, count);
|
||||
EXPECT_EQ(0, count);
|
||||
#else
|
||||
GTEST_LOG_(INFO) << "This test does nothing.\n";
|
||||
|
@ -2178,7 +2190,7 @@ TEST(liblog,
|
|||
#ifdef TEST_PREFIX
|
||||
int count;
|
||||
android_errorWriteWithInfoLog_helper(
|
||||
123456784, "abcdefghijklmnopqrstuvwxyz now i know my abc", -1,
|
||||
UNIQUE_TAG(4), "abcdefghijklmnopqrstuvwxyz now i know my abc", -1,
|
||||
max_payload_buf, 200, count);
|
||||
EXPECT_EQ(SUPPORTS_END_TO_END, count);
|
||||
#else
|
||||
|
@ -2313,7 +2325,7 @@ static void android_errorWriteLog_helper(int TAG, const char* SUBTAG,
|
|||
TEST(liblog, android_errorWriteLog__android_logger_list_read__success) {
|
||||
#ifdef TEST_PREFIX
|
||||
int count;
|
||||
android_errorWriteLog_helper(123456785, "test-subtag", count);
|
||||
android_errorWriteLog_helper(UNIQUE_TAG(5), "test-subtag", count);
|
||||
EXPECT_EQ(SUPPORTS_END_TO_END, count);
|
||||
#else
|
||||
GTEST_LOG_(INFO) << "This test does nothing.\n";
|
||||
|
@ -2323,7 +2335,7 @@ TEST(liblog, android_errorWriteLog__android_logger_list_read__success) {
|
|||
TEST(liblog, android_errorWriteLog__android_logger_list_read__null_subtag) {
|
||||
#ifdef TEST_PREFIX
|
||||
int count;
|
||||
android_errorWriteLog_helper(123456786, NULL, count);
|
||||
android_errorWriteLog_helper(UNIQUE_TAG(6), NULL, count);
|
||||
EXPECT_EQ(0, count);
|
||||
#else
|
||||
GTEST_LOG_(INFO) << "This test does nothing.\n";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifdef __ANDROID__
|
||||
#include <log/log_transport.h>
|
||||
#define TEST_PREFIX android_set_log_transport(LOGGER_DEFAULT);
|
||||
#define TEST_LOGGER LOGGER_DEFAULT
|
||||
#endif
|
||||
#include "liblog_test.cpp"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <log/log_transport.h>
|
||||
#define liblog liblog_local
|
||||
#define TEST_PREFIX android_set_log_transport(LOGGER_LOCAL);
|
||||
#define TEST_LOGGER LOGGER_LOCAL
|
||||
#include "liblog_test.cpp"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <log/log_transport.h>
|
||||
#define liblog liblog_stderr
|
||||
#define TEST_PREFIX android_set_log_transport(LOGGER_STDERR);
|
||||
#define TEST_LOGGER LOGGER_STDERR
|
||||
#define USING_LOGGER_STDERR
|
||||
#include "liblog_test.cpp"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <log/log_transport.h>
|
||||
#define liblog liblog_stderr_local
|
||||
#define TEST_PREFIX android_set_log_transport(LOGGER_LOCAL | LOGGER_STDERR);
|
||||
#define TEST_LOGGER (LOGGER_LOCAL | LOGGER_STDERR)
|
||||
#include "liblog_test.cpp"
|
||||
|
|
Loading…
Reference in New Issue