Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 1 | // Copyright 2019 Google Inc. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 15 | package sh |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 16 | |
| 17 | import ( |
| 18 | "fmt" |
Colin Cross | 7c7c114 | 2019-07-29 16:46:49 -0700 | [diff] [blame] | 19 | "path/filepath" |
Julien Desprez | 9e7fc14 | 2019-03-08 11:07:05 -0800 | [diff] [blame] | 20 | "strings" |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 21 | |
| 22 | "github.com/google/blueprint/proptools" |
| 23 | |
| 24 | "android/soong/android" |
frankfeng | c5b8749 | 2020-06-03 10:28:47 -0700 | [diff] [blame] | 25 | "android/soong/tradefed" |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 26 | ) |
| 27 | |
| 28 | // sh_binary is for shell scripts (and batch files) that are installed as |
| 29 | // executable files into .../bin/ |
| 30 | // |
| 31 | // Do not use them for prebuilt C/C++/etc files. Use cc_prebuilt_binary |
| 32 | // instead. |
| 33 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 34 | var pctx = android.NewPackageContext("android/soong/sh") |
| 35 | |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 36 | func init() { |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 37 | pctx.Import("android/soong/android") |
| 38 | |
| 39 | android.RegisterModuleType("sh_binary", ShBinaryFactory) |
| 40 | android.RegisterModuleType("sh_binary_host", ShBinaryHostFactory) |
| 41 | android.RegisterModuleType("sh_test", ShTestFactory) |
| 42 | android.RegisterModuleType("sh_test_host", ShTestHostFactory) |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | type shBinaryProperties struct { |
| 46 | // Source file of this prebuilt. |
Colin Cross | 27b922f | 2019-03-04 22:35:41 -0800 | [diff] [blame] | 47 | Src *string `android:"path,arch_variant"` |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 48 | |
| 49 | // optional subdirectory under which this file is installed into |
| 50 | Sub_dir *string `android:"arch_variant"` |
| 51 | |
| 52 | // optional name for the installed file. If unspecified, name of the module is used as the file name |
| 53 | Filename *string `android:"arch_variant"` |
| 54 | |
| 55 | // when set to true, and filename property is not set, the name for the installed file |
| 56 | // is the same as the file name of the source file. |
| 57 | Filename_from_src *bool `android:"arch_variant"` |
| 58 | |
| 59 | // Whether this module is directly installable to one of the partitions. Default: true. |
| 60 | Installable *bool |
Rashed Abdel-Tawab | 6a34131 | 2019-10-04 20:38:01 -0700 | [diff] [blame] | 61 | |
| 62 | // install symlinks to the binary |
| 63 | Symlinks []string `android:"arch_variant"` |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 64 | } |
| 65 | |
Julien Desprez | 9e7fc14 | 2019-03-08 11:07:05 -0800 | [diff] [blame] | 66 | type TestProperties struct { |
| 67 | // list of compatibility suites (for example "cts", "vts") that the module should be |
| 68 | // installed into. |
| 69 | Test_suites []string `android:"arch_variant"` |
| 70 | |
| 71 | // the name of the test configuration (for example "AndroidTest.xml") that should be |
| 72 | // installed with the module. |
Colin Cross | a638482 | 2020-06-09 15:09:22 -0700 | [diff] [blame] | 73 | Test_config *string `android:"path,arch_variant"` |
Jaewoong Jung | 8eaeb09 | 2019-05-16 14:58:29 -0700 | [diff] [blame] | 74 | |
| 75 | // list of files or filegroup modules that provide data that should be installed alongside |
| 76 | // the test. |
| 77 | Data []string `android:"path,arch_variant"` |
frankfeng | c5b8749 | 2020-06-03 10:28:47 -0700 | [diff] [blame] | 78 | |
| 79 | // Add RootTargetPreparer to auto generated test config. This guarantees the test to run |
| 80 | // with root permission. |
| 81 | Require_root *bool |
| 82 | |
| 83 | // the name of the test configuration template (for example "AndroidTestTemplate.xml") that |
| 84 | // should be installed with the module. |
| 85 | Test_config_template *string `android:"path,arch_variant"` |
| 86 | |
| 87 | // Flag to indicate whether or not to create test config automatically. If AndroidTest.xml |
| 88 | // doesn't exist next to the Android.bp, this attribute doesn't need to be set to true |
| 89 | // explicitly. |
| 90 | Auto_gen_config *bool |
Julien Desprez | 9e7fc14 | 2019-03-08 11:07:05 -0800 | [diff] [blame] | 91 | } |
| 92 | |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 93 | type ShBinary struct { |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 94 | android.ModuleBase |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 95 | |
| 96 | properties shBinaryProperties |
| 97 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 98 | sourceFilePath android.Path |
| 99 | outputFilePath android.OutputPath |
| 100 | installedFile android.InstallPath |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 101 | } |
| 102 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 103 | var _ android.HostToolProvider = (*ShBinary)(nil) |
Colin Cross | 7c7c114 | 2019-07-29 16:46:49 -0700 | [diff] [blame] | 104 | |
Julien Desprez | 9e7fc14 | 2019-03-08 11:07:05 -0800 | [diff] [blame] | 105 | type ShTest struct { |
| 106 | ShBinary |
| 107 | |
| 108 | testProperties TestProperties |
Jaewoong Jung | 8eaeb09 | 2019-05-16 14:58:29 -0700 | [diff] [blame] | 109 | |
frankfeng | c5b8749 | 2020-06-03 10:28:47 -0700 | [diff] [blame] | 110 | data android.Paths |
| 111 | testConfig android.Path |
Julien Desprez | 9e7fc14 | 2019-03-08 11:07:05 -0800 | [diff] [blame] | 112 | } |
| 113 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 114 | func (s *ShBinary) HostToolPath() android.OptionalPath { |
| 115 | return android.OptionalPathForPath(s.installedFile) |
Colin Cross | 7c7c114 | 2019-07-29 16:46:49 -0700 | [diff] [blame] | 116 | } |
| 117 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 118 | func (s *ShBinary) DepsMutator(ctx android.BottomUpMutatorContext) { |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 119 | if s.properties.Src == nil { |
| 120 | ctx.PropertyErrorf("src", "missing prebuilt source file") |
| 121 | } |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 122 | } |
| 123 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 124 | func (s *ShBinary) OutputFile() android.OutputPath { |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 125 | return s.outputFilePath |
| 126 | } |
| 127 | |
| 128 | func (s *ShBinary) SubDir() string { |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 129 | return proptools.String(s.properties.Sub_dir) |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 130 | } |
| 131 | |
| 132 | func (s *ShBinary) Installable() bool { |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 133 | return s.properties.Installable == nil || proptools.Bool(s.properties.Installable) |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 134 | } |
| 135 | |
Rashed Abdel-Tawab | 6a34131 | 2019-10-04 20:38:01 -0700 | [diff] [blame] | 136 | func (s *ShBinary) Symlinks() []string { |
| 137 | return s.properties.Symlinks |
| 138 | } |
| 139 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 140 | func (s *ShBinary) generateAndroidBuildActions(ctx android.ModuleContext) { |
| 141 | s.sourceFilePath = android.PathForModuleSrc(ctx, proptools.String(s.properties.Src)) |
| 142 | filename := proptools.String(s.properties.Filename) |
| 143 | filename_from_src := proptools.Bool(s.properties.Filename_from_src) |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 144 | if filename == "" { |
| 145 | if filename_from_src { |
| 146 | filename = s.sourceFilePath.Base() |
| 147 | } else { |
| 148 | filename = ctx.ModuleName() |
| 149 | } |
| 150 | } else if filename_from_src { |
| 151 | ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true") |
| 152 | return |
| 153 | } |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 154 | s.outputFilePath = android.PathForModuleOut(ctx, filename).OutputPath |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 155 | |
| 156 | // This ensures that outputFilePath has the correct name for others to |
| 157 | // use, as the source file may have a different name. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 158 | ctx.Build(pctx, android.BuildParams{ |
| 159 | Rule: android.CpExecutable, |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 160 | Output: s.outputFilePath, |
| 161 | Input: s.sourceFilePath, |
| 162 | }) |
| 163 | } |
| 164 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 165 | func (s *ShBinary) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
Colin Cross | 7c7c114 | 2019-07-29 16:46:49 -0700 | [diff] [blame] | 166 | s.generateAndroidBuildActions(ctx) |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 167 | installDir := android.PathForModuleInstall(ctx, "bin", proptools.String(s.properties.Sub_dir)) |
Colin Cross | 7c7c114 | 2019-07-29 16:46:49 -0700 | [diff] [blame] | 168 | s.installedFile = ctx.InstallExecutable(installDir, s.outputFilePath.Base(), s.outputFilePath) |
| 169 | } |
| 170 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 171 | func (s *ShBinary) AndroidMkEntries() []android.AndroidMkEntries { |
| 172 | return []android.AndroidMkEntries{android.AndroidMkEntries{ |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 173 | Class: "EXECUTABLES", |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 174 | OutputFile: android.OptionalPathForPath(s.outputFilePath), |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 175 | Include: "$(BUILD_SYSTEM)/soong_cc_prebuilt.mk", |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 176 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
| 177 | func(entries *android.AndroidMkEntries) { |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 178 | s.customAndroidMkEntries(entries) |
| 179 | }, |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 180 | }, |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 181 | }} |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 182 | } |
| 183 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 184 | func (s *ShBinary) customAndroidMkEntries(entries *android.AndroidMkEntries) { |
| 185 | entries.SetString("LOCAL_MODULE_RELATIVE_PATH", proptools.String(s.properties.Sub_dir)) |
Jaewoong Jung | 8eaeb09 | 2019-05-16 14:58:29 -0700 | [diff] [blame] | 186 | entries.SetString("LOCAL_MODULE_SUFFIX", "") |
| 187 | entries.SetString("LOCAL_MODULE_STEM", s.outputFilePath.Rel()) |
Rashed Abdel-Tawab | 6a34131 | 2019-10-04 20:38:01 -0700 | [diff] [blame] | 188 | if len(s.properties.Symlinks) > 0 { |
| 189 | entries.SetString("LOCAL_MODULE_SYMLINKS", strings.Join(s.properties.Symlinks, " ")) |
| 190 | } |
Jaewoong Jung | 8eaeb09 | 2019-05-16 14:58:29 -0700 | [diff] [blame] | 191 | } |
| 192 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 193 | func (s *ShTest) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
Colin Cross | 7c7c114 | 2019-07-29 16:46:49 -0700 | [diff] [blame] | 194 | s.ShBinary.generateAndroidBuildActions(ctx) |
| 195 | testDir := "nativetest" |
| 196 | if ctx.Target().Arch.ArchType.Multilib == "lib64" { |
| 197 | testDir = "nativetest64" |
| 198 | } |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 199 | if ctx.Target().NativeBridge == android.NativeBridgeEnabled { |
Colin Cross | 7c7c114 | 2019-07-29 16:46:49 -0700 | [diff] [blame] | 200 | testDir = filepath.Join(testDir, ctx.Target().NativeBridgeRelativePath) |
| 201 | } else if !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) { |
| 202 | testDir = filepath.Join(testDir, ctx.Arch().ArchType.String()) |
| 203 | } |
Michael Butler | 0c55445 | 2020-06-11 20:53:40 +0000 | [diff] [blame] | 204 | installDir := android.PathForModuleInstall(ctx, testDir, proptools.String(s.properties.Sub_dir)) |
| 205 | s.installedFile = ctx.InstallExecutable(installDir, s.outputFilePath.Base(), s.outputFilePath) |
Jaewoong Jung | 8eaeb09 | 2019-05-16 14:58:29 -0700 | [diff] [blame] | 206 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 207 | s.data = android.PathsForModuleSrc(ctx, s.testProperties.Data) |
frankfeng | c5b8749 | 2020-06-03 10:28:47 -0700 | [diff] [blame] | 208 | |
| 209 | var configs []tradefed.Config |
| 210 | if Bool(s.testProperties.Require_root) { |
| 211 | configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.RootTargetPreparer", nil}) |
| 212 | } else { |
| 213 | options := []tradefed.Option{{Name: "force-root", Value: "false"}} |
| 214 | configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.RootTargetPreparer", options}) |
| 215 | } |
| 216 | s.testConfig = tradefed.AutoGenShellTestConfig(ctx, s.testProperties.Test_config, |
| 217 | s.testProperties.Test_config_template, s.testProperties.Test_suites, configs, s.testProperties.Auto_gen_config, s.outputFilePath.Base()) |
Jaewoong Jung | 8eaeb09 | 2019-05-16 14:58:29 -0700 | [diff] [blame] | 218 | } |
| 219 | |
Colin Cross | 7c7c114 | 2019-07-29 16:46:49 -0700 | [diff] [blame] | 220 | func (s *ShTest) InstallInData() bool { |
| 221 | return true |
| 222 | } |
| 223 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 224 | func (s *ShTest) AndroidMkEntries() []android.AndroidMkEntries { |
| 225 | return []android.AndroidMkEntries{android.AndroidMkEntries{ |
Jaewoong Jung | 8eaeb09 | 2019-05-16 14:58:29 -0700 | [diff] [blame] | 226 | Class: "NATIVE_TESTS", |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 227 | OutputFile: android.OptionalPathForPath(s.outputFilePath), |
Jaewoong Jung | 8eaeb09 | 2019-05-16 14:58:29 -0700 | [diff] [blame] | 228 | Include: "$(BUILD_SYSTEM)/soong_cc_prebuilt.mk", |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 229 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
| 230 | func(entries *android.AndroidMkEntries) { |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 231 | s.customAndroidMkEntries(entries) |
Jaewoong Jung | 8eaeb09 | 2019-05-16 14:58:29 -0700 | [diff] [blame] | 232 | |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 233 | entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", s.testProperties.Test_suites...) |
Colin Cross | a638482 | 2020-06-09 15:09:22 -0700 | [diff] [blame] | 234 | if s.testConfig != nil { |
| 235 | entries.SetPath("LOCAL_FULL_TEST_CONFIG", s.testConfig) |
frankfeng | c5b8749 | 2020-06-03 10:28:47 -0700 | [diff] [blame] | 236 | } |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 237 | for _, d := range s.data { |
| 238 | rel := d.Rel() |
| 239 | path := d.String() |
| 240 | if !strings.HasSuffix(path, rel) { |
| 241 | panic(fmt.Errorf("path %q does not end with %q", path, rel)) |
| 242 | } |
| 243 | path = strings.TrimSuffix(path, rel) |
| 244 | entries.AddStrings("LOCAL_TEST_DATA", path+":"+rel) |
Jaewoong Jung | 8eaeb09 | 2019-05-16 14:58:29 -0700 | [diff] [blame] | 245 | } |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 246 | }, |
Jaewoong Jung | 8eaeb09 | 2019-05-16 14:58:29 -0700 | [diff] [blame] | 247 | }, |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 248 | }} |
Julien Desprez | 9e7fc14 | 2019-03-08 11:07:05 -0800 | [diff] [blame] | 249 | } |
| 250 | |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 251 | func InitShBinaryModule(s *ShBinary) { |
| 252 | s.AddProperties(&s.properties) |
| 253 | } |
| 254 | |
Patrice Arruda | e103419 | 2019-03-11 13:20:17 -0700 | [diff] [blame] | 255 | // sh_binary is for a shell script or batch file to be installed as an |
| 256 | // executable binary to <partition>/bin. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 257 | func ShBinaryFactory() android.Module { |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 258 | module := &ShBinary{} |
| 259 | InitShBinaryModule(module) |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 260 | android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibFirst) |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 261 | return module |
| 262 | } |
| 263 | |
Patrice Arruda | e103419 | 2019-03-11 13:20:17 -0700 | [diff] [blame] | 264 | // sh_binary_host is for a shell script to be installed as an executable binary |
| 265 | // to $(HOST_OUT)/bin. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 266 | func ShBinaryHostFactory() android.Module { |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 267 | module := &ShBinary{} |
| 268 | InitShBinaryModule(module) |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 269 | android.InitAndroidArchModule(module, android.HostSupported, android.MultilibFirst) |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 270 | return module |
| 271 | } |
Julien Desprez | 9e7fc14 | 2019-03-08 11:07:05 -0800 | [diff] [blame] | 272 | |
Jaewoong Jung | 61a8368 | 2019-07-01 09:08:50 -0700 | [diff] [blame] | 273 | // sh_test defines a shell script based test module. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 274 | func ShTestFactory() android.Module { |
Julien Desprez | 9e7fc14 | 2019-03-08 11:07:05 -0800 | [diff] [blame] | 275 | module := &ShTest{} |
| 276 | InitShBinaryModule(&module.ShBinary) |
| 277 | module.AddProperties(&module.testProperties) |
| 278 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 279 | android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibFirst) |
Julien Desprez | 9e7fc14 | 2019-03-08 11:07:05 -0800 | [diff] [blame] | 280 | return module |
| 281 | } |
Jaewoong Jung | 61a8368 | 2019-07-01 09:08:50 -0700 | [diff] [blame] | 282 | |
| 283 | // sh_test_host defines a shell script based test module that runs on a host. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 284 | func ShTestHostFactory() android.Module { |
Jaewoong Jung | 61a8368 | 2019-07-01 09:08:50 -0700 | [diff] [blame] | 285 | module := &ShTest{} |
| 286 | InitShBinaryModule(&module.ShBinary) |
| 287 | module.AddProperties(&module.testProperties) |
| 288 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 289 | android.InitAndroidArchModule(module, android.HostSupported, android.MultilibFirst) |
Jaewoong Jung | 61a8368 | 2019-07-01 09:08:50 -0700 | [diff] [blame] | 290 | return module |
| 291 | } |
frankfeng | c5b8749 | 2020-06-03 10:28:47 -0700 | [diff] [blame] | 292 | |
| 293 | var Bool = proptools.Bool |