Merge "Improve test support for art tests"
This commit is contained in:
@@ -24,7 +24,7 @@ import (
|
|||||||
|
|
||||||
type InstallerProperties struct {
|
type InstallerProperties struct {
|
||||||
// install to a subdirectory of the default install path for the module
|
// install to a subdirectory of the default install path for the module
|
||||||
Relative_install_path string
|
Relative_install_path string `android:"arch_variant"`
|
||||||
|
|
||||||
// install symlinks to the module
|
// install symlinks to the module
|
||||||
Symlinks []string `android:"arch_variant"`
|
Symlinks []string `android:"arch_variant"`
|
||||||
@@ -50,6 +50,7 @@ type baseInstaller struct {
|
|||||||
|
|
||||||
dir string
|
dir string
|
||||||
dir64 string
|
dir64 string
|
||||||
|
relative string
|
||||||
location installLocation
|
location installLocation
|
||||||
|
|
||||||
path android.OutputPath
|
path android.OutputPath
|
||||||
@@ -69,7 +70,7 @@ func (installer *baseInstaller) install(ctx ModuleContext, file android.Path) {
|
|||||||
if !ctx.Host() && !ctx.Arch().Native {
|
if !ctx.Host() && !ctx.Arch().Native {
|
||||||
subDir = filepath.Join(subDir, ctx.Arch().ArchType.String())
|
subDir = filepath.Join(subDir, ctx.Arch().ArchType.String())
|
||||||
}
|
}
|
||||||
dir := android.PathForModuleInstall(ctx, subDir, installer.Properties.Relative_install_path)
|
dir := android.PathForModuleInstall(ctx, subDir, installer.Properties.Relative_install_path, installer.relative)
|
||||||
installer.path = ctx.InstallFile(dir, file)
|
installer.path = ctx.InstallFile(dir, file)
|
||||||
for _, symlink := range installer.Properties.Symlinks {
|
for _, symlink := range installer.Properties.Symlinks {
|
||||||
ctx.InstallSymlink(dir, symlink, installer.path)
|
ctx.InstallSymlink(dir, symlink, installer.path)
|
||||||
|
17
cc/test.go
17
cc/test.go
@@ -26,7 +26,7 @@ import (
|
|||||||
|
|
||||||
type TestProperties struct {
|
type TestProperties struct {
|
||||||
// if set, build against the gtest library. Defaults to true.
|
// if set, build against the gtest library. Defaults to true.
|
||||||
Gtest bool
|
Gtest *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type TestBinaryProperties struct {
|
type TestBinaryProperties struct {
|
||||||
@@ -116,8 +116,12 @@ type testDecorator struct {
|
|||||||
linker *baseLinker
|
linker *baseLinker
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (test *testDecorator) gtest() bool {
|
||||||
|
return test.Properties.Gtest == nil || *test.Properties.Gtest == true
|
||||||
|
}
|
||||||
|
|
||||||
func (test *testDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
func (test *testDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
||||||
if !test.Properties.Gtest {
|
if !test.gtest() {
|
||||||
return flags
|
return flags
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +147,7 @@ func (test *testDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (test *testDecorator) linkerDeps(ctx BaseModuleContext, deps Deps) Deps {
|
func (test *testDecorator) linkerDeps(ctx BaseModuleContext, deps Deps) Deps {
|
||||||
if test.Properties.Gtest {
|
if test.gtest() {
|
||||||
if ctx.sdk() && ctx.Device() {
|
if ctx.sdk() && ctx.Device() {
|
||||||
switch ctx.selectedStl() {
|
switch ctx.selectedStl() {
|
||||||
case "ndk_libc++_shared", "ndk_libc++_static":
|
case "ndk_libc++_shared", "ndk_libc++_static":
|
||||||
@@ -208,8 +212,9 @@ func (test *testBinary) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (test *testBinary) install(ctx ModuleContext, file android.Path) {
|
func (test *testBinary) install(ctx ModuleContext, file android.Path) {
|
||||||
test.binaryDecorator.baseInstaller.dir = filepath.Join("nativetest", ctx.ModuleName())
|
test.binaryDecorator.baseInstaller.dir = "nativetest"
|
||||||
test.binaryDecorator.baseInstaller.dir64 = filepath.Join("nativetest64", ctx.ModuleName())
|
test.binaryDecorator.baseInstaller.dir64 = "nativetest64"
|
||||||
|
test.binaryDecorator.baseInstaller.relative = ctx.ModuleName()
|
||||||
test.binaryDecorator.baseInstaller.install(ctx, file)
|
test.binaryDecorator.baseInstaller.install(ctx, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +230,6 @@ func NewTest(hod android.HostOrDeviceSupported) *Module {
|
|||||||
binaryDecorator: binary,
|
binaryDecorator: binary,
|
||||||
baseCompiler: NewBaseCompiler(),
|
baseCompiler: NewBaseCompiler(),
|
||||||
}
|
}
|
||||||
test.testDecorator.Properties.Gtest = true
|
|
||||||
module.compiler = test
|
module.compiler = test
|
||||||
module.linker = test
|
module.linker = test
|
||||||
module.installer = test
|
module.installer = test
|
||||||
@@ -267,7 +271,6 @@ func NewTestLibrary(hod android.HostOrDeviceSupported) *Module {
|
|||||||
},
|
},
|
||||||
libraryDecorator: library,
|
libraryDecorator: library,
|
||||||
}
|
}
|
||||||
test.testDecorator.Properties.Gtest = true
|
|
||||||
module.linker = test
|
module.linker = test
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user