1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
// Build the unit tests.
package {
default_team: "trendy_team_art_mainline",
// http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// the below license kinds from "libnativehelper_license":
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["libnativehelper_license"],
}
cc_defaults {
name: "libnativehelper_common_test_defaults",
cflags: [
// Base set of cflags used by all things ART.
"-fno-rtti",
"-ggdb3",
"-Wall",
"-Werror",
"-Wextra",
"-Wstrict-aliasing",
"-fstrict-aliasing",
"-Wunreachable-code",
"-Wredundant-decls",
"-Wshadow",
"-Wunused",
"-fvisibility=protected",
// Warn about thread safety violations with clang.
"-Wthread-safety",
"-Wthread-safety-negative",
// Warn if switch fallthroughs aren't annotated.
"-Wimplicit-fallthrough",
// Enable float equality warnings.
"-Wfloat-equal",
// Enable warning of converting ints to void*.
"-Wint-to-void-pointer-cast",
// Enable warning for deprecated language features.
"-Wdeprecated",
// Disable warning from external/libcxxabi/include/cxxabi.h
"-Wno-deprecated-dynamic-exception-spec",
// Enable warning for unreachable break & return.
"-Wunreachable-code-break",
"-Wunreachable-code-return",
// Enable thread annotations for std::mutex, etc.
"-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
],
tidy: true,
}
cc_defaults {
name: "libnativehelper_unit_test_defaults",
defaults: ["libnativehelper_common_test_defaults"],
host_supported: true,
test_options: {
unit_test: true,
},
}
cc_test {
name: "libnativehelper_tests",
defaults: ["libnativehelper_unit_test_defaults"],
test_suites: ["general-tests"],
srcs: [
"scoped_local_frame_test.cpp",
"scoped_local_ref_test.cpp",
"scoped_primitive_array_test.cpp",
"libnativehelper_api_test.c",
"JniSafeRegisterNativeMethods_test.cpp",
],
shared_libs: ["libnativehelper"],
}
cc_test {
name: "libnativehelper_lazy_tests",
defaults: ["libnativehelper_unit_test_defaults"],
test_suites: ["general-tests"],
srcs: ["libnativehelper_lazy_test.cpp"],
shared_libs: ["liblog"],
static_libs: ["libnativehelper_lazy"],
}
// Tests for internal functions that aren't present in the APEX stub API. Use
// `bootstrap:true` to bypass the stub library. This test won't link when
// prebuilts are preferred, because we cannot link against the source variant
// then.
// TODO(b/180107266): Enable in TEST_MAPPING. Also use a better way than
// `bootstrap:true` - `test_for` ought to work but fails because the test is
// host enabled so host variants of the APEXes are expected.
cc_test {
name: "libnativehelper_internal_tests",
defaults: [
"libnativehelper_unit_test_defaults",
],
srcs: [
"ExpandableString_test.cpp",
"JniInvocation_test.cpp",
],
bootstrap: true,
shared_libs: ["libnativehelper"],
}
cc_library {
name: "libnativehelper_internal_tests_jni",
defaults: [
"libnativehelper_common_test_defaults",
],
host_supported: false,
srcs: [
"libnativehelper_test.cpp",
],
shared_libs: [
"libnativehelper",
"liblog",
],
static_libs: [
"libbase",
"libgmock",
"libnativetesthelper_jni",
],
}
android_test {
name: "LibnativehelperInternalTestCases",
srcs: [
"src/**/*.java",
],
jni_libs: [
"libnativehelper_internal_tests_jni",
],
static_libs: [
"ctstestrunner-axt",
"nativetesthelper",
],
manifest: "AndroidManifest.xml",
test_suites: ["general-tests"],
}
|