Remove pstore related unit tests from CTS

Pstore test cases should not belong to CTS.
The test cases should be a part of GTS if really required.

Test: manual
Bug: 66431569
Bug: 63969981
Bug: 63913130
Signed-off-by: Srinavasa Nagaraju <Srinavasa.Nagaraju@sony.com>
Signed-off-by: Yoshitaka Seto <yoshitaka.seto@sony.com>
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Tested-by: Srinavasa Nagaraju <Srinavasa.Nagaraju@sony.com>
Change-Id: Icd326403711ad268ce28a3863045fc9b2f211461
This commit is contained in:
Yoshitaka Seto 2017-07-31 17:44:36 +09:00 committed by Mark Salyzyn
parent 5cf1f6a8c8
commit 5dec8e22c3
2 changed files with 31 additions and 9 deletions

View file

@ -54,7 +54,7 @@ test_c_flags := \
-Werror \ -Werror \
-fno-builtin \ -fno-builtin \
test_src_files := \ cts_src_files := \
libc_test.cpp \ libc_test.cpp \
liblog_test_default.cpp \ liblog_test_default.cpp \
liblog_test_local.cpp \ liblog_test_local.cpp \
@ -67,6 +67,9 @@ test_src_files := \
log_time_test.cpp \ log_time_test.cpp \
log_wrap_test.cpp log_wrap_test.cpp
test_src_files := \
$(cts_src_files) \
# Build tests for the device (with .so). Run with: # Build tests for the device (with .so). Run with:
# adb shell /data/nativetest/liblog-unit-tests/liblog-unit-tests # adb shell /data/nativetest/liblog-unit-tests/liblog-unit-tests
include $(CLEAR_VARS) include $(CLEAR_VARS)
@ -82,8 +85,8 @@ cts_executable := CtsLiblogTestCases
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := $(cts_executable) LOCAL_MODULE := $(cts_executable)
LOCAL_MODULE_TAGS := tests LOCAL_MODULE_TAGS := tests
LOCAL_CFLAGS += $(test_c_flags) LOCAL_CFLAGS += $(test_c_flags) -DNO_PSTORE
LOCAL_SRC_FILES := $(test_src_files) LOCAL_SRC_FILES := $(cts_src_files)
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest
LOCAL_MULTILIB := both LOCAL_MULTILIB := both
LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32 LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32

View file

@ -116,6 +116,7 @@ static std::string popenToString(std::string command) {
return ret; return ret;
} }
#ifndef NO_PSTORE
static bool isPmsgActive() { static bool isPmsgActive() {
pid_t pid = getpid(); pid_t pid = getpid();
@ -125,6 +126,7 @@ static bool isPmsgActive() {
return std::string::npos != myPidFds.find(" -> /dev/pmsg0"); return std::string::npos != myPidFds.find(" -> /dev/pmsg0");
} }
#endif /* NO_PSTORE */
static bool isLogdwActive() { static bool isLogdwActive() {
std::string logdwSignature = std::string logdwSignature =
@ -189,22 +191,25 @@ TEST(liblog, __android_log_btwrite__android_logger_list_read) {
EXPECT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts, sizeof(ts))); EXPECT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts, sizeof(ts)));
#ifdef USING_LOGGER_DEFAULT #ifdef USING_LOGGER_DEFAULT
// Check that we can close and reopen the logger // Check that we can close and reopen the logger
bool pmsgActiveAfter__android_log_btwrite;
bool logdwActiveAfter__android_log_btwrite; bool logdwActiveAfter__android_log_btwrite;
if (getuid() == AID_ROOT) { if (getuid() == AID_ROOT) {
tested__android_log_close = true; tested__android_log_close = true;
pmsgActiveAfter__android_log_btwrite = isPmsgActive(); #ifndef NO_PSTORE
logdwActiveAfter__android_log_btwrite = isLogdwActive(); bool pmsgActiveAfter__android_log_btwrite = isPmsgActive();
EXPECT_TRUE(pmsgActiveAfter__android_log_btwrite); EXPECT_TRUE(pmsgActiveAfter__android_log_btwrite);
#endif /* NO_PSTORE */
logdwActiveAfter__android_log_btwrite = isLogdwActive();
EXPECT_TRUE(logdwActiveAfter__android_log_btwrite); EXPECT_TRUE(logdwActiveAfter__android_log_btwrite);
} else if (!tested__android_log_close) { } else if (!tested__android_log_close) {
fprintf(stderr, "WARNING: can not test __android_log_close()\n"); fprintf(stderr, "WARNING: can not test __android_log_close()\n");
} }
__android_log_close(); __android_log_close();
if (getuid() == AID_ROOT) { if (getuid() == AID_ROOT) {
#ifndef NO_PSTORE
bool pmsgActiveAfter__android_log_close = isPmsgActive(); bool pmsgActiveAfter__android_log_close = isPmsgActive();
bool logdwActiveAfter__android_log_close = isLogdwActive();
EXPECT_FALSE(pmsgActiveAfter__android_log_close); EXPECT_FALSE(pmsgActiveAfter__android_log_close);
#endif /* NO_PSTORE */
bool logdwActiveAfter__android_log_close = isLogdwActive();
EXPECT_FALSE(logdwActiveAfter__android_log_close); EXPECT_FALSE(logdwActiveAfter__android_log_close);
} }
#endif #endif
@ -213,9 +218,11 @@ TEST(liblog, __android_log_btwrite__android_logger_list_read) {
EXPECT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts1, sizeof(ts1))); EXPECT_LT(0, __android_log_btwrite(0, EVENT_TYPE_LONG, &ts1, sizeof(ts1)));
#ifdef USING_LOGGER_DEFAULT #ifdef USING_LOGGER_DEFAULT
if (getuid() == AID_ROOT) { if (getuid() == AID_ROOT) {
pmsgActiveAfter__android_log_btwrite = isPmsgActive(); #ifndef NO_PSTORE
logdwActiveAfter__android_log_btwrite = isLogdwActive(); bool pmsgActiveAfter__android_log_btwrite = isPmsgActive();
EXPECT_TRUE(pmsgActiveAfter__android_log_btwrite); EXPECT_TRUE(pmsgActiveAfter__android_log_btwrite);
#endif /* NO_PSTORE */
logdwActiveAfter__android_log_btwrite = isLogdwActive();
EXPECT_TRUE(logdwActiveAfter__android_log_btwrite); EXPECT_TRUE(logdwActiveAfter__android_log_btwrite);
} }
#endif #endif
@ -3036,12 +3043,15 @@ TEST(liblog, android_log_write_list_buffer) {
#ifdef USING_LOGGER_DEFAULT // Do not retest pmsg functionality #ifdef USING_LOGGER_DEFAULT // Do not retest pmsg functionality
#ifdef __ANDROID__ #ifdef __ANDROID__
#ifndef NO_PSTORE
static const char __pmsg_file[] = static const char __pmsg_file[] =
"/data/william-shakespeare/MuchAdoAboutNothing.txt"; "/data/william-shakespeare/MuchAdoAboutNothing.txt";
#endif /* NO_PSTORE */
#endif #endif
TEST(liblog, __android_log_pmsg_file_write) { TEST(liblog, __android_log_pmsg_file_write) {
#ifdef __ANDROID__ #ifdef __ANDROID__
#ifndef NO_PSTORE
__android_log_close(); __android_log_close();
if (getuid() == AID_ROOT) { if (getuid() == AID_ROOT) {
tested__android_log_close = true; tested__android_log_close = true;
@ -3092,12 +3102,16 @@ TEST(liblog, __android_log_pmsg_file_write) {
EXPECT_TRUE(pmsgActiveAfter__android_pmsg_file_write); EXPECT_TRUE(pmsgActiveAfter__android_pmsg_file_write);
EXPECT_TRUE(logdwActiveAfter__android_pmsg_file_write); EXPECT_TRUE(logdwActiveAfter__android_pmsg_file_write);
} }
#else /* NO_PSTORE */
GTEST_LOG_(INFO) << "This test does nothing because of NO_PSTORE.\n";
#endif /* NO_PSTORE */
#else #else
GTEST_LOG_(INFO) << "This test does nothing.\n"; GTEST_LOG_(INFO) << "This test does nothing.\n";
#endif #endif
} }
#ifdef __ANDROID__ #ifdef __ANDROID__
#ifndef NO_PSTORE
static ssize_t __pmsg_fn(log_id_t logId, char prio, const char* filename, static ssize_t __pmsg_fn(log_id_t logId, char prio, const char* filename,
const char* buf, size_t len, void* arg) { const char* buf, size_t len, void* arg) {
EXPECT_TRUE(NULL == arg); EXPECT_TRUE(NULL == arg);
@ -3118,10 +3132,12 @@ static ssize_t __pmsg_fn(log_id_t logId, char prio, const char* filename,
? -ENOEXEC ? -ENOEXEC
: 1; : 1;
} }
#endif /* NO_PSTORE */
#endif #endif
TEST(liblog, __android_log_pmsg_file_read) { TEST(liblog, __android_log_pmsg_file_read) {
#ifdef __ANDROID__ #ifdef __ANDROID__
#ifndef NO_PSTORE
signaled = 0; signaled = 0;
__android_log_close(); __android_log_close();
@ -3155,6 +3171,9 @@ TEST(liblog, __android_log_pmsg_file_read) {
EXPECT_LT(0, ret); EXPECT_LT(0, ret);
EXPECT_EQ(1U, signaled); EXPECT_EQ(1U, signaled);
#else /* NO_PSTORE */
GTEST_LOG_(INFO) << "This test does nothing because of NO_PSTORE.\n";
#endif /* NO_PSTORE */
#else #else
GTEST_LOG_(INFO) << "This test does nothing.\n"; GTEST_LOG_(INFO) << "This test does nothing.\n";
#endif #endif