From 3e963f9df7834f3ca67d9049d5a48a26e680577d Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Wed, 31 Oct 2018 10:32:32 -0700 Subject: [PATCH] Convert more modules to Android.bp Test: cd system/core; mma Test: check for mkbootfs in build artifacts Test: out/host/linux-x86/nativetest64/libcrypto_utils_test/libcrypto_utils_test Test: out/host/linux-x86/nativetest64/libnativebridge-tests/*_test Change-Id: I71141bd85f052d5d86763a8b79b219cc4c46aafb --- cpio/Android.bp | 8 +++ cpio/Android.mk | 16 +---- gatekeeperd/Android.bp | 50 +++++++++++++ gatekeeperd/Android.mk | 47 ------------- gatekeeperd/tests/Android.bp | 34 +++++++++ gatekeeperd/tests/Android.mk | 29 -------- libcrypto_utils/tests/Android.bp | 29 ++++++++ libcrypto_utils/tests/Android.mk | 24 ------- liblog/Android.mk | 3 - liblog/tests/Android.bp | 98 ++++++++++++++++++++++++++ liblog/tests/Android.mk | 116 ------------------------------- libnativebridge/Android.mk | 3 - libnativebridge/tests/Android.bp | 42 +++++++++++ libnativebridge/tests/Android.mk | 60 ---------------- logcat/Android.mk | 5 -- logcat/tests/Android.bp | 59 ++++++++++++++++ logcat/tests/Android.mk | 62 ----------------- logd/Android.mk | 2 - logd/tests/Android.bp | 68 ++++++++++++++++++ logd/tests/Android.mk | 86 ----------------------- 20 files changed, 389 insertions(+), 452 deletions(-) create mode 100644 cpio/Android.bp create mode 100644 gatekeeperd/Android.bp delete mode 100644 gatekeeperd/Android.mk create mode 100644 gatekeeperd/tests/Android.bp delete mode 100644 gatekeeperd/tests/Android.mk create mode 100644 libcrypto_utils/tests/Android.bp delete mode 100644 libcrypto_utils/tests/Android.mk delete mode 100644 liblog/Android.mk create mode 100644 liblog/tests/Android.bp delete mode 100644 liblog/tests/Android.mk delete mode 100644 libnativebridge/Android.mk delete mode 100644 libnativebridge/tests/Android.mk delete mode 100644 logcat/Android.mk create mode 100644 logcat/tests/Android.bp delete mode 100644 logcat/tests/Android.mk create mode 100644 logd/tests/Android.bp delete mode 100644 logd/tests/Android.mk diff --git a/cpio/Android.bp b/cpio/Android.bp new file mode 100644 index 000000000..847e0f1b9 --- /dev/null +++ b/cpio/Android.bp @@ -0,0 +1,8 @@ +// Copyright 2005 The Android Open Source Project + +cc_binary_host { + name: "mkbootfs", + srcs: ["mkbootfs.c"], + cflags: ["-Werror"], + shared_libs: ["libcutils"], +} diff --git a/cpio/Android.mk b/cpio/Android.mk index 2aa7297c7..fc3551b98 100644 --- a/cpio/Android.mk +++ b/cpio/Android.mk @@ -1,17 +1,3 @@ # Copyright 2005 The Android Open Source Project -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - mkbootfs.c - -LOCAL_MODULE := mkbootfs - -LOCAL_CFLAGS := -Werror - -LOCAL_SHARED_LIBRARIES := libcutils - -include $(BUILD_HOST_EXECUTABLE) - -$(call dist-for-goals,dist_files,$(LOCAL_BUILT_MODULE)) +$(call dist-for-goals,dist_files,$(ALL_MODULES.mkbootfs.BUILT)) diff --git a/gatekeeperd/Android.bp b/gatekeeperd/Android.bp new file mode 100644 index 000000000..8e9c7ea00 --- /dev/null +++ b/gatekeeperd/Android.bp @@ -0,0 +1,50 @@ +// +// Copyright (C) 2015 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. +// + +cc_binary { + name: "gatekeeperd", + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + "-Wunused", + ], + srcs: [ + "SoftGateKeeperDevice.cpp", + "IGateKeeperService.cpp", + "gatekeeperd.cpp", + ], + + shared_libs: [ + "libbinder", + "libgatekeeper", + "liblog", + "libhardware", + "libbase", + "libutils", + "libcrypto", + "libkeystore_aidl", + "libkeystore_binder", + "libhidlbase", + "libhidltransport", + "libhwbinder", + "android.hardware.gatekeeper@1.0", + ], + + static_libs: ["libscrypt_static"], + include_dirs: ["external/scrypt/lib/crypto"], + init_rc: ["gatekeeperd.rc"], +} diff --git a/gatekeeperd/Android.mk b/gatekeeperd/Android.mk deleted file mode 100644 index 6d5d1eac4..000000000 --- a/gatekeeperd/Android.mk +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright (C) 2015 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. -# - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_CFLAGS := -Wall -Wextra -Werror -Wunused -LOCAL_SRC_FILES := \ - SoftGateKeeperDevice.cpp \ - IGateKeeperService.cpp \ - gatekeeperd.cpp - -LOCAL_MODULE := gatekeeperd -LOCAL_SHARED_LIBRARIES := \ - libbinder \ - libgatekeeper \ - liblog \ - libhardware \ - libbase \ - libutils \ - libcrypto \ - libkeystore_aidl \ - libkeystore_binder \ - libhidlbase \ - libhidltransport \ - libhwbinder \ - android.hardware.gatekeeper@1.0 \ - -LOCAL_STATIC_LIBRARIES := libscrypt_static -LOCAL_C_INCLUDES := external/scrypt/lib/crypto -LOCAL_INIT_RC := gatekeeperd.rc -include $(BUILD_EXECUTABLE) - -include $(call first-makefiles-under,$(LOCAL_PATH)) diff --git a/gatekeeperd/tests/Android.bp b/gatekeeperd/tests/Android.bp new file mode 100644 index 000000000..d4cf93b60 --- /dev/null +++ b/gatekeeperd/tests/Android.bp @@ -0,0 +1,34 @@ +// +// Copyright (C) 2015 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. +// + +cc_test { + name: "gatekeeperd-unit-tests", + + cflags: [ + "-g", + "-Wall", + "-Werror", + "-Wno-missing-field-initializers", + ], + shared_libs: [ + "libgatekeeper", + "libcrypto", + "libbase", + ], + static_libs: ["libscrypt_static"], + include_dirs: ["external/scrypt/lib/crypto"], + srcs: ["gatekeeper_test.cpp"], +} diff --git a/gatekeeperd/tests/Android.mk b/gatekeeperd/tests/Android.mk deleted file mode 100644 index c38c64be8..000000000 --- a/gatekeeperd/tests/Android.mk +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright (C) 2015 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. -# - -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_MODULE := gatekeeperd-unit-tests -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk -LOCAL_CFLAGS += -g -Wall -Werror -Wno-missing-field-initializers -LOCAL_SHARED_LIBRARIES := libgatekeeper libcrypto libbase -LOCAL_STATIC_LIBRARIES := libscrypt_static -LOCAL_C_INCLUDES := external/scrypt/lib/crypto -LOCAL_SRC_FILES := \ - gatekeeper_test.cpp -include $(BUILD_NATIVE_TEST) - diff --git a/libcrypto_utils/tests/Android.bp b/libcrypto_utils/tests/Android.bp new file mode 100644 index 000000000..5aadfe203 --- /dev/null +++ b/libcrypto_utils/tests/Android.bp @@ -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. +// + +cc_test_host { + name: "libcrypto_utils_test", + srcs: ["android_pubkey_test.cpp"], + cflags: [ + "-Wall", + "-Werror", + "-Wextra", + ], + shared_libs: [ + "libcrypto_utils", + "libcrypto", + ], +} diff --git a/libcrypto_utils/tests/Android.mk b/libcrypto_utils/tests/Android.mk deleted file mode 100644 index ef3d0cf57..000000000 --- a/libcrypto_utils/tests/Android.mk +++ /dev/null @@ -1,24 +0,0 @@ -# -# 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. -# - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_MODULE := libcrypto_utils_test -LOCAL_SRC_FILES := android_pubkey_test.cpp -LOCAL_CFLAGS := -Wall -Werror -Wextra -LOCAL_SHARED_LIBRARIES := libcrypto_utils libcrypto -include $(BUILD_HOST_NATIVE_TEST) diff --git a/liblog/Android.mk b/liblog/Android.mk deleted file mode 100644 index 6c4dff595..000000000 --- a/liblog/Android.mk +++ /dev/null @@ -1,3 +0,0 @@ -LOCAL_PATH := $(my-dir) - -include $(call first-makefiles-under,$(LOCAL_PATH)) diff --git a/liblog/tests/Android.bp b/liblog/tests/Android.bp new file mode 100644 index 000000000..e6a9c0c69 --- /dev/null +++ b/liblog/tests/Android.bp @@ -0,0 +1,98 @@ +// +// Copyright (C) 2013-2014 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. +// + +// ----------------------------------------------------------------------------- +// Benchmarks. +// ----------------------------------------------------------------------------- + +// Build benchmarks for the device. Run with: +// adb shell liblog-benchmarks +cc_benchmark { + name: "liblog-benchmarks", + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + "-fno-builtin", + ], + shared_libs: [ + "liblog", + "libm", + "libbase", + ], + srcs: ["liblog_benchmark.cpp"], +} + +// ----------------------------------------------------------------------------- +// Unit tests. +// ----------------------------------------------------------------------------- + +cc_defaults { + name: "liblog-tests-defaults", + + cflags: [ + "-fstack-protector-all", + "-g", + "-Wall", + "-Wextra", + "-Werror", + "-fno-builtin", + ], + srcs: [ + "libc_test.cpp", + "liblog_test_default.cpp", + "liblog_test_local.cpp", + "liblog_test_stderr.cpp", + "liblog_test_stderr_local.cpp", + "log_id_test.cpp", + "log_radio_test.cpp", + "log_read_test.cpp", + "log_system_test.cpp", + "log_time_test.cpp", + "log_wrap_test.cpp", + ], + shared_libs: [ + "liblog", + "libcutils", + "libbase", + ], +} + +// Build tests for the device (with .so). Run with: +// adb shell /data/nativetest/liblog-unit-tests/liblog-unit-tests +cc_test { + name: "liblog-unit-tests", + defaults: ["liblog-tests-defaults"], +} + +cc_test { + name: "CtsLiblogTestCases", + defaults: ["liblog-tests-defaults"], + multilib: { + lib32: { + suffix: "32", + }, + lib64: { + suffix: "64", + }, + }, + + cflags: ["-DNO_PSTORE"], + test_suites: [ + "cts", + "vts", + ], +} diff --git a/liblog/tests/Android.mk b/liblog/tests/Android.mk deleted file mode 100644 index cfa849ba4..000000000 --- a/liblog/tests/Android.mk +++ /dev/null @@ -1,116 +0,0 @@ -# -# Copyright (C) 2013-2014 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. -# - -LOCAL_PATH := $(call my-dir) - -# ----------------------------------------------------------------------------- -# Benchmarks. -# ----------------------------------------------------------------------------- - -test_module_prefix := liblog- -test_tags := tests - -benchmark_c_flags := \ - -Wall \ - -Wextra \ - -Werror \ - -fno-builtin \ - -benchmark_src_files := \ - liblog_benchmark.cpp - -# Build benchmarks for the device. Run with: -# adb shell liblog-benchmarks -include $(CLEAR_VARS) -LOCAL_MODULE := $(test_module_prefix)benchmarks -LOCAL_MODULE_TAGS := $(test_tags) -LOCAL_CFLAGS += $(benchmark_c_flags) -LOCAL_SHARED_LIBRARIES += liblog libm libbase -LOCAL_SRC_FILES := $(benchmark_src_files) -include $(BUILD_NATIVE_BENCHMARK) - -# ----------------------------------------------------------------------------- -# Unit tests. -# ----------------------------------------------------------------------------- - -test_c_flags := \ - -fstack-protector-all \ - -g \ - -Wall -Wextra \ - -Werror \ - -fno-builtin \ - -cts_src_files := \ - libc_test.cpp \ - liblog_test_default.cpp \ - liblog_test_local.cpp \ - liblog_test_stderr.cpp \ - liblog_test_stderr_local.cpp \ - log_id_test.cpp \ - log_radio_test.cpp \ - log_read_test.cpp \ - log_system_test.cpp \ - log_time_test.cpp \ - log_wrap_test.cpp - -test_src_files := \ - $(cts_src_files) \ - -# Build tests for the device (with .so). Run with: -# adb shell /data/nativetest/liblog-unit-tests/liblog-unit-tests -include $(CLEAR_VARS) -LOCAL_MODULE := $(test_module_prefix)unit-tests -LOCAL_MODULE_TAGS := $(test_tags) -LOCAL_CFLAGS += $(test_c_flags) -LOCAL_SHARED_LIBRARIES := liblog libcutils libbase -LOCAL_SRC_FILES := $(test_src_files) -include $(BUILD_NATIVE_TEST) - -cts_executable := CtsLiblogTestCases - -include $(CLEAR_VARS) -LOCAL_MODULE := $(cts_executable) -LOCAL_MODULE_TAGS := tests -LOCAL_CFLAGS += $(test_c_flags) -DNO_PSTORE -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_SHARED_LIBRARIES := liblog libcutils libbase -LOCAL_STATIC_LIBRARIES := libgtest libgtest_main -LOCAL_COMPATIBILITY_SUITE := cts vts -LOCAL_CTS_TEST_PACKAGE := android.core.liblog -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) -DHOST -LOCAL_C_INCLUDES := external/gtest/include -LOCAL_SRC_FILES := $(test_src_files) -LOCAL_MULTILIB := both -LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE) -LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64 -LOCAL_CXX_STL := libc++ -LOCAL_SHARED_LIBRARIES := liblog libcutils libbase -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk -LOCAL_LDLIBS_linux := -lrt -include $(BUILD_HOST_NATIVE_TEST) - -endif # ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64)) diff --git a/libnativebridge/Android.mk b/libnativebridge/Android.mk deleted file mode 100644 index 3887b1b2f..000000000 --- a/libnativebridge/Android.mk +++ /dev/null @@ -1,3 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -include $(LOCAL_PATH)/tests/Android.mk diff --git a/libnativebridge/tests/Android.bp b/libnativebridge/tests/Android.bp index 9e2e641eb..222bc4c3e 100644 --- a/libnativebridge/tests/Android.bp +++ b/libnativebridge/tests/Android.bp @@ -44,3 +44,45 @@ cc_library_shared { srcs: ["DummyNativeBridge3.cpp"], defaults: ["libnativebridge-dummy-defaults"], } + +// Build the unit tests. +cc_test { + name: "libnativebridge-tests", + host_supported: true, + test_per_src: true, + + cflags: [ + "-Wall", + "-Werror", + ], + + srcs: [ + "CodeCacheCreate_test.cpp", + "CodeCacheExists_test.cpp", + "CodeCacheStatFail_test.cpp", + "CompleteFlow_test.cpp", + "InvalidCharsNativeBridge_test.cpp", + "NativeBridge2Signal_test.cpp", + "NativeBridgeVersion_test.cpp", + "NeedsNativeBridge_test.cpp", + "PreInitializeNativeBridge_test.cpp", + "PreInitializeNativeBridgeFail1_test.cpp", + "PreInitializeNativeBridgeFail2_test.cpp", + "ReSetupNativeBridge_test.cpp", + "UnavailableNativeBridge_test.cpp", + "ValidNameNativeBridge_test.cpp", + "NativeBridge3UnloadLibrary_test.cpp", + "NativeBridge3GetError_test.cpp", + "NativeBridge3IsPathSupported_test.cpp", + "NativeBridge3InitAnonymousNamespace_test.cpp", + "NativeBridge3CreateNamespace_test.cpp", + "NativeBridge3LoadLibraryExt_test.cpp", + ], + + shared_libs: [ + "liblog", + "libnativebridge", + "libnativebridge-dummy", + ], + header_libs: ["libbase_headers"], +} diff --git a/libnativebridge/tests/Android.mk b/libnativebridge/tests/Android.mk deleted file mode 100644 index 4ed6e20e6..000000000 --- a/libnativebridge/tests/Android.mk +++ /dev/null @@ -1,60 +0,0 @@ -# Build the unit tests. -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -# Build the unit tests. -test_src_files := \ - CodeCacheCreate_test.cpp \ - CodeCacheExists_test.cpp \ - CodeCacheStatFail_test.cpp \ - CompleteFlow_test.cpp \ - InvalidCharsNativeBridge_test.cpp \ - NativeBridge2Signal_test.cpp \ - NativeBridgeVersion_test.cpp \ - NeedsNativeBridge_test.cpp \ - PreInitializeNativeBridge_test.cpp \ - PreInitializeNativeBridgeFail1_test.cpp \ - PreInitializeNativeBridgeFail2_test.cpp \ - ReSetupNativeBridge_test.cpp \ - UnavailableNativeBridge_test.cpp \ - ValidNameNativeBridge_test.cpp \ - NativeBridge3UnloadLibrary_test.cpp \ - NativeBridge3GetError_test.cpp \ - NativeBridge3IsPathSupported_test.cpp \ - NativeBridge3InitAnonymousNamespace_test.cpp \ - NativeBridge3CreateNamespace_test.cpp \ - NativeBridge3LoadLibraryExt_test.cpp - - -shared_libraries := \ - liblog \ - libnativebridge \ - libnativebridge-dummy - -header_libraries := \ - libbase_headers - -libnativebridge_tests_common_cflags := \ - -Wall \ - -Werror \ - -$(foreach file,$(test_src_files), \ - $(eval include $(CLEAR_VARS)) \ - $(eval LOCAL_SHARED_LIBRARIES := $(shared_libraries)) \ - $(eval LOCAL_HEADER_LIBRARIES := $(header_libraries)) \ - $(eval LOCAL_SRC_FILES := $(file)) \ - $(eval LOCAL_CFLAGS := $(libnativebridge_tests_common_cflags)) \ - $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \ - $(eval include $(BUILD_NATIVE_TEST)) \ -) - -$(foreach file,$(test_src_files), \ - $(eval include $(CLEAR_VARS)) \ - $(eval LOCAL_SHARED_LIBRARIES := $(shared_libraries)) \ - $(eval LOCAL_HEADER_LIBRARIES := $(header_libraries)) \ - $(eval LOCAL_SRC_FILES := $(file)) \ - $(eval LOCAL_CFLAGS := $(libnativebridge_tests_common_cflags)) \ - $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \ - $(eval include $(BUILD_HOST_NATIVE_TEST)) \ -) diff --git a/logcat/Android.mk b/logcat/Android.mk deleted file mode 100644 index a7169934c..000000000 --- a/logcat/Android.mk +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright 2006-2014 The Android Open Source Project - -LOCAL_PATH := $(call my-dir) - -include $(call first-makefiles-under,$(LOCAL_PATH)) diff --git a/logcat/tests/Android.bp b/logcat/tests/Android.bp new file mode 100644 index 000000000..e1f4d6f75 --- /dev/null +++ b/logcat/tests/Android.bp @@ -0,0 +1,59 @@ +// +// Copyright (C) 2013-2014 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. +// + +cc_defaults { + name: "logcat-tests-defaults", + cflags: [ + "-fstack-protector-all", + "-g", + "-Wall", + "-Wextra", + "-Werror", + "-fno-builtin", + ], +} + +// ----------------------------------------------------------------------------- +// Benchmarks +// ---------------------------------------------------------------------------- + +// Build benchmarks for the device. Run with: +// adb shell /data/nativetest/logcat-benchmarks/logcat-benchmarks +cc_benchmark { + name: "logcat-benchmarks", + defaults: ["logcat-tests-defaults"], + srcs: ["logcat_benchmark.cpp"], + shared_libs: ["libbase"], +} + +// ----------------------------------------------------------------------------- +// Unit tests. +// ----------------------------------------------------------------------------- + +// Build tests for the device (with .so). Run with: +// adb shell /data/nativetest/logcat-unit-tests/logcat-unit-tests +cc_test { + name: "logcat-unit-tests", + defaults: ["logcat-tests-defaults"], + shared_libs: [ + "liblog", + "libbase", + ], + srcs: [ + "logcat_test.cpp", + "logcatd_test.cpp", + ], +} diff --git a/logcat/tests/Android.mk b/logcat/tests/Android.mk deleted file mode 100644 index 66f672492..000000000 --- a/logcat/tests/Android.mk +++ /dev/null @@ -1,62 +0,0 @@ -# -# Copyright (C) 2013-2014 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. -# - -LOCAL_PATH := $(call my-dir) - -test_module_prefix := logcat- -test_tags := tests - -test_c_flags := \ - -fstack-protector-all \ - -g \ - -Wall -Wextra \ - -Werror \ - -fno-builtin \ - -# ----------------------------------------------------------------------------- -# Benchmarks -# ---------------------------------------------------------------------------- - -benchmark_src_files := \ - logcat_benchmark.cpp \ - -# Build benchmarks for the device. Run with: -# adb shell /data/nativetest/logcat-benchmarks/logcat-benchmarks -include $(CLEAR_VARS) -LOCAL_MODULE := $(test_module_prefix)benchmarks -LOCAL_MODULE_TAGS := $(test_tags) -LOCAL_CFLAGS += $(test_c_flags) -LOCAL_SRC_FILES := $(benchmark_src_files) -LOCAL_SHARED_LIBRARIES := libbase -include $(BUILD_NATIVE_BENCHMARK) - -# ----------------------------------------------------------------------------- -# Unit tests. -# ----------------------------------------------------------------------------- - -test_src_files := \ - logcat_test.cpp \ - logcatd_test.cpp \ - -# Build tests for the device (with .so). Run with: -# adb shell /data/nativetest/logcat-unit-tests/logcat-unit-tests -include $(CLEAR_VARS) -LOCAL_MODULE := $(test_module_prefix)unit-tests -LOCAL_MODULE_TAGS := $(test_tags) -LOCAL_CFLAGS += $(test_c_flags) -LOCAL_SHARED_LIBRARIES := liblog libbase -LOCAL_SRC_FILES := $(test_src_files) -include $(BUILD_NATIVE_TEST) diff --git a/logd/Android.mk b/logd/Android.mk index 1bca8919d..b3ce560c8 100644 --- a/logd/Android.mk +++ b/logd/Android.mk @@ -9,5 +9,3 @@ LOCAL_MODULE_TAGS := debug LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/init include $(BUILD_PREBUILT) - -include $(call first-makefiles-under,$(LOCAL_PATH)) diff --git a/logd/tests/Android.bp b/logd/tests/Android.bp new file mode 100644 index 000000000..f15beb223 --- /dev/null +++ b/logd/tests/Android.bp @@ -0,0 +1,68 @@ +// +// Copyright (C) 2014 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. +// + +// ----------------------------------------------------------------------------- +// Unit tests. +// ----------------------------------------------------------------------------- + +cc_defaults { + name: "logd-unit-test-defaults", + + cflags: [ + "-fstack-protector-all", + "-g", + "-Wall", + "-Wextra", + "-Werror", + "-fno-builtin", + + "-DAUDITD_LOG_TAG=1003", + "-DCHATTY_LOG_TAG=1004", + ], + + srcs: ["logd_test.cpp"], + + shared_libs: [ + "libbase", + "libcutils", + "liblog", + "libselinux", + ], +} + +// Build tests for the logger. Run with: +// adb shell /data/nativetest/logd-unit-tests/logd-unit-tests +cc_test { + name: "logd-unit-tests", + defaults: ["logd-unit-test-defaults"], +} + +cc_test { + name: "CtsLogdTestCases", + defaults: ["logd-unit-test-defaults"], + multilib: { + lib32: { + suffix: "32", + }, + lib64: { + suffix: "64", + }, + }, + test_suites: [ + "cts", + "vts", + ], +} diff --git a/logd/tests/Android.mk b/logd/tests/Android.mk deleted file mode 100644 index a0875ea99..000000000 --- a/logd/tests/Android.mk +++ /dev/null @@ -1,86 +0,0 @@ -# -# Copyright (C) 2014 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. -# - -LOCAL_PATH := $(call my-dir) - -# ----------------------------------------------------------------------------- -# Benchmarks. (see ../../liblog/tests) -# ----------------------------------------------------------------------------- - -test_module_prefix := logd- -test_tags := tests - -# ----------------------------------------------------------------------------- -# Unit tests. -# ----------------------------------------------------------------------------- - -event_flag := -DAUDITD_LOG_TAG=1003 -DCHATTY_LOG_TAG=1004 - -test_c_flags := \ - -fstack-protector-all \ - -g \ - -Wall -Wextra \ - -Werror \ - -fno-builtin \ - $(event_flag) - -test_src_files := \ - logd_test.cpp - -# Build tests for the logger. Run with: -# adb shell /data/nativetest/logd-unit-tests/logd-unit-tests -include $(CLEAR_VARS) -LOCAL_MODULE := $(test_module_prefix)unit-tests -LOCAL_MODULE_TAGS := $(test_tags) -LOCAL_CFLAGS += $(test_c_flags) -LOCAL_SHARED_LIBRARIES := libbase libcutils liblog libselinux -LOCAL_SRC_FILES := $(test_src_files) -include $(BUILD_NATIVE_TEST) - -cts_executable := CtsLogdTestCases - -include $(CLEAR_VARS) -LOCAL_MODULE := $(cts_executable) -LOCAL_MODULE_TAGS := tests -LOCAL_CFLAGS += $(test_c_flags) -LOCAL_SRC_FILES := $(test_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_SHARED_LIBRARIES := libbase libcutils liblog libselinux -LOCAL_STATIC_LIBRARIES := libgtest libgtest_main -LOCAL_COMPATIBILITY_SUITE := cts vts -LOCAL_CTS_TEST_PACKAGE := android.core.logd -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) -DHOST -LOCAL_C_INCLUDES := external/gtest/include -LOCAL_SRC_FILES := $(test_src_files) -LOCAL_MULTILIB := both -LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE) -LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64 -LOCAL_CXX_STL := libc++ -LOCAL_SHARED_LIBRARIES := libbase libcutils liblog -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))