Add support for data field in cc_benchmark.
Test: mm -j at source root; Run on blueprint with data in cc_benchmark.
Change-Id: I6647fe95c96a6df27a54633f6a520a032487ca97
diff --git a/cc/test.go b/cc/test.go
index ea05ba5..a52e94a 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -298,6 +298,10 @@
}
type BenchmarkProperties struct {
+ // list of files or filegroup modules that provide data that should be installed alongside
+ // the test
+ Data []string
+
// list of compatibility suites (for example "cts", "vts") that the module should be
// installed into.
Test_suites []string
@@ -306,6 +310,7 @@
type benchmarkDecorator struct {
*binaryDecorator
Properties BenchmarkProperties
+ data android.Paths
}
func (benchmark *benchmarkDecorator) linkerInit(ctx BaseModuleContext) {
@@ -324,12 +329,14 @@
}
func (benchmark *benchmarkDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
+ android.ExtractSourcesDeps(ctx, benchmark.Properties.Data)
deps = benchmark.binaryDecorator.linkerDeps(ctx, deps)
deps.StaticLibs = append(deps.StaticLibs, "libgoogle-benchmark")
return deps
}
func (benchmark *benchmarkDecorator) install(ctx ModuleContext, file android.Path) {
+ benchmark.data = ctx.ExpandSources(benchmark.Properties.Data, nil)
benchmark.binaryDecorator.baseInstaller.dir = filepath.Join("nativetest", ctx.ModuleName())
benchmark.binaryDecorator.baseInstaller.dir64 = filepath.Join("nativetest64", ctx.ModuleName())
benchmark.binaryDecorator.baseInstaller.install(ctx, file)