Allow disabling the named test directory for cc_test

am: 3340d6091c

Change-Id: I28da1f2dcd16d819b2d305e956ebb6a1e7b38603
This commit is contained in:
Dan Willemsen 2016-12-28 00:23:04 +00:00 committed by android-build-merger
commit 05c9309409

View file

@ -33,6 +33,11 @@ type TestBinaryProperties struct {
// Create a separate binary for each source file. Useful when there is
// global state that can not be torn down and reset between each test suite.
Test_per_src *bool
// Disables the creation of a test-specific directory when used with
// relative_install_path. Useful if several tests need to be in the same
// directory, but test_per_src doesn't work.
No_named_install_directory *bool
}
func init() {
@ -214,7 +219,13 @@ func (test *testBinary) linkerFlags(ctx ModuleContext, flags Flags) Flags {
func (test *testBinary) install(ctx ModuleContext, file android.Path) {
test.binaryDecorator.baseInstaller.dir = "nativetest"
test.binaryDecorator.baseInstaller.dir64 = "nativetest64"
if !Bool(test.Properties.No_named_install_directory) {
test.binaryDecorator.baseInstaller.relative = ctx.ModuleName()
} else if test.binaryDecorator.baseInstaller.Properties.Relative_install_path == "" {
ctx.PropertyErrorf("no_named_install_directory", "Module install directory may only be disabled if relative_install_path is set")
}
test.binaryDecorator.baseInstaller.install(ctx, file)
}