Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 1 | // Copyright 2016 Google Inc. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package cc |
| 16 | |
| 17 | import ( |
| 18 | "path/filepath" |
nelsonli | 0d7111e | 2019-09-17 16:35:23 +0800 | [diff] [blame] | 19 | "strconv" |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 20 | "strings" |
| 21 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 22 | "android/soong/android" |
Colin Cross | 303e21f | 2018-08-07 16:49:25 -0700 | [diff] [blame] | 23 | "android/soong/tradefed" |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 24 | ) |
| 25 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 26 | type TestProperties struct { |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 27 | // if set, build against the gtest library. Defaults to true. |
Colin Cross | 600c9df | 2016-09-13 12:26:16 -0700 | [diff] [blame] | 28 | Gtest *bool |
Christopher Ferris | 9df92d6 | 2018-08-21 12:40:08 -0700 | [diff] [blame] | 29 | |
| 30 | // if set, use the isolated gtest runner. Defaults to false. |
| 31 | Isolated *bool |
Jiyong Park | 62304bb | 2020-04-13 16:19:48 +0900 | [diff] [blame] | 32 | |
| 33 | // List of APEXes that this module tests. The module has access to |
| 34 | // the private part of the listed APEXes even when it is not included in the |
| 35 | // APEXes. |
| 36 | Test_for []string |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 37 | } |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 38 | |
yelinhsieh | 9fc6040 | 2018-10-01 19:23:14 +0800 | [diff] [blame] | 39 | // Test option struct. |
| 40 | type TestOptions struct { |
| 41 | // The UID that you want to run the test as on a device. |
| 42 | Run_test_as *string |
David Srbecky | 519db27 | 2020-06-18 18:07:00 +0100 | [diff] [blame^] | 43 | // A list of free-formed strings without spaces that categorize the test. |
| 44 | Test_suite_tag []string |
yelinhsieh | 9fc6040 | 2018-10-01 19:23:14 +0800 | [diff] [blame] | 45 | } |
| 46 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 47 | type TestBinaryProperties struct { |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 48 | // Create a separate binary for each source file. Useful when there is |
| 49 | // global state that can not be torn down and reset between each test suite. |
| 50 | Test_per_src *bool |
Dan Willemsen | 3340d60 | 2016-12-27 14:40:40 -0800 | [diff] [blame] | 51 | |
| 52 | // Disables the creation of a test-specific directory when used with |
| 53 | // relative_install_path. Useful if several tests need to be in the same |
| 54 | // directory, but test_per_src doesn't work. |
| 55 | No_named_install_directory *bool |
Colin Cross | faeb7aa | 2017-02-01 14:12:44 -0800 | [diff] [blame] | 56 | |
| 57 | // list of files or filegroup modules that provide data that should be installed alongside |
| 58 | // the test |
Dan Shi | 67a8834 | 2020-02-25 16:34:39 -0800 | [diff] [blame] | 59 | Data []string `android:"path,arch_variant"` |
Colin Cross | a929db0 | 2017-03-27 16:27:50 -0700 | [diff] [blame] | 60 | |
| 61 | // list of compatibility suites (for example "cts", "vts") that the module should be |
| 62 | // installed into. |
Dan Willemsen | 15d54d5 | 2017-09-18 16:49:28 -0700 | [diff] [blame] | 63 | Test_suites []string `android:"arch_variant"` |
Julien Desprez | e146e39 | 2018-08-02 15:00:46 -0700 | [diff] [blame] | 64 | |
| 65 | // the name of the test configuration (for example "AndroidTest.xml") that should be |
| 66 | // installed with the module. |
Colin Cross | 27b922f | 2019-03-04 22:35:41 -0800 | [diff] [blame] | 67 | Test_config *string `android:"path,arch_variant"` |
Jack He | 3333889 | 2018-09-19 02:21:28 -0700 | [diff] [blame] | 68 | |
| 69 | // the name of the test configuration template (for example "AndroidTestTemplate.xml") that |
| 70 | // should be installed with the module. |
Colin Cross | 27b922f | 2019-03-04 22:35:41 -0800 | [diff] [blame] | 71 | Test_config_template *string `android:"path,arch_variant"` |
yelinhsieh | 9fc6040 | 2018-10-01 19:23:14 +0800 | [diff] [blame] | 72 | |
| 73 | // Test options. |
| 74 | Test_options TestOptions |
Dan Shi | 37ee3b8 | 2019-06-06 16:23:32 -0700 | [diff] [blame] | 75 | |
| 76 | // Add RootTargetPreparer to auto generated test config. This guarantees the test to run |
| 77 | // with root permission. |
| 78 | Require_root *bool |
Dan Shi | 20ccd21 | 2019-08-27 10:37:24 -0700 | [diff] [blame] | 79 | |
| 80 | // Add RunCommandTargetPreparer to stop framework before the test and start it after the test. |
| 81 | Disable_framework *bool |
nelsonli | 0d7111e | 2019-09-17 16:35:23 +0800 | [diff] [blame] | 82 | |
| 83 | // Add MinApiLevelModuleController to auto generated test config. If the device property of |
| 84 | // "ro.product.first_api_level" < Test_min_api_level, then skip this module. |
| 85 | Test_min_api_level *int64 |
| 86 | |
| 87 | // Add MinApiLevelModuleController to auto generated test config. If the device property of |
| 88 | // "ro.build.version.sdk" < Test_min_sdk_version, then skip this module. |
| 89 | Test_min_sdk_version *int64 |
Dan Shi | 6ffaaa8 | 2019-09-26 11:41:36 -0700 | [diff] [blame] | 90 | |
| 91 | // Flag to indicate whether or not to create test config automatically. If AndroidTest.xml |
| 92 | // doesn't exist next to the Android.bp, this attribute doesn't need to be set to true |
| 93 | // explicitly. |
| 94 | Auto_gen_config *bool |
easoncylee | 1e3fdcd | 2020-04-30 10:08:33 +0800 | [diff] [blame] | 95 | |
| 96 | // Add parameterized mainline modules to auto generated test config. The options will be |
| 97 | // handled by TradeFed to download and install the specified modules on the device. |
| 98 | Test_mainline_modules []string |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | func init() { |
Steven Moreland | 87c9d7b | 2017-11-02 21:38:28 -0700 | [diff] [blame] | 102 | android.RegisterModuleType("cc_test", TestFactory) |
| 103 | android.RegisterModuleType("cc_test_library", TestLibraryFactory) |
| 104 | android.RegisterModuleType("cc_benchmark", BenchmarkFactory) |
| 105 | android.RegisterModuleType("cc_test_host", TestHostFactory) |
| 106 | android.RegisterModuleType("cc_benchmark_host", BenchmarkHostFactory) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 107 | } |
| 108 | |
Patrice Arruda | c249c71 | 2019-03-19 17:00:29 -0700 | [diff] [blame] | 109 | // cc_test generates a test config file and an executable binary file to test |
| 110 | // specific functionality on a device. The executable binary gets an implicit |
| 111 | // static_libs dependency on libgtests unless the gtest flag is set to false. |
Steven Moreland | 87c9d7b | 2017-11-02 21:38:28 -0700 | [diff] [blame] | 112 | func TestFactory() android.Module { |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 113 | module := NewTest(android.HostAndDeviceSupported) |
| 114 | return module.Init() |
| 115 | } |
| 116 | |
Patrice Arruda | c249c71 | 2019-03-19 17:00:29 -0700 | [diff] [blame] | 117 | // cc_test_library creates an archive of files (i.e. .o files) which is later |
| 118 | // referenced by another module (such as cc_test, cc_defaults or cc_test_library) |
| 119 | // for archiving or linking. |
Steven Moreland | 87c9d7b | 2017-11-02 21:38:28 -0700 | [diff] [blame] | 120 | func TestLibraryFactory() android.Module { |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 121 | module := NewTestLibrary(android.HostAndDeviceSupported) |
| 122 | return module.Init() |
| 123 | } |
| 124 | |
Patrice Arruda | c249c71 | 2019-03-19 17:00:29 -0700 | [diff] [blame] | 125 | // cc_benchmark compiles an executable binary that performs benchmark testing |
| 126 | // of a specific component in a device. Additional files such as test suites |
| 127 | // and test configuration are installed on the side of the compiled executed |
| 128 | // binary. |
Steven Moreland | 87c9d7b | 2017-11-02 21:38:28 -0700 | [diff] [blame] | 129 | func BenchmarkFactory() android.Module { |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 130 | module := NewBenchmark(android.HostAndDeviceSupported) |
| 131 | return module.Init() |
| 132 | } |
| 133 | |
Patrice Arruda | c249c71 | 2019-03-19 17:00:29 -0700 | [diff] [blame] | 134 | // cc_test_host compiles a test host binary. |
Steven Moreland | 87c9d7b | 2017-11-02 21:38:28 -0700 | [diff] [blame] | 135 | func TestHostFactory() android.Module { |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 136 | module := NewTest(android.HostSupported) |
| 137 | return module.Init() |
| 138 | } |
| 139 | |
Patrice Arruda | c249c71 | 2019-03-19 17:00:29 -0700 | [diff] [blame] | 140 | // cc_benchmark_host compiles an executable binary that performs benchmark |
| 141 | // testing of a specific component in the host. Additional files such as |
| 142 | // test suites and test configuration are installed on the side of the |
| 143 | // compiled executed binary. |
Steven Moreland | 87c9d7b | 2017-11-02 21:38:28 -0700 | [diff] [blame] | 144 | func BenchmarkHostFactory() android.Module { |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 145 | module := NewBenchmark(android.HostSupported) |
| 146 | return module.Init() |
| 147 | } |
| 148 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 149 | type testPerSrc interface { |
| 150 | testPerSrc() bool |
| 151 | srcs() []string |
Roland Levillain | f2fad97 | 2019-06-28 15:41:19 +0100 | [diff] [blame] | 152 | isAllTestsVariation() bool |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 153 | setSrc(string, string) |
Roland Levillain | f2fad97 | 2019-06-28 15:41:19 +0100 | [diff] [blame] | 154 | unsetSrc() |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | func (test *testBinary) testPerSrc() bool { |
| 158 | return Bool(test.Properties.Test_per_src) |
| 159 | } |
| 160 | |
| 161 | func (test *testBinary) srcs() []string { |
| 162 | return test.baseCompiler.Properties.Srcs |
| 163 | } |
| 164 | |
Liz Kammer | 1c14a21 | 2020-05-12 15:26:55 -0700 | [diff] [blame] | 165 | func (test *testBinary) dataPaths() android.Paths { |
| 166 | return test.data |
| 167 | } |
| 168 | |
Roland Levillain | f2fad97 | 2019-06-28 15:41:19 +0100 | [diff] [blame] | 169 | func (test *testBinary) isAllTestsVariation() bool { |
| 170 | stem := test.binaryDecorator.Properties.Stem |
| 171 | return stem != nil && *stem == "" |
| 172 | } |
| 173 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 174 | func (test *testBinary) setSrc(name, src string) { |
| 175 | test.baseCompiler.Properties.Srcs = []string{src} |
Nan Zhang | 0007d81 | 2017-11-07 10:57:05 -0800 | [diff] [blame] | 176 | test.binaryDecorator.Properties.Stem = StringPtr(name) |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 177 | } |
| 178 | |
Roland Levillain | f2fad97 | 2019-06-28 15:41:19 +0100 | [diff] [blame] | 179 | func (test *testBinary) unsetSrc() { |
| 180 | test.baseCompiler.Properties.Srcs = nil |
| 181 | test.binaryDecorator.Properties.Stem = StringPtr("") |
| 182 | } |
| 183 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 184 | var _ testPerSrc = (*testBinary)(nil) |
| 185 | |
Roland Levillain | 9b5fde9 | 2019-06-28 15:41:19 +0100 | [diff] [blame] | 186 | func TestPerSrcMutator(mctx android.BottomUpMutatorContext) { |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 187 | if m, ok := mctx.Module().(*Module); ok { |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 188 | if test, ok := m.linker.(testPerSrc); ok { |
Roland Levillain | f2fad97 | 2019-06-28 15:41:19 +0100 | [diff] [blame] | 189 | numTests := len(test.srcs()) |
| 190 | if test.testPerSrc() && numTests > 0 { |
Chih-Hung Hsieh | a5f22ed | 2019-10-24 20:47:54 -0700 | [diff] [blame] | 191 | if duplicate, found := android.CheckDuplicate(test.srcs()); found { |
Jooyung Han | a61ff2c | 2019-02-28 18:06:34 +0900 | [diff] [blame] | 192 | mctx.PropertyErrorf("srcs", "found a duplicate entry %q", duplicate) |
| 193 | return |
| 194 | } |
Roland Levillain | f2fad97 | 2019-06-28 15:41:19 +0100 | [diff] [blame] | 195 | testNames := make([]string, numTests) |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 196 | for i, src := range test.srcs() { |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 197 | testNames[i] = strings.TrimSuffix(filepath.Base(src), filepath.Ext(src)) |
| 198 | } |
Roland Levillain | f2fad97 | 2019-06-28 15:41:19 +0100 | [diff] [blame] | 199 | // In addition to creating one variation per test source file, |
| 200 | // create an additional "all tests" variation named "", and have it |
| 201 | // depends on all other test_per_src variations. This is useful to |
| 202 | // create subsequent dependencies of a given module on all |
| 203 | // test_per_src variations created above: by depending on |
| 204 | // variation "", that module will transitively depend on all the |
| 205 | // other test_per_src variations without the need to know their |
| 206 | // name or even their number. |
| 207 | testNames = append(testNames, "") |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 208 | tests := mctx.CreateLocalVariations(testNames...) |
Roland Levillain | f2fad97 | 2019-06-28 15:41:19 +0100 | [diff] [blame] | 209 | all_tests := tests[numTests] |
| 210 | all_tests.(*Module).linker.(testPerSrc).unsetSrc() |
| 211 | // Prevent the "all tests" variation from being installable nor |
| 212 | // exporting to Make, as it won't create any output file. |
| 213 | all_tests.(*Module).Properties.PreventInstall = true |
| 214 | all_tests.(*Module).Properties.HideFromMake = true |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 215 | for i, src := range test.srcs() { |
| 216 | tests[i].(*Module).linker.(testPerSrc).setSrc(testNames[i], src) |
Roland Levillain | f2fad97 | 2019-06-28 15:41:19 +0100 | [diff] [blame] | 217 | mctx.AddInterVariantDependency(testPerSrcDepTag, all_tests, tests[i]) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 218 | } |
| 219 | } |
| 220 | } |
| 221 | } |
| 222 | } |
| 223 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 224 | type testDecorator struct { |
| 225 | Properties TestProperties |
| 226 | linker *baseLinker |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 227 | } |
| 228 | |
Colin Cross | 600c9df | 2016-09-13 12:26:16 -0700 | [diff] [blame] | 229 | func (test *testDecorator) gtest() bool { |
Colin Cross | 38b40df | 2018-04-10 16:14:46 -0700 | [diff] [blame] | 230 | return BoolDefault(test.Properties.Gtest, true) |
Colin Cross | 600c9df | 2016-09-13 12:26:16 -0700 | [diff] [blame] | 231 | } |
| 232 | |
Jiyong Park | 62304bb | 2020-04-13 16:19:48 +0900 | [diff] [blame] | 233 | func (test *testDecorator) testFor() []string { |
| 234 | return test.Properties.Test_for |
| 235 | } |
| 236 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 237 | func (test *testDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags { |
Colin Cross | 600c9df | 2016-09-13 12:26:16 -0700 | [diff] [blame] | 238 | if !test.gtest() { |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 239 | return flags |
| 240 | } |
| 241 | |
Colin Cross | 4af21ed | 2019-11-04 09:37:55 -0800 | [diff] [blame] | 242 | flags.Local.CFlags = append(flags.Local.CFlags, "-DGTEST_HAS_STD_STRING") |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 243 | if ctx.Host() { |
Colin Cross | 4af21ed | 2019-11-04 09:37:55 -0800 | [diff] [blame] | 244 | flags.Local.CFlags = append(flags.Local.CFlags, "-O0", "-g") |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 245 | |
| 246 | switch ctx.Os() { |
| 247 | case android.Windows: |
Colin Cross | 4af21ed | 2019-11-04 09:37:55 -0800 | [diff] [blame] | 248 | flags.Local.CFlags = append(flags.Local.CFlags, "-DGTEST_OS_WINDOWS") |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 249 | case android.Linux: |
Colin Cross | 4af21ed | 2019-11-04 09:37:55 -0800 | [diff] [blame] | 250 | flags.Local.CFlags = append(flags.Local.CFlags, "-DGTEST_OS_LINUX") |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 251 | case android.Darwin: |
Colin Cross | 4af21ed | 2019-11-04 09:37:55 -0800 | [diff] [blame] | 252 | flags.Local.CFlags = append(flags.Local.CFlags, "-DGTEST_OS_MAC") |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 253 | } |
| 254 | } else { |
Colin Cross | 4af21ed | 2019-11-04 09:37:55 -0800 | [diff] [blame] | 255 | flags.Local.CFlags = append(flags.Local.CFlags, "-DGTEST_OS_LINUX_ANDROID") |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 256 | } |
| 257 | |
| 258 | return flags |
| 259 | } |
| 260 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 261 | func (test *testDecorator) linkerDeps(ctx BaseModuleContext, deps Deps) Deps { |
Colin Cross | 600c9df | 2016-09-13 12:26:16 -0700 | [diff] [blame] | 262 | if test.gtest() { |
Jeff Gaston | af3cc2d | 2017-09-27 17:01:44 -0700 | [diff] [blame] | 263 | if ctx.useSdk() && ctx.Device() { |
Dan Albert | 7dd5899 | 2018-02-09 15:22:59 -0800 | [diff] [blame] | 264 | deps.StaticLibs = append(deps.StaticLibs, "libgtest_main_ndk_c++", "libgtest_ndk_c++") |
Christopher Ferris | 9df92d6 | 2018-08-21 12:40:08 -0700 | [diff] [blame] | 265 | } else if BoolDefault(test.Properties.Isolated, false) { |
| 266 | deps.StaticLibs = append(deps.StaticLibs, "libgtest_isolated_main") |
Christopher Ferris | 34cbba6 | 2019-07-17 15:46:29 -0700 | [diff] [blame] | 267 | // The isolated library requires liblog, but adding it |
| 268 | // as a static library means unit tests cannot override |
| 269 | // liblog functions. Instead make it a shared library |
| 270 | // dependency. |
| 271 | deps.SharedLibs = append(deps.SharedLibs, "liblog") |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 272 | } else { |
| 273 | deps.StaticLibs = append(deps.StaticLibs, "libgtest_main", "libgtest") |
| 274 | } |
| 275 | } |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 276 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 277 | return deps |
| 278 | } |
| 279 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 280 | func (test *testDecorator) linkerInit(ctx BaseModuleContext, linker *baseLinker) { |
yangbill | b3174d1 | 2018-05-07 06:41:20 +0000 | [diff] [blame] | 281 | // 1. Add ../../lib[64] to rpath so that out/host/linux-x86/nativetest/<test dir>/<test> can |
Colin Cross | bd75e1d | 2017-06-30 17:27:55 -0700 | [diff] [blame] | 282 | // find out/host/linux-x86/lib[64]/library.so |
yangbill | b3174d1 | 2018-05-07 06:41:20 +0000 | [diff] [blame] | 283 | // 2. Add ../../../lib[64] to rpath so that out/host/linux-x86/testcases/<test dir>/<CPU>/<test> can |
| 284 | // also find out/host/linux-x86/lib[64]/library.so |
| 285 | runpaths := []string{"../../lib", "../../../lib"} |
| 286 | for _, runpath := range runpaths { |
| 287 | if ctx.toolchain().Is64Bit() { |
| 288 | runpath += "64" |
| 289 | } |
| 290 | linker.dynamicProperties.RunPaths = append(linker.dynamicProperties.RunPaths, runpath) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 291 | } |
Colin Cross | bd75e1d | 2017-06-30 17:27:55 -0700 | [diff] [blame] | 292 | |
| 293 | // add "" to rpath so that test binaries can find libraries in their own test directory |
| 294 | linker.dynamicProperties.RunPaths = append(linker.dynamicProperties.RunPaths, "") |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 295 | } |
| 296 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 297 | func (test *testDecorator) linkerProps() []interface{} { |
| 298 | return []interface{}{&test.Properties} |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 299 | } |
| 300 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 301 | func NewTestInstaller() *baseInstaller { |
| 302 | return NewBaseInstaller("nativetest", "nativetest64", InstallInData) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 303 | } |
| 304 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 305 | type testBinary struct { |
| 306 | testDecorator |
| 307 | *binaryDecorator |
| 308 | *baseCompiler |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 309 | Properties TestBinaryProperties |
Colin Cross | faeb7aa | 2017-02-01 14:12:44 -0800 | [diff] [blame] | 310 | data android.Paths |
Colin Cross | 303e21f | 2018-08-07 16:49:25 -0700 | [diff] [blame] | 311 | testConfig android.Path |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 312 | } |
| 313 | |
| 314 | func (test *testBinary) linkerProps() []interface{} { |
| 315 | props := append(test.testDecorator.linkerProps(), test.binaryDecorator.linkerProps()...) |
| 316 | props = append(props, &test.Properties) |
| 317 | return props |
| 318 | } |
| 319 | |
| 320 | func (test *testBinary) linkerInit(ctx BaseModuleContext) { |
| 321 | test.testDecorator.linkerInit(ctx, test.binaryDecorator.baseLinker) |
| 322 | test.binaryDecorator.linkerInit(ctx) |
| 323 | } |
| 324 | |
Colin Cross | 37047f1 | 2016-12-13 17:06:13 -0800 | [diff] [blame] | 325 | func (test *testBinary) linkerDeps(ctx DepsContext, deps Deps) Deps { |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 326 | deps = test.testDecorator.linkerDeps(ctx, deps) |
| 327 | deps = test.binaryDecorator.linkerDeps(ctx, deps) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 328 | return deps |
| 329 | } |
| 330 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 331 | func (test *testBinary) linkerFlags(ctx ModuleContext, flags Flags) Flags { |
| 332 | flags = test.binaryDecorator.linkerFlags(ctx, flags) |
| 333 | flags = test.testDecorator.linkerFlags(ctx, flags) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 334 | return flags |
| 335 | } |
| 336 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 337 | func (test *testBinary) install(ctx ModuleContext, file android.Path) { |
Colin Cross | 8a49795 | 2019-03-05 22:25:09 -0800 | [diff] [blame] | 338 | test.data = android.PathsForModuleSrc(ctx, test.Properties.Data) |
nelsonli | 0d7111e | 2019-09-17 16:35:23 +0800 | [diff] [blame] | 339 | var api_level_prop string |
Dan Shi | 37ee3b8 | 2019-06-06 16:23:32 -0700 | [diff] [blame] | 340 | var configs []tradefed.Config |
nelsonli | 0d7111e | 2019-09-17 16:35:23 +0800 | [diff] [blame] | 341 | var min_level string |
easoncylee | 1e3fdcd | 2020-04-30 10:08:33 +0800 | [diff] [blame] | 342 | for _, module := range test.Properties.Test_mainline_modules { |
| 343 | configs = append(configs, tradefed.Option{Name: "config-descriptor:metadata", Key: "mainline-param", Value: module}) |
| 344 | } |
Dan Shi | 37ee3b8 | 2019-06-06 16:23:32 -0700 | [diff] [blame] | 345 | if Bool(test.Properties.Require_root) { |
nelsonli | 0d7111e | 2019-09-17 16:35:23 +0800 | [diff] [blame] | 346 | configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.RootTargetPreparer", nil}) |
Dan Shi | bc0f260 | 2019-09-17 02:43:50 +0000 | [diff] [blame] | 347 | } else { |
| 348 | var options []tradefed.Option |
easoncylee | 1e3fdcd | 2020-04-30 10:08:33 +0800 | [diff] [blame] | 349 | options = append(options, tradefed.Option{Name: "force-root", Value: "false"}) |
nelsonli | 0d7111e | 2019-09-17 16:35:23 +0800 | [diff] [blame] | 350 | configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.RootTargetPreparer", options}) |
Dan Shi | 20ccd21 | 2019-08-27 10:37:24 -0700 | [diff] [blame] | 351 | } |
| 352 | if Bool(test.Properties.Disable_framework) { |
| 353 | var options []tradefed.Option |
Dan Shi | 8aa4010 | 2020-05-12 13:50:12 -0700 | [diff] [blame] | 354 | configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.StopServicesSetup", options}) |
Julien Desprez | eb7398e | 2019-02-28 08:45:28 -0800 | [diff] [blame] | 355 | } |
Dan Shi | 37ee3b8 | 2019-06-06 16:23:32 -0700 | [diff] [blame] | 356 | if Bool(test.testDecorator.Properties.Isolated) { |
easoncylee | 1e3fdcd | 2020-04-30 10:08:33 +0800 | [diff] [blame] | 357 | configs = append(configs, tradefed.Option{Name: "not-shardable", Value: "true"}) |
Dan Shi | 37ee3b8 | 2019-06-06 16:23:32 -0700 | [diff] [blame] | 358 | } |
yelinhsieh | 9fc6040 | 2018-10-01 19:23:14 +0800 | [diff] [blame] | 359 | if test.Properties.Test_options.Run_test_as != nil { |
easoncylee | 1e3fdcd | 2020-04-30 10:08:33 +0800 | [diff] [blame] | 360 | configs = append(configs, tradefed.Option{Name: "run-test-as", Value: String(test.Properties.Test_options.Run_test_as)}) |
yelinhsieh | 9fc6040 | 2018-10-01 19:23:14 +0800 | [diff] [blame] | 361 | } |
David Srbecky | 519db27 | 2020-06-18 18:07:00 +0100 | [diff] [blame^] | 362 | for _, tag := range test.Properties.Test_options.Test_suite_tag { |
| 363 | configs = append(configs, tradefed.Option{Name: "test-suite-tag", Value: tag}) |
| 364 | } |
nelsonli | 0d7111e | 2019-09-17 16:35:23 +0800 | [diff] [blame] | 365 | if test.Properties.Test_min_api_level != nil && test.Properties.Test_min_sdk_version != nil { |
| 366 | ctx.PropertyErrorf("test_min_api_level", "'test_min_api_level' and 'test_min_sdk_version' should not be set at the same time.") |
| 367 | } else if test.Properties.Test_min_api_level != nil { |
| 368 | api_level_prop = "ro.product.first_api_level" |
| 369 | min_level = strconv.FormatInt(int64(*test.Properties.Test_min_api_level), 10) |
| 370 | } else if test.Properties.Test_min_sdk_version != nil { |
| 371 | api_level_prop = "ro.build.version.sdk" |
| 372 | min_level = strconv.FormatInt(int64(*test.Properties.Test_min_sdk_version), 10) |
| 373 | } |
| 374 | if api_level_prop != "" { |
| 375 | var options []tradefed.Option |
easoncylee | 1e3fdcd | 2020-04-30 10:08:33 +0800 | [diff] [blame] | 376 | options = append(options, tradefed.Option{Name: "min-api-level", Value: min_level}) |
| 377 | options = append(options, tradefed.Option{Name: "api-level-prop", Value: api_level_prop}) |
nelsonli | 0d7111e | 2019-09-17 16:35:23 +0800 | [diff] [blame] | 378 | configs = append(configs, tradefed.Object{"module_controller", "com.android.tradefed.testtype.suite.module.MinApiLevelModuleController", options}) |
| 379 | } |
yelinhsieh | 9fc6040 | 2018-10-01 19:23:14 +0800 | [diff] [blame] | 380 | |
Jack He | 3333889 | 2018-09-19 02:21:28 -0700 | [diff] [blame] | 381 | test.testConfig = tradefed.AutoGenNativeTestConfig(ctx, test.Properties.Test_config, |
Dan Shi | 6ffaaa8 | 2019-09-26 11:41:36 -0700 | [diff] [blame] | 382 | test.Properties.Test_config_template, test.Properties.Test_suites, configs, test.Properties.Auto_gen_config) |
Colin Cross | faeb7aa | 2017-02-01 14:12:44 -0800 | [diff] [blame] | 383 | |
Colin Cross | 600c9df | 2016-09-13 12:26:16 -0700 | [diff] [blame] | 384 | test.binaryDecorator.baseInstaller.dir = "nativetest" |
| 385 | test.binaryDecorator.baseInstaller.dir64 = "nativetest64" |
Dan Willemsen | 3340d60 | 2016-12-27 14:40:40 -0800 | [diff] [blame] | 386 | |
| 387 | if !Bool(test.Properties.No_named_install_directory) { |
| 388 | test.binaryDecorator.baseInstaller.relative = ctx.ModuleName() |
Nan Zhang | 0007d81 | 2017-11-07 10:57:05 -0800 | [diff] [blame] | 389 | } else if String(test.binaryDecorator.baseInstaller.Properties.Relative_install_path) == "" { |
Dan Willemsen | 3340d60 | 2016-12-27 14:40:40 -0800 | [diff] [blame] | 390 | ctx.PropertyErrorf("no_named_install_directory", "Module install directory may only be disabled if relative_install_path is set") |
| 391 | } |
| 392 | |
Dan Willemsen | 1d577e2 | 2016-08-29 15:53:15 -0700 | [diff] [blame] | 393 | test.binaryDecorator.baseInstaller.install(ctx, file) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 394 | } |
| 395 | |
| 396 | func NewTest(hod android.HostOrDeviceSupported) *Module { |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 397 | module, binary := NewBinary(hod) |
| 398 | module.multilib = android.MultilibBoth |
Dan Willemsen | 1d577e2 | 2016-08-29 15:53:15 -0700 | [diff] [blame] | 399 | binary.baseInstaller = NewTestInstaller() |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 400 | |
| 401 | test := &testBinary{ |
| 402 | testDecorator: testDecorator{ |
| 403 | linker: binary.baseLinker, |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 404 | }, |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 405 | binaryDecorator: binary, |
| 406 | baseCompiler: NewBaseCompiler(), |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 407 | } |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 408 | module.compiler = test |
| 409 | module.linker = test |
| 410 | module.installer = test |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 411 | return module |
| 412 | } |
| 413 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 414 | type testLibrary struct { |
| 415 | testDecorator |
| 416 | *libraryDecorator |
| 417 | } |
| 418 | |
| 419 | func (test *testLibrary) linkerProps() []interface{} { |
| 420 | return append(test.testDecorator.linkerProps(), test.libraryDecorator.linkerProps()...) |
| 421 | } |
| 422 | |
| 423 | func (test *testLibrary) linkerInit(ctx BaseModuleContext) { |
| 424 | test.testDecorator.linkerInit(ctx, test.libraryDecorator.baseLinker) |
| 425 | test.libraryDecorator.linkerInit(ctx) |
| 426 | } |
| 427 | |
Colin Cross | 37047f1 | 2016-12-13 17:06:13 -0800 | [diff] [blame] | 428 | func (test *testLibrary) linkerDeps(ctx DepsContext, deps Deps) Deps { |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 429 | deps = test.testDecorator.linkerDeps(ctx, deps) |
| 430 | deps = test.libraryDecorator.linkerDeps(ctx, deps) |
| 431 | return deps |
| 432 | } |
| 433 | |
| 434 | func (test *testLibrary) linkerFlags(ctx ModuleContext, flags Flags) Flags { |
| 435 | flags = test.libraryDecorator.linkerFlags(ctx, flags) |
| 436 | flags = test.testDecorator.linkerFlags(ctx, flags) |
| 437 | return flags |
| 438 | } |
| 439 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 440 | func NewTestLibrary(hod android.HostOrDeviceSupported) *Module { |
Colin Cross | ab3b732 | 2016-12-09 14:46:15 -0800 | [diff] [blame] | 441 | module, library := NewLibrary(android.HostAndDeviceSupported) |
Dan Willemsen | 28bda51 | 2016-08-31 16:32:55 -0700 | [diff] [blame] | 442 | library.baseInstaller = NewTestInstaller() |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 443 | test := &testLibrary{ |
| 444 | testDecorator: testDecorator{ |
| 445 | linker: library.baseLinker, |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 446 | }, |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 447 | libraryDecorator: library, |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 448 | } |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 449 | module.linker = test |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 450 | return module |
| 451 | } |
| 452 | |
Colin Cross | e28f4e2 | 2017-04-24 18:10:29 -0700 | [diff] [blame] | 453 | type BenchmarkProperties struct { |
Anders Lewis | b97e818 | 2017-07-14 15:20:13 -0700 | [diff] [blame] | 454 | // list of files or filegroup modules that provide data that should be installed alongside |
| 455 | // the test |
Colin Cross | 27b922f | 2019-03-04 22:35:41 -0800 | [diff] [blame] | 456 | Data []string `android:"path"` |
Anders Lewis | b97e818 | 2017-07-14 15:20:13 -0700 | [diff] [blame] | 457 | |
Colin Cross | e28f4e2 | 2017-04-24 18:10:29 -0700 | [diff] [blame] | 458 | // list of compatibility suites (for example "cts", "vts") that the module should be |
| 459 | // installed into. |
Julien Desprez | e146e39 | 2018-08-02 15:00:46 -0700 | [diff] [blame] | 460 | Test_suites []string `android:"arch_variant"` |
| 461 | |
| 462 | // the name of the test configuration (for example "AndroidTest.xml") that should be |
| 463 | // installed with the module. |
Colin Cross | 27b922f | 2019-03-04 22:35:41 -0800 | [diff] [blame] | 464 | Test_config *string `android:"path,arch_variant"` |
Jack He | 3333889 | 2018-09-19 02:21:28 -0700 | [diff] [blame] | 465 | |
| 466 | // the name of the test configuration template (for example "AndroidTestTemplate.xml") that |
| 467 | // should be installed with the module. |
Colin Cross | 27b922f | 2019-03-04 22:35:41 -0800 | [diff] [blame] | 468 | Test_config_template *string `android:"path,arch_variant"` |
Dan Shi | 37ee3b8 | 2019-06-06 16:23:32 -0700 | [diff] [blame] | 469 | |
| 470 | // Add RootTargetPreparer to auto generated test config. This guarantees the test to run |
| 471 | // with root permission. |
| 472 | Require_root *bool |
Dan Shi | 6ffaaa8 | 2019-09-26 11:41:36 -0700 | [diff] [blame] | 473 | |
| 474 | // Flag to indicate whether or not to create test config automatically. If AndroidTest.xml |
| 475 | // doesn't exist next to the Android.bp, this attribute doesn't need to be set to true |
| 476 | // explicitly. |
| 477 | Auto_gen_config *bool |
Colin Cross | e28f4e2 | 2017-04-24 18:10:29 -0700 | [diff] [blame] | 478 | } |
| 479 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 480 | type benchmarkDecorator struct { |
| 481 | *binaryDecorator |
Colin Cross | e28f4e2 | 2017-04-24 18:10:29 -0700 | [diff] [blame] | 482 | Properties BenchmarkProperties |
Anders Lewis | b97e818 | 2017-07-14 15:20:13 -0700 | [diff] [blame] | 483 | data android.Paths |
Colin Cross | 303e21f | 2018-08-07 16:49:25 -0700 | [diff] [blame] | 484 | testConfig android.Path |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 485 | } |
| 486 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 487 | func (benchmark *benchmarkDecorator) linkerInit(ctx BaseModuleContext) { |
| 488 | runpath := "../../lib" |
| 489 | if ctx.toolchain().Is64Bit() { |
| 490 | runpath += "64" |
| 491 | } |
| 492 | benchmark.baseLinker.dynamicProperties.RunPaths = append(benchmark.baseLinker.dynamicProperties.RunPaths, runpath) |
| 493 | benchmark.binaryDecorator.linkerInit(ctx) |
| 494 | } |
| 495 | |
Colin Cross | e28f4e2 | 2017-04-24 18:10:29 -0700 | [diff] [blame] | 496 | func (benchmark *benchmarkDecorator) linkerProps() []interface{} { |
| 497 | props := benchmark.binaryDecorator.linkerProps() |
| 498 | props = append(props, &benchmark.Properties) |
| 499 | return props |
| 500 | } |
| 501 | |
Colin Cross | 37047f1 | 2016-12-13 17:06:13 -0800 | [diff] [blame] | 502 | func (benchmark *benchmarkDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps { |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 503 | deps = benchmark.binaryDecorator.linkerDeps(ctx, deps) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 504 | deps.StaticLibs = append(deps.StaticLibs, "libgoogle-benchmark") |
| 505 | return deps |
| 506 | } |
| 507 | |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 508 | func (benchmark *benchmarkDecorator) install(ctx ModuleContext, file android.Path) { |
Colin Cross | 8a49795 | 2019-03-05 22:25:09 -0800 | [diff] [blame] | 509 | benchmark.data = android.PathsForModuleSrc(ctx, benchmark.Properties.Data) |
Dan Shi | 37ee3b8 | 2019-06-06 16:23:32 -0700 | [diff] [blame] | 510 | var configs []tradefed.Config |
| 511 | if Bool(benchmark.Properties.Require_root) { |
nelsonli | 0d7111e | 2019-09-17 16:35:23 +0800 | [diff] [blame] | 512 | configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.RootTargetPreparer", nil}) |
Dan Shi | 37ee3b8 | 2019-06-06 16:23:32 -0700 | [diff] [blame] | 513 | } |
Jack He | 3333889 | 2018-09-19 02:21:28 -0700 | [diff] [blame] | 514 | benchmark.testConfig = tradefed.AutoGenNativeBenchmarkTestConfig(ctx, benchmark.Properties.Test_config, |
Dan Shi | 6ffaaa8 | 2019-09-26 11:41:36 -0700 | [diff] [blame] | 515 | benchmark.Properties.Test_config_template, benchmark.Properties.Test_suites, configs, benchmark.Properties.Auto_gen_config) |
Colin Cross | 303e21f | 2018-08-07 16:49:25 -0700 | [diff] [blame] | 516 | |
Colin Cross | 28690e9 | 2017-09-08 16:20:30 -0700 | [diff] [blame] | 517 | benchmark.binaryDecorator.baseInstaller.dir = filepath.Join("benchmarktest", ctx.ModuleName()) |
| 518 | benchmark.binaryDecorator.baseInstaller.dir64 = filepath.Join("benchmarktest64", ctx.ModuleName()) |
Dan Willemsen | 1d577e2 | 2016-08-29 15:53:15 -0700 | [diff] [blame] | 519 | benchmark.binaryDecorator.baseInstaller.install(ctx, file) |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 520 | } |
| 521 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 522 | func NewBenchmark(hod android.HostOrDeviceSupported) *Module { |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 523 | module, binary := NewBinary(hod) |
| 524 | module.multilib = android.MultilibBoth |
Colin Cross | 28690e9 | 2017-09-08 16:20:30 -0700 | [diff] [blame] | 525 | binary.baseInstaller = NewBaseInstaller("benchmarktest", "benchmarktest64", InstallInData) |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 526 | |
| 527 | benchmark := &benchmarkDecorator{ |
| 528 | binaryDecorator: binary, |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 529 | } |
Colin Cross | b916a38 | 2016-07-29 17:28:03 -0700 | [diff] [blame] | 530 | module.linker = benchmark |
| 531 | module.installer = benchmark |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 532 | return module |
| 533 | } |