diff options
author | Yoshitaka Seto | 2017-09-21 18:25:34 -0500 |
---|---|---|
committer | android-build-merger | 2017-09-21 18:25:34 -0500 |
commit | 1d444319d794f31d1d45976fb9aa81fe3856ef6d (patch) | |
tree | e0ec5109b152cda638d851c186cf8b5cd4c47348 | |
parent | dc58ecf8eded3bcf521177c1a445e4be15cd9230 (diff) | |
parent | 5dec8e22c3ecda25ac63baa20d2c23c7a659662c (diff) | |
download | platform-system-core-1d444319d794f31d1d45976fb9aa81fe3856ef6d.tar.gz platform-system-core-1d444319d794f31d1d45976fb9aa81fe3856ef6d.tar.xz platform-system-core-1d444319d794f31d1d45976fb9aa81fe3856ef6d.zip |
Remove pstore related unit tests from CTS
am: 5dec8e22c3
Change-Id: Ifba13f9d714e58eaa3358a48246c71f90687629e
-rw-r--r-- | liblog/tests/Android.mk | 9 | ||||
-rw-r--r-- | liblog/tests/liblog_test.cpp | 31 |
2 files changed, 31 insertions, 9 deletions
diff --git a/liblog/tests/Android.mk b/liblog/tests/Android.mk index 5571ce955..39b52ac35 100644 --- a/liblog/tests/Android.mk +++ b/liblog/tests/Android.mk | |||
@@ -54,7 +54,7 @@ test_c_flags := \ | |||
54 | -Werror \ | 54 | -Werror \ |
55 | -fno-builtin \ | 55 | -fno-builtin \ |
56 | 56 | ||
57 | test_src_files := \ | 57 | cts_src_files := \ |
58 | libc_test.cpp \ | 58 | libc_test.cpp \ |
59 | liblog_test_default.cpp \ | 59 | liblog_test_default.cpp \ |
60 | liblog_test_local.cpp \ | 60 | liblog_test_local.cpp \ |
@@ -67,6 +67,9 @@ test_src_files := \ | |||
67 | log_time_test.cpp \ | 67 | log_time_test.cpp \ |
68 | log_wrap_test.cpp | 68 | log_wrap_test.cpp |
69 | 69 | ||
70 | test_src_files := \ | ||
71 | $(cts_src_files) \ | ||
72 | |||
70 | # Build tests for the device (with .so). Run with: | 73 | # Build tests for the device (with .so). Run with: |
71 | # adb shell /data/nativetest/liblog-unit-tests/liblog-unit-tests | 74 | # adb shell /data/nativetest/liblog-unit-tests/liblog-unit-tests |
72 | include $(CLEAR_VARS) | 75 | include $(CLEAR_VARS) |
@@ -82,8 +85,8 @@ cts_executable := CtsLiblogTestCases | |||
82 | include $(CLEAR_VARS) | 85 | include $(CLEAR_VARS) |
83 | LOCAL_MODULE := $(cts_executable) | 86 | LOCAL_MODULE := $(cts_executable) |
84 | LOCAL_MODULE_TAGS := tests | 87 | LOCAL_MODULE_TAGS := tests |
85 | LOCAL_CFLAGS += $(test_c_flags) | 88 | LOCAL_CFLAGS += $(test_c_flags) -DNO_PSTORE |
86 | LOCAL_SRC_FILES := $(test_src_files) | 89 | LOCAL_SRC_FILES := $(cts_src_files) |
87 | LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest | 90 | LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest |
88 | LOCAL_MULTILIB := both | 91 | LOCAL_MULTILIB := both |
89 | LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32 | 92 | LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32 |
diff --git a/liblog/tests/liblog_test.cpp b/liblog/tests/liblog_test.cpp index e2d5aeb46..597a6bb90 100644 --- a/liblog/tests/liblog_test.cpp +++ b/liblog/tests/liblog_test.cpp | |||
@@ -116,6 +116,7 @@ static std::string popenToString(const std::string& command) { | |||
116 | return ret; | 116 | return ret; |
117 | } | 117 | } |
118 | 118 | ||
119 | #ifndef NO_PSTORE | ||
119 | static bool isPmsgActive() { | 120 | static bool isPmsgActive() { |
120 | pid_t pid = getpid(); | 121 | pid_t pid = getpid(); |
121 | 122 | ||
@@ -125,6 +126,7 @@ static bool isPmsgActive() { | |||
125 | 126 | ||
126 | return std::string::npos != myPidFds.find(" -> /dev/pmsg0"); | 127 | return std::string::npos != myPidFds.find(" -> /dev/pmsg0"); |
127 | } | 128 | } |
129 | #endif /* NO_PSTORE */ | ||
128 | 130 | ||
129 | static bool isLogdwActive() { | 131 | static bool isLogdwActive() { |
130 | std::string logdwSignature = | 132 | std::string logdwSignature = |
@@ -189,22 +191,25 @@ TEST(liblog, __android_log_btwrite__android_logger_list_read) { | |||
189 | EXPECT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts, sizeof(ts))); | 191 | EXPECT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts, sizeof(ts))); |
190 | #ifdef USING_LOGGER_DEFAULT | 192 | #ifdef USING_LOGGER_DEFAULT |
191 | // Check that we can close and reopen the logger | 193 | // Check that we can close and reopen the logger |
192 | bool pmsgActiveAfter__android_log_btwrite; | ||
193 | bool logdwActiveAfter__android_log_btwrite; | 194 | bool logdwActiveAfter__android_log_btwrite; |
194 | if (getuid() == AID_ROOT) { | 195 | if (getuid() == AID_ROOT) { |
195 | tested__android_log_close = true; | 196 | tested__android_log_close = true; |
196 | pmsgActiveAfter__android_log_btwrite = isPmsgActive(); | 197 | #ifndef NO_PSTORE |
197 | logdwActiveAfter__android_log_btwrite = isLogdwActive(); | 198 | bool pmsgActiveAfter__android_log_btwrite = isPmsgActive(); |
198 | EXPECT_TRUE(pmsgActiveAfter__android_log_btwrite); | 199 | EXPECT_TRUE(pmsgActiveAfter__android_log_btwrite); |
200 | #endif /* NO_PSTORE */ | ||
201 | logdwActiveAfter__android_log_btwrite = isLogdwActive(); | ||
199 | EXPECT_TRUE(logdwActiveAfter__android_log_btwrite); | 202 | EXPECT_TRUE(logdwActiveAfter__android_log_btwrite); |
200 | } else if (!tested__android_log_close) { | 203 | } else if (!tested__android_log_close) { |
201 | fprintf(stderr, "WARNING: can not test __android_log_close()\n"); | 204 | fprintf(stderr, "WARNING: can not test __android_log_close()\n"); |
202 | } | 205 | } |
203 | __android_log_close(); | 206 | __android_log_close(); |
204 | if (getuid() == AID_ROOT) { | 207 | if (getuid() == AID_ROOT) { |
208 | #ifndef NO_PSTORE | ||
205 | bool pmsgActiveAfter__android_log_close = isPmsgActive(); | 209 | bool pmsgActiveAfter__android_log_close = isPmsgActive(); |
206 | bool logdwActiveAfter__android_log_close = isLogdwActive(); | ||
207 | EXPECT_FALSE(pmsgActiveAfter__android_log_close); | 210 | EXPECT_FALSE(pmsgActiveAfter__android_log_close); |
211 | #endif /* NO_PSTORE */ | ||
212 | bool logdwActiveAfter__android_log_close = isLogdwActive(); | ||
208 | EXPECT_FALSE(logdwActiveAfter__android_log_close); | 213 | EXPECT_FALSE(logdwActiveAfter__android_log_close); |
209 | } | 214 | } |
210 | #endif | 215 | #endif |
@@ -213,9 +218,11 @@ TEST(liblog, __android_log_btwrite__android_logger_list_read) { | |||
213 | EXPECT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts1, sizeof(ts1))); | 218 | EXPECT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts1, sizeof(ts1))); |
214 | #ifdef USING_LOGGER_DEFAULT | 219 | #ifdef USING_LOGGER_DEFAULT |
215 | if (getuid() == AID_ROOT) { | 220 | if (getuid() == AID_ROOT) { |
216 | pmsgActiveAfter__android_log_btwrite = isPmsgActive(); | 221 | #ifndef NO_PSTORE |
217 | logdwActiveAfter__android_log_btwrite = isLogdwActive(); | 222 | bool pmsgActiveAfter__android_log_btwrite = isPmsgActive(); |
218 | EXPECT_TRUE(pmsgActiveAfter__android_log_btwrite); | 223 | EXPECT_TRUE(pmsgActiveAfter__android_log_btwrite); |
224 | #endif /* NO_PSTORE */ | ||
225 | logdwActiveAfter__android_log_btwrite = isLogdwActive(); | ||
219 | EXPECT_TRUE(logdwActiveAfter__android_log_btwrite); | 226 | EXPECT_TRUE(logdwActiveAfter__android_log_btwrite); |
220 | } | 227 | } |
221 | #endif | 228 | #endif |
@@ -3036,12 +3043,15 @@ TEST(liblog, android_log_write_list_buffer) { | |||
3036 | 3043 | ||
3037 | #ifdef USING_LOGGER_DEFAULT // Do not retest pmsg functionality | 3044 | #ifdef USING_LOGGER_DEFAULT // Do not retest pmsg functionality |
3038 | #ifdef __ANDROID__ | 3045 | #ifdef __ANDROID__ |
3046 | #ifndef NO_PSTORE | ||
3039 | static const char __pmsg_file[] = | 3047 | static const char __pmsg_file[] = |
3040 | "/data/william-shakespeare/MuchAdoAboutNothing.txt"; | 3048 | "/data/william-shakespeare/MuchAdoAboutNothing.txt"; |
3049 | #endif /* NO_PSTORE */ | ||
3041 | #endif | 3050 | #endif |
3042 | 3051 | ||
3043 | TEST(liblog, __android_log_pmsg_file_write) { | 3052 | TEST(liblog, __android_log_pmsg_file_write) { |
3044 | #ifdef __ANDROID__ | 3053 | #ifdef __ANDROID__ |
3054 | #ifndef NO_PSTORE | ||
3045 | __android_log_close(); | 3055 | __android_log_close(); |
3046 | if (getuid() == AID_ROOT) { | 3056 | if (getuid() == AID_ROOT) { |
3047 | tested__android_log_close = true; | 3057 | tested__android_log_close = true; |
@@ -3092,12 +3102,16 @@ TEST(liblog, __android_log_pmsg_file_write) { | |||
3092 | EXPECT_TRUE(pmsgActiveAfter__android_pmsg_file_write); | 3102 | EXPECT_TRUE(pmsgActiveAfter__android_pmsg_file_write); |
3093 | EXPECT_TRUE(logdwActiveAfter__android_pmsg_file_write); | 3103 | EXPECT_TRUE(logdwActiveAfter__android_pmsg_file_write); |
3094 | } | 3104 | } |
3105 | #else /* NO_PSTORE */ | ||
3106 | GTEST_LOG_(INFO) << "This test does nothing because of NO_PSTORE.\n"; | ||
3107 | #endif /* NO_PSTORE */ | ||
3095 | #else | 3108 | #else |
3096 | GTEST_LOG_(INFO) << "This test does nothing.\n"; | 3109 | GTEST_LOG_(INFO) << "This test does nothing.\n"; |
3097 | #endif | 3110 | #endif |
3098 | } | 3111 | } |
3099 | 3112 | ||
3100 | #ifdef __ANDROID__ | 3113 | #ifdef __ANDROID__ |
3114 | #ifndef NO_PSTORE | ||
3101 | static ssize_t __pmsg_fn(log_id_t logId, char prio, const char* filename, | 3115 | static ssize_t __pmsg_fn(log_id_t logId, char prio, const char* filename, |
3102 | const char* buf, size_t len, void* arg) { | 3116 | const char* buf, size_t len, void* arg) { |
3103 | EXPECT_TRUE(NULL == arg); | 3117 | EXPECT_TRUE(NULL == arg); |
@@ -3118,10 +3132,12 @@ static ssize_t __pmsg_fn(log_id_t logId, char prio, const char* filename, | |||
3118 | ? -ENOEXEC | 3132 | ? -ENOEXEC |
3119 | : 1; | 3133 | : 1; |
3120 | } | 3134 | } |
3135 | #endif /* NO_PSTORE */ | ||
3121 | #endif | 3136 | #endif |
3122 | 3137 | ||
3123 | TEST(liblog, __android_log_pmsg_file_read) { | 3138 | TEST(liblog, __android_log_pmsg_file_read) { |
3124 | #ifdef __ANDROID__ | 3139 | #ifdef __ANDROID__ |
3140 | #ifndef NO_PSTORE | ||
3125 | signaled = 0; | 3141 | signaled = 0; |
3126 | 3142 | ||
3127 | __android_log_close(); | 3143 | __android_log_close(); |
@@ -3155,6 +3171,9 @@ TEST(liblog, __android_log_pmsg_file_read) { | |||
3155 | 3171 | ||
3156 | EXPECT_LT(0, ret); | 3172 | EXPECT_LT(0, ret); |
3157 | EXPECT_EQ(1U, signaled); | 3173 | EXPECT_EQ(1U, signaled); |
3174 | #else /* NO_PSTORE */ | ||
3175 | GTEST_LOG_(INFO) << "This test does nothing because of NO_PSTORE.\n"; | ||
3176 | #endif /* NO_PSTORE */ | ||
3158 | #else | 3177 | #else |
3159 | GTEST_LOG_(INFO) << "This test does nothing.\n"; | 3178 | GTEST_LOG_(INFO) << "This test does nothing.\n"; |
3160 | #endif | 3179 | #endif |