diff options
author | Mark Salyzyn <salyzyn@google.com> | 2016-02-11 14:20:24 -0800 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2016-02-12 08:23:37 -0800 |
commit | 67522d05df61e7757e1ff08ba0b7ad0f19406ec0 (patch) | |
tree | 17d3a29da691804496021a0ef73728c9aab70f9d /tests/kernel.config | |
parent | f3a337aa9ffab5da6133f0ace06701559c4fde58 (diff) | |
download | extras-67522d05df61e7757e1ff08ba0b7ad0f19406ec0.tar.gz |
cts: android.kernel.config
- Added plumbing for CTS tests
- Divide Required into CTS and gTest and
Recommended into gTest
- Added check of CONFIG_ANDROID_LOGGER
- test typically completes after 3ms
Bug: 19173869
Change-Id: I13a92081bfa9b53abb69923b160b82e3be2142ab
Diffstat (limited to 'tests/kernel.config')
-rw-r--r-- | tests/kernel.config/Android.mk | 49 | ||||
-rw-r--r-- | tests/kernel.config/AndroidTest.xml | 26 | ||||
-rw-r--r-- | tests/kernel.config/logger_test.cpp | 29 | ||||
-rw-r--r-- | tests/kernel.config/sysvipc_test.cpp | 9 |
4 files changed, 109 insertions, 4 deletions
diff --git a/tests/kernel.config/Android.mk b/tests/kernel.config/Android.mk index b97ec939..7a02521a 100644 --- a/tests/kernel.config/Android.mk +++ b/tests/kernel.config/Android.mk @@ -14,16 +14,57 @@ test_c_flags := \ -fno-builtin \ -std=gnu++11 -test_src_files := \ +# Required Tests +cts_src_files := \ multicast_test.cpp \ - mmc_max_speed_test.cpp \ pstore_test.cpp \ - sysvipc_test.cpp + sysvipc_test.cpp \ + logger_test.cpp + +# Required plus Recommended Tests +test_src_files := \ + $(cts_src_files) \ + mmc_max_speed_test.cpp \ + +cts_executable := CtsKernelConfigTestCases include $(CLEAR_VARS) LOCAL_MODULE := kernel-config-unit-tests LOCAL_MODULE_TAGS := tests -LOCAL_CFLAGS += $(test_c_flags) +LOCAL_CFLAGS := $(test_c_flags) +LOCAL_CFLAGS := -DHAS_KCMP LOCAL_SRC_FILES := $(test_src_files) include $(BUILD_NATIVE_TEST) +include $(CLEAR_VARS) +LOCAL_MODULE := $(cts_executable) +LOCAL_MODULE_TAGS := optional +LOCAL_CFLAGS := $(test_c_flags) +LOCAL_CFLAGS := -DHAS_KCMP +LOCAL_SRC_FILES := $(cts_src_files) +LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest +LOCAL_MULTILIB := both +LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32 +LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64 +LOCAL_STATIC_LIBRARIES := libgtest libgtest_main + +LOCAL_COMPATIBILITY_SUITE := cts_v2 +LOCAL_CTS_TEST_PACKAGE := android.kernel.config +include $(BUILD_CTS_EXECUTABLE) + +ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64)) + +include $(CLEAR_VARS) +LOCAL_MODULE := $(cts_executable)_list +LOCAL_MODULE_TAGS := optional +LOCAL_CFLAGS := $(test_c_flags) +LOCAL_C_INCLUDES := external/gtest/include +LOCAL_SRC_FILES := $(cts_src_files) +LOCAL_MULTILIB := both +LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE) +LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64 +LOCAL_CXX_STL := libc++ +LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk +include $(BUILD_HOST_NATIVE_TEST) + +endif # ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64)) diff --git a/tests/kernel.config/AndroidTest.xml b/tests/kernel.config/AndroidTest.xml new file mode 100644 index 00000000..4fe3192c --- /dev/null +++ b/tests/kernel.config/AndroidTest.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2016 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<configuration description="Config for CTS Kernel Config test cases"> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> + <option name="cleanup" value="true" /> + <option name="push" value="CtsKernelConfigTestCases->/data/local/tmp/CtsKernelConfigTestCases" /> + <option name="append-bitness" value="true" /> + </target_preparer> + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp" /> + <option name="module-name" value="CtsKernelConfigTestCases" /> + </test> +</configuration> diff --git a/tests/kernel.config/logger_test.cpp b/tests/kernel.config/logger_test.cpp new file mode 100644 index 00000000..f0874d85 --- /dev/null +++ b/tests/kernel.config/logger_test.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include <unistd.h> + +#include <gtest/gtest.h> + +TEST(kernel_config, NOT_CONFIG_ANDROID_LOGGER) { + EXPECT_NE(0, access("/dev/log/main", F_OK)); + EXPECT_NE(0, access("/dev/log_main", F_OK)); + EXPECT_NE(0, access("/dev/log/radio", F_OK)); + EXPECT_NE(0, access("/dev/log_radio", F_OK)); + EXPECT_NE(0, access("/dev/log/events", F_OK)); + EXPECT_NE(0, access("/dev/log_events", F_OK)); + EXPECT_NE(0, access("/dev/log/system", F_OK)); + EXPECT_NE(0, access("/dev/log_system", F_OK)); +} diff --git a/tests/kernel.config/sysvipc_test.cpp b/tests/kernel.config/sysvipc_test.cpp index d62b91cc..49952f01 100644 --- a/tests/kernel.config/sysvipc_test.cpp +++ b/tests/kernel.config/sysvipc_test.cpp @@ -14,22 +14,31 @@ * limitations under the License. */ #include <errno.h> +#ifdef HAS_KCMP #include <linux/kcmp.h> #include <sys/syscall.h> +#endif #include <unistd.h> #include <gtest/gtest.h> +#ifdef HAS_KCMP int kcmp(pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2) { return syscall(SYS_kcmp, pid1, pid2, type, 0, idx1, idx2); } +#endif TEST(kernel_config, NOT_CONFIG_SYSVIPC) { +#ifdef HAS_KCMP pid_t pid = getpid(); int ret = kcmp(pid, pid, KCMP_SYSVSEM, 0, 0); int error = (ret == -1) ? (errno == ENOSYS) ? EOPNOTSUPP : errno : 0; EXPECT_EQ(-1, kcmp(pid, pid, KCMP_SYSVSEM, 0, 0)); EXPECT_EQ(EOPNOTSUPP, error); +#endif EXPECT_EQ(-1, access("/proc/sysvipc", F_OK)); + EXPECT_EQ(-1, access("/proc/sysvipc/msg", F_OK)); + EXPECT_EQ(-1, access("/proc/sysvipc/sem", F_OK)); + EXPECT_EQ(-1, access("/proc/sysvipc/shm", F_OK)); } |