aboutsummaryrefslogtreecommitdiffstats
path: root/cc/test.go
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2016-12-27 14:40:40 -0800
committerDan Willemsen <dwillemsen@google.com>2016-12-27 14:40:40 -0800
commit3340d6091c108e93d29c19a347e152b6cc8ee930 (patch)
tree47fabab465a2e174ffa07ba85b48fea720495fcc /cc/test.go
parentb527d5dfbee674f27af905f1200186c45b44fb57 (diff)
downloadbuild_soong-3340d6091c108e93d29c19a347e152b6cc8ee930.tar.gz
build_soong-3340d6091c108e93d29c19a347e152b6cc8ee930.tar.bz2
build_soong-3340d6091c108e93d29c19a347e152b6cc8ee930.zip
Allow disabling the named test directory for cc_test
Some external test suites (LTP in this case), have their own expected layout, and don't fit well with our /data/nativetest/<testname>/<testname> layout, nor do they work with test_per_src. So allow setting no_named_install_directory along with relative_module_path to specify a custom test path: no_named_install_directory: true, relative_module_path: "ltp/testcases/bin", Test: Convert LTP Change-Id: Ib002c058674e8b960a4fdc3af1a25c8bcaeb1d63
Diffstat (limited to 'cc/test.go')
-rw-r--r--cc/test.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/cc/test.go b/cc/test.go
index 07eb621a..f60996c7 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -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"
- test.binaryDecorator.baseInstaller.relative = ctx.ModuleName()
+
+ 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)
}