summaryrefslogtreecommitdiff
path: root/sh/sh_binary.go
diff options
context:
space:
mode:
author Jaewoong Jung <jungjw@google.com> 2020-06-10 17:23:46 -0700
committer Jaewoong Jung <jungjw@google.com> 2020-06-18 17:15:48 -0700
commit4aedc86c6c9a24c74ecabf380b7b0b12f66f589e (patch)
tree596ecf8fbf4586962917f86dbe4a6180c732ef10 /sh/sh_binary.go
parent0e63a8e76180fe7a92000b6aa3bc0d5e64e2c564 (diff)
Add module name to sh_test install path.
This relands Ibb1d774709ea421e18d5350009c203f83c5b2d60 after fixing a backward compatibility issue where some test configs rely on sh_tests not having a module name in their paths when sub_dir is specified. Bug: 156980228 Test: m ziptool-tests Test: sh_binary_test.go Change-Id: If0521a008e7170d94b601f3df9dd0c12d1c96d21
Diffstat (limited to 'sh/sh_binary.go')
-rw-r--r--sh/sh_binary.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/sh/sh_binary.go b/sh/sh_binary.go
index 7bb267da2..f28b2b685 100644
--- a/sh/sh_binary.go
+++ b/sh/sh_binary.go
@@ -107,6 +107,8 @@ type ShTest struct {
testProperties TestProperties
+ installDir android.InstallPath
+
data android.Paths
testConfig android.Path
}
@@ -176,13 +178,13 @@ func (s *ShBinary) AndroidMkEntries() []android.AndroidMkEntries {
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) {
s.customAndroidMkEntries(entries)
+ entries.SetString("LOCAL_MODULE_RELATIVE_PATH", proptools.String(s.properties.Sub_dir))
},
},
}}
}
func (s *ShBinary) customAndroidMkEntries(entries *android.AndroidMkEntries) {
- entries.SetString("LOCAL_MODULE_RELATIVE_PATH", proptools.String(s.properties.Sub_dir))
entries.SetString("LOCAL_MODULE_SUFFIX", "")
entries.SetString("LOCAL_MODULE_STEM", s.outputFilePath.Rel())
if len(s.properties.Symlinks) > 0 {
@@ -201,8 +203,14 @@ func (s *ShTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
} else if !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) {
testDir = filepath.Join(testDir, ctx.Arch().ArchType.String())
}
- installDir := android.PathForModuleInstall(ctx, testDir, proptools.String(s.properties.Sub_dir))
- s.installedFile = ctx.InstallExecutable(installDir, s.outputFilePath.Base(), s.outputFilePath)
+ if s.SubDir() != "" {
+ // Don't add the module name to the installation path if sub_dir is specified for backward
+ // compatibility.
+ s.installDir = android.PathForModuleInstall(ctx, testDir, s.SubDir())
+ } else {
+ s.installDir = android.PathForModuleInstall(ctx, testDir, s.Name())
+ }
+ s.installedFile = ctx.InstallExecutable(s.installDir, s.outputFilePath.Base(), s.outputFilePath)
s.data = android.PathsForModuleSrc(ctx, s.testProperties.Data)
@@ -229,7 +237,7 @@ func (s *ShTest) AndroidMkEntries() []android.AndroidMkEntries {
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) {
s.customAndroidMkEntries(entries)
-
+ entries.SetPath("LOCAL_MODULE_PATH", s.installDir.ToMakePath())
entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", s.testProperties.Test_suites...)
if s.testConfig != nil {
entries.SetPath("LOCAL_FULL_TEST_CONFIG", s.testConfig)