blob: e6251d33c730d192909f8e0c1e23201407a80718 [file] [log] [blame]
Colin Cross4d9c2d12016-07-29 12:48:20 -07001// 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
15package cc
16
17import (
18 "path/filepath"
Dan Willemsen0b24c742016-10-04 15:13:37 -070019 "runtime"
Colin Cross4d9c2d12016-07-29 12:48:20 -070020 "strings"
21
Colin Cross4d9c2d12016-07-29 12:48:20 -070022 "android/soong/android"
Colin Cross303e21f2018-08-07 16:49:25 -070023 "android/soong/tradefed"
Colin Cross4d9c2d12016-07-29 12:48:20 -070024)
25
Colin Crossb916a382016-07-29 17:28:03 -070026type TestProperties struct {
Colin Cross4d9c2d12016-07-29 12:48:20 -070027 // if set, build against the gtest library. Defaults to true.
Colin Cross600c9df2016-09-13 12:26:16 -070028 Gtest *bool
Christopher Ferris9df92d62018-08-21 12:40:08 -070029
30 // if set, use the isolated gtest runner. Defaults to false.
31 Isolated *bool
Colin Crossb916a382016-07-29 17:28:03 -070032}
Colin Cross4d9c2d12016-07-29 12:48:20 -070033
yelinhsiehd30b9402018-10-01 19:23:14 +080034// Test option struct.
35type TestOptions struct {
36 // the UID that you want to run in device.
37 Run_test_as string `android:"arch_variant"`
38}
39
Colin Crossb916a382016-07-29 17:28:03 -070040type TestBinaryProperties struct {
Colin Cross4d9c2d12016-07-29 12:48:20 -070041 // Create a separate binary for each source file. Useful when there is
42 // global state that can not be torn down and reset between each test suite.
43 Test_per_src *bool
Dan Willemsen3340d602016-12-27 14:40:40 -080044
45 // Disables the creation of a test-specific directory when used with
46 // relative_install_path. Useful if several tests need to be in the same
47 // directory, but test_per_src doesn't work.
48 No_named_install_directory *bool
Colin Crossfaeb7aa2017-02-01 14:12:44 -080049
50 // list of files or filegroup modules that provide data that should be installed alongside
51 // the test
52 Data []string
Colin Crossa929db02017-03-27 16:27:50 -070053
54 // list of compatibility suites (for example "cts", "vts") that the module should be
55 // installed into.
Dan Willemsen15d54d52017-09-18 16:49:28 -070056 Test_suites []string `android:"arch_variant"`
Julien Despreze146e392018-08-02 15:00:46 -070057
58 // the name of the test configuration (for example "AndroidTest.xml") that should be
59 // installed with the module.
60 Test_config *string `android:"arch_variant"`
Jack He33338892018-09-19 02:21:28 -070061
62 // the name of the test configuration template (for example "AndroidTestTemplate.xml") that
63 // should be installed with the module.
64 Test_config_template *string `android:"arch_variant"`
yelinhsiehd30b9402018-10-01 19:23:14 +080065
66 // Test options.
67 Test_options *TestOptions
Colin Cross4d9c2d12016-07-29 12:48:20 -070068}
69
70func init() {
Steven Moreland87c9d7b2017-11-02 21:38:28 -070071 android.RegisterModuleType("cc_test", TestFactory)
72 android.RegisterModuleType("cc_test_library", TestLibraryFactory)
73 android.RegisterModuleType("cc_benchmark", BenchmarkFactory)
74 android.RegisterModuleType("cc_test_host", TestHostFactory)
75 android.RegisterModuleType("cc_benchmark_host", BenchmarkHostFactory)
Colin Cross4d9c2d12016-07-29 12:48:20 -070076}
77
78// Module factory for tests
Steven Moreland87c9d7b2017-11-02 21:38:28 -070079func TestFactory() android.Module {
Colin Cross4d9c2d12016-07-29 12:48:20 -070080 module := NewTest(android.HostAndDeviceSupported)
81 return module.Init()
82}
83
84// Module factory for test libraries
Steven Moreland87c9d7b2017-11-02 21:38:28 -070085func TestLibraryFactory() android.Module {
Colin Cross4d9c2d12016-07-29 12:48:20 -070086 module := NewTestLibrary(android.HostAndDeviceSupported)
87 return module.Init()
88}
89
90// Module factory for benchmarks
Steven Moreland87c9d7b2017-11-02 21:38:28 -070091func BenchmarkFactory() android.Module {
Colin Cross4d9c2d12016-07-29 12:48:20 -070092 module := NewBenchmark(android.HostAndDeviceSupported)
93 return module.Init()
94}
95
96// Module factory for host tests
Steven Moreland87c9d7b2017-11-02 21:38:28 -070097func TestHostFactory() android.Module {
Colin Cross4d9c2d12016-07-29 12:48:20 -070098 module := NewTest(android.HostSupported)
99 return module.Init()
100}
101
102// Module factory for host benchmarks
Steven Moreland87c9d7b2017-11-02 21:38:28 -0700103func BenchmarkHostFactory() android.Module {
Colin Cross4d9c2d12016-07-29 12:48:20 -0700104 module := NewBenchmark(android.HostSupported)
105 return module.Init()
106}
107
Colin Crossb916a382016-07-29 17:28:03 -0700108type testPerSrc interface {
109 testPerSrc() bool
110 srcs() []string
111 setSrc(string, string)
112}
113
114func (test *testBinary) testPerSrc() bool {
115 return Bool(test.Properties.Test_per_src)
116}
117
118func (test *testBinary) srcs() []string {
119 return test.baseCompiler.Properties.Srcs
120}
121
122func (test *testBinary) setSrc(name, src string) {
123 test.baseCompiler.Properties.Srcs = []string{src}
Nan Zhang0007d812017-11-07 10:57:05 -0800124 test.binaryDecorator.Properties.Stem = StringPtr(name)
Colin Crossb916a382016-07-29 17:28:03 -0700125}
126
127var _ testPerSrc = (*testBinary)(nil)
128
Colin Cross4d9c2d12016-07-29 12:48:20 -0700129func testPerSrcMutator(mctx android.BottomUpMutatorContext) {
130 if m, ok := mctx.Module().(*Module); ok {
Colin Crossb916a382016-07-29 17:28:03 -0700131 if test, ok := m.linker.(testPerSrc); ok {
132 if test.testPerSrc() && len(test.srcs()) > 0 {
133 testNames := make([]string, len(test.srcs()))
134 for i, src := range test.srcs() {
Colin Cross4d9c2d12016-07-29 12:48:20 -0700135 testNames[i] = strings.TrimSuffix(filepath.Base(src), filepath.Ext(src))
136 }
137 tests := mctx.CreateLocalVariations(testNames...)
Colin Crossb916a382016-07-29 17:28:03 -0700138 for i, src := range test.srcs() {
139 tests[i].(*Module).linker.(testPerSrc).setSrc(testNames[i], src)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700140 }
141 }
142 }
143 }
144}
145
Colin Crossb916a382016-07-29 17:28:03 -0700146type testDecorator struct {
147 Properties TestProperties
148 linker *baseLinker
Colin Cross4d9c2d12016-07-29 12:48:20 -0700149}
150
Colin Cross600c9df2016-09-13 12:26:16 -0700151func (test *testDecorator) gtest() bool {
Colin Cross38b40df2018-04-10 16:14:46 -0700152 return BoolDefault(test.Properties.Gtest, true)
Colin Cross600c9df2016-09-13 12:26:16 -0700153}
154
Colin Crossb916a382016-07-29 17:28:03 -0700155func (test *testDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {
Colin Cross600c9df2016-09-13 12:26:16 -0700156 if !test.gtest() {
Colin Cross4d9c2d12016-07-29 12:48:20 -0700157 return flags
158 }
159
160 flags.CFlags = append(flags.CFlags, "-DGTEST_HAS_STD_STRING")
161 if ctx.Host() {
162 flags.CFlags = append(flags.CFlags, "-O0", "-g")
163
164 switch ctx.Os() {
165 case android.Windows:
166 flags.CFlags = append(flags.CFlags, "-DGTEST_OS_WINDOWS")
167 case android.Linux:
168 flags.CFlags = append(flags.CFlags, "-DGTEST_OS_LINUX")
Colin Cross4d9c2d12016-07-29 12:48:20 -0700169 case android.Darwin:
170 flags.CFlags = append(flags.CFlags, "-DGTEST_OS_MAC")
Colin Cross4d9c2d12016-07-29 12:48:20 -0700171 }
172 } else {
173 flags.CFlags = append(flags.CFlags, "-DGTEST_OS_LINUX_ANDROID")
174 }
175
176 return flags
177}
178
Colin Crossb916a382016-07-29 17:28:03 -0700179func (test *testDecorator) linkerDeps(ctx BaseModuleContext, deps Deps) Deps {
Colin Cross600c9df2016-09-13 12:26:16 -0700180 if test.gtest() {
Jeff Gastonaf3cc2d2017-09-27 17:01:44 -0700181 if ctx.useSdk() && ctx.Device() {
Dan Albert7dd58992018-02-09 15:22:59 -0800182 deps.StaticLibs = append(deps.StaticLibs, "libgtest_main_ndk_c++", "libgtest_ndk_c++")
Christopher Ferris9df92d62018-08-21 12:40:08 -0700183 } else if BoolDefault(test.Properties.Isolated, false) {
184 deps.StaticLibs = append(deps.StaticLibs, "libgtest_isolated_main")
Colin Cross4d9c2d12016-07-29 12:48:20 -0700185 } else {
186 deps.StaticLibs = append(deps.StaticLibs, "libgtest_main", "libgtest")
187 }
188 }
Colin Crossb916a382016-07-29 17:28:03 -0700189
Colin Cross4d9c2d12016-07-29 12:48:20 -0700190 return deps
191}
192
Colin Crossb916a382016-07-29 17:28:03 -0700193func (test *testDecorator) linkerInit(ctx BaseModuleContext, linker *baseLinker) {
yangbillb3174d12018-05-07 06:41:20 +0000194 // 1. Add ../../lib[64] to rpath so that out/host/linux-x86/nativetest/<test dir>/<test> can
Colin Crossbd75e1d2017-06-30 17:27:55 -0700195 // find out/host/linux-x86/lib[64]/library.so
yangbillb3174d12018-05-07 06:41:20 +0000196 // 2. Add ../../../lib[64] to rpath so that out/host/linux-x86/testcases/<test dir>/<CPU>/<test> can
197 // also find out/host/linux-x86/lib[64]/library.so
198 runpaths := []string{"../../lib", "../../../lib"}
199 for _, runpath := range runpaths {
200 if ctx.toolchain().Is64Bit() {
201 runpath += "64"
202 }
203 linker.dynamicProperties.RunPaths = append(linker.dynamicProperties.RunPaths, runpath)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700204 }
Colin Crossbd75e1d2017-06-30 17:27:55 -0700205
206 // add "" to rpath so that test binaries can find libraries in their own test directory
207 linker.dynamicProperties.RunPaths = append(linker.dynamicProperties.RunPaths, "")
Colin Cross4d9c2d12016-07-29 12:48:20 -0700208}
209
Colin Crossb916a382016-07-29 17:28:03 -0700210func (test *testDecorator) linkerProps() []interface{} {
211 return []interface{}{&test.Properties}
Colin Cross4d9c2d12016-07-29 12:48:20 -0700212}
213
Colin Crossb916a382016-07-29 17:28:03 -0700214func NewTestInstaller() *baseInstaller {
215 return NewBaseInstaller("nativetest", "nativetest64", InstallInData)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700216}
217
Colin Crossb916a382016-07-29 17:28:03 -0700218type testBinary struct {
219 testDecorator
220 *binaryDecorator
221 *baseCompiler
Colin Crossb916a382016-07-29 17:28:03 -0700222 Properties TestBinaryProperties
Colin Crossfaeb7aa2017-02-01 14:12:44 -0800223 data android.Paths
Colin Cross303e21f2018-08-07 16:49:25 -0700224 testConfig android.Path
Colin Crossb916a382016-07-29 17:28:03 -0700225}
226
227func (test *testBinary) linkerProps() []interface{} {
228 props := append(test.testDecorator.linkerProps(), test.binaryDecorator.linkerProps()...)
229 props = append(props, &test.Properties)
230 return props
231}
232
233func (test *testBinary) linkerInit(ctx BaseModuleContext) {
234 test.testDecorator.linkerInit(ctx, test.binaryDecorator.baseLinker)
235 test.binaryDecorator.linkerInit(ctx)
236}
237
Colin Cross37047f12016-12-13 17:06:13 -0800238func (test *testBinary) linkerDeps(ctx DepsContext, deps Deps) Deps {
Colin Crossfaeb7aa2017-02-01 14:12:44 -0800239 android.ExtractSourcesDeps(ctx, test.Properties.Data)
Colin Cross303e21f2018-08-07 16:49:25 -0700240 android.ExtractSourceDeps(ctx, test.Properties.Test_config)
Jack He33338892018-09-19 02:21:28 -0700241 android.ExtractSourceDeps(ctx, test.Properties.Test_config_template)
Colin Crossfaeb7aa2017-02-01 14:12:44 -0800242
Colin Crossb916a382016-07-29 17:28:03 -0700243 deps = test.testDecorator.linkerDeps(ctx, deps)
244 deps = test.binaryDecorator.linkerDeps(ctx, deps)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700245 return deps
246}
247
Colin Crossb916a382016-07-29 17:28:03 -0700248func (test *testBinary) linkerFlags(ctx ModuleContext, flags Flags) Flags {
249 flags = test.binaryDecorator.linkerFlags(ctx, flags)
250 flags = test.testDecorator.linkerFlags(ctx, flags)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700251 return flags
252}
253
Colin Crossb916a382016-07-29 17:28:03 -0700254func (test *testBinary) install(ctx ModuleContext, file android.Path) {
Colin Crossfaeb7aa2017-02-01 14:12:44 -0800255 test.data = ctx.ExpandSources(test.Properties.Data, nil)
yelinhsiehd30b9402018-10-01 19:23:14 +0800256
257 // Append new line in template like below
258 // <option name="run-test-as" value="1234" />
259 optionsMap := map[string]string{}
260 if test.Properties.Test_options != nil {
261 optionsMap["run-test-as"] = string(test.Properties.Test_options.Run_test_as)
262 }
263
Jack He33338892018-09-19 02:21:28 -0700264 test.testConfig = tradefed.AutoGenNativeTestConfig(ctx, test.Properties.Test_config,
yelinhsiehd30b9402018-10-01 19:23:14 +0800265 test.Properties.Test_config_template, optionsMap)
Colin Crossfaeb7aa2017-02-01 14:12:44 -0800266
Colin Cross600c9df2016-09-13 12:26:16 -0700267 test.binaryDecorator.baseInstaller.dir = "nativetest"
268 test.binaryDecorator.baseInstaller.dir64 = "nativetest64"
Dan Willemsen3340d602016-12-27 14:40:40 -0800269
270 if !Bool(test.Properties.No_named_install_directory) {
271 test.binaryDecorator.baseInstaller.relative = ctx.ModuleName()
Nan Zhang0007d812017-11-07 10:57:05 -0800272 } else if String(test.binaryDecorator.baseInstaller.Properties.Relative_install_path) == "" {
Dan Willemsen3340d602016-12-27 14:40:40 -0800273 ctx.PropertyErrorf("no_named_install_directory", "Module install directory may only be disabled if relative_install_path is set")
274 }
275
Dan Willemsen1d577e22016-08-29 15:53:15 -0700276 test.binaryDecorator.baseInstaller.install(ctx, file)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700277}
278
279func NewTest(hod android.HostOrDeviceSupported) *Module {
Colin Crossb916a382016-07-29 17:28:03 -0700280 module, binary := NewBinary(hod)
281 module.multilib = android.MultilibBoth
Dan Willemsen1d577e22016-08-29 15:53:15 -0700282 binary.baseInstaller = NewTestInstaller()
Colin Crossb916a382016-07-29 17:28:03 -0700283
284 test := &testBinary{
285 testDecorator: testDecorator{
286 linker: binary.baseLinker,
Colin Cross4d9c2d12016-07-29 12:48:20 -0700287 },
Colin Crossb916a382016-07-29 17:28:03 -0700288 binaryDecorator: binary,
289 baseCompiler: NewBaseCompiler(),
Colin Cross4d9c2d12016-07-29 12:48:20 -0700290 }
Colin Crossb916a382016-07-29 17:28:03 -0700291 module.compiler = test
292 module.linker = test
293 module.installer = test
Colin Cross4d9c2d12016-07-29 12:48:20 -0700294 return module
295}
296
Colin Crossb916a382016-07-29 17:28:03 -0700297type testLibrary struct {
298 testDecorator
299 *libraryDecorator
300}
301
302func (test *testLibrary) linkerProps() []interface{} {
303 return append(test.testDecorator.linkerProps(), test.libraryDecorator.linkerProps()...)
304}
305
306func (test *testLibrary) linkerInit(ctx BaseModuleContext) {
307 test.testDecorator.linkerInit(ctx, test.libraryDecorator.baseLinker)
308 test.libraryDecorator.linkerInit(ctx)
309}
310
Colin Cross37047f12016-12-13 17:06:13 -0800311func (test *testLibrary) linkerDeps(ctx DepsContext, deps Deps) Deps {
Colin Crossb916a382016-07-29 17:28:03 -0700312 deps = test.testDecorator.linkerDeps(ctx, deps)
313 deps = test.libraryDecorator.linkerDeps(ctx, deps)
314 return deps
315}
316
317func (test *testLibrary) linkerFlags(ctx ModuleContext, flags Flags) Flags {
318 flags = test.libraryDecorator.linkerFlags(ctx, flags)
319 flags = test.testDecorator.linkerFlags(ctx, flags)
320 return flags
321}
322
Colin Cross4d9c2d12016-07-29 12:48:20 -0700323func NewTestLibrary(hod android.HostOrDeviceSupported) *Module {
Colin Crossab3b7322016-12-09 14:46:15 -0800324 module, library := NewLibrary(android.HostAndDeviceSupported)
Dan Willemsen28bda512016-08-31 16:32:55 -0700325 library.baseInstaller = NewTestInstaller()
Colin Crossb916a382016-07-29 17:28:03 -0700326 test := &testLibrary{
327 testDecorator: testDecorator{
328 linker: library.baseLinker,
Colin Cross4d9c2d12016-07-29 12:48:20 -0700329 },
Colin Crossb916a382016-07-29 17:28:03 -0700330 libraryDecorator: library,
Colin Cross4d9c2d12016-07-29 12:48:20 -0700331 }
Colin Crossb916a382016-07-29 17:28:03 -0700332 module.linker = test
Colin Cross4d9c2d12016-07-29 12:48:20 -0700333 return module
334}
335
Colin Crosse28f4e22017-04-24 18:10:29 -0700336type BenchmarkProperties struct {
Anders Lewisb97e8182017-07-14 15:20:13 -0700337 // list of files or filegroup modules that provide data that should be installed alongside
338 // the test
339 Data []string
340
Colin Crosse28f4e22017-04-24 18:10:29 -0700341 // list of compatibility suites (for example "cts", "vts") that the module should be
342 // installed into.
Julien Despreze146e392018-08-02 15:00:46 -0700343 Test_suites []string `android:"arch_variant"`
344
345 // the name of the test configuration (for example "AndroidTest.xml") that should be
346 // installed with the module.
347 Test_config *string `android:"arch_variant"`
Jack He33338892018-09-19 02:21:28 -0700348
349 // the name of the test configuration template (for example "AndroidTestTemplate.xml") that
350 // should be installed with the module.
351 Test_config_template *string `android:"arch_variant"`
Colin Crosse28f4e22017-04-24 18:10:29 -0700352}
353
Colin Crossb916a382016-07-29 17:28:03 -0700354type benchmarkDecorator struct {
355 *binaryDecorator
Colin Crosse28f4e22017-04-24 18:10:29 -0700356 Properties BenchmarkProperties
Anders Lewisb97e8182017-07-14 15:20:13 -0700357 data android.Paths
Colin Cross303e21f2018-08-07 16:49:25 -0700358 testConfig android.Path
Colin Cross4d9c2d12016-07-29 12:48:20 -0700359}
360
Colin Crossb916a382016-07-29 17:28:03 -0700361func (benchmark *benchmarkDecorator) linkerInit(ctx BaseModuleContext) {
362 runpath := "../../lib"
363 if ctx.toolchain().Is64Bit() {
364 runpath += "64"
365 }
366 benchmark.baseLinker.dynamicProperties.RunPaths = append(benchmark.baseLinker.dynamicProperties.RunPaths, runpath)
367 benchmark.binaryDecorator.linkerInit(ctx)
368}
369
Colin Crosse28f4e22017-04-24 18:10:29 -0700370func (benchmark *benchmarkDecorator) linkerProps() []interface{} {
371 props := benchmark.binaryDecorator.linkerProps()
372 props = append(props, &benchmark.Properties)
373 return props
374}
375
Colin Cross37047f12016-12-13 17:06:13 -0800376func (benchmark *benchmarkDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
Anders Lewisb97e8182017-07-14 15:20:13 -0700377 android.ExtractSourcesDeps(ctx, benchmark.Properties.Data)
Colin Cross303e21f2018-08-07 16:49:25 -0700378 android.ExtractSourceDeps(ctx, benchmark.Properties.Test_config)
Jack He33338892018-09-19 02:21:28 -0700379 android.ExtractSourceDeps(ctx, benchmark.Properties.Test_config_template)
Colin Cross303e21f2018-08-07 16:49:25 -0700380
Colin Crossb916a382016-07-29 17:28:03 -0700381 deps = benchmark.binaryDecorator.linkerDeps(ctx, deps)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700382 deps.StaticLibs = append(deps.StaticLibs, "libgoogle-benchmark")
383 return deps
384}
385
Colin Crossb916a382016-07-29 17:28:03 -0700386func (benchmark *benchmarkDecorator) install(ctx ModuleContext, file android.Path) {
Anders Lewisb97e8182017-07-14 15:20:13 -0700387 benchmark.data = ctx.ExpandSources(benchmark.Properties.Data, nil)
Jack He33338892018-09-19 02:21:28 -0700388 benchmark.testConfig = tradefed.AutoGenNativeBenchmarkTestConfig(ctx, benchmark.Properties.Test_config,
389 benchmark.Properties.Test_config_template)
Colin Cross303e21f2018-08-07 16:49:25 -0700390
Colin Cross28690e92017-09-08 16:20:30 -0700391 benchmark.binaryDecorator.baseInstaller.dir = filepath.Join("benchmarktest", ctx.ModuleName())
392 benchmark.binaryDecorator.baseInstaller.dir64 = filepath.Join("benchmarktest64", ctx.ModuleName())
Dan Willemsen1d577e22016-08-29 15:53:15 -0700393 benchmark.binaryDecorator.baseInstaller.install(ctx, file)
Colin Crossb916a382016-07-29 17:28:03 -0700394}
395
Colin Cross4d9c2d12016-07-29 12:48:20 -0700396func NewBenchmark(hod android.HostOrDeviceSupported) *Module {
Dan Willemsen0b24c742016-10-04 15:13:37 -0700397 // Benchmarks aren't supported on Darwin
398 if runtime.GOOS == "darwin" {
399 switch hod {
400 case android.HostAndDeviceSupported:
401 hod = android.DeviceSupported
402 case android.HostSupported:
403 hod = android.NeitherHostNorDeviceSupported
404 }
405 }
406
Colin Crossb916a382016-07-29 17:28:03 -0700407 module, binary := NewBinary(hod)
408 module.multilib = android.MultilibBoth
Colin Cross28690e92017-09-08 16:20:30 -0700409 binary.baseInstaller = NewBaseInstaller("benchmarktest", "benchmarktest64", InstallInData)
Colin Crossb916a382016-07-29 17:28:03 -0700410
411 benchmark := &benchmarkDecorator{
412 binaryDecorator: binary,
Colin Cross4d9c2d12016-07-29 12:48:20 -0700413 }
Colin Crossb916a382016-07-29 17:28:03 -0700414 module.linker = benchmark
415 module.installer = benchmark
Colin Cross4d9c2d12016-07-29 12:48:20 -0700416 return module
417}