Merge "Revert "Add module name to sh_test install path.""
This commit is contained in:
commit
fe25dc9f3b
2 changed files with 7 additions and 17 deletions
|
@ -107,8 +107,6 @@ type ShTest struct {
|
||||||
|
|
||||||
testProperties TestProperties
|
testProperties TestProperties
|
||||||
|
|
||||||
installDir android.InstallPath
|
|
||||||
|
|
||||||
data android.Paths
|
data android.Paths
|
||||||
testConfig android.Path
|
testConfig android.Path
|
||||||
}
|
}
|
||||||
|
@ -203,8 +201,8 @@ func (s *ShTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
} else if !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) {
|
} else if !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) {
|
||||||
testDir = filepath.Join(testDir, ctx.Arch().ArchType.String())
|
testDir = filepath.Join(testDir, ctx.Arch().ArchType.String())
|
||||||
}
|
}
|
||||||
s.installDir = android.PathForModuleInstall(ctx, testDir, proptools.String(s.properties.Sub_dir), s.Name())
|
installDir := android.PathForModuleInstall(ctx, testDir, proptools.String(s.properties.Sub_dir))
|
||||||
s.installedFile = ctx.InstallExecutable(s.installDir, s.outputFilePath.Base(), s.outputFilePath)
|
s.installedFile = ctx.InstallExecutable(installDir, s.outputFilePath.Base(), s.outputFilePath)
|
||||||
|
|
||||||
s.data = android.PathsForModuleSrc(ctx, s.testProperties.Data)
|
s.data = android.PathsForModuleSrc(ctx, s.testProperties.Data)
|
||||||
|
|
||||||
|
@ -232,7 +230,6 @@ func (s *ShTest) AndroidMkEntries() []android.AndroidMkEntries {
|
||||||
func(entries *android.AndroidMkEntries) {
|
func(entries *android.AndroidMkEntries) {
|
||||||
s.customAndroidMkEntries(entries)
|
s.customAndroidMkEntries(entries)
|
||||||
|
|
||||||
entries.SetPath("LOCAL_MODULE_PATH", s.installDir.ToMakePath())
|
|
||||||
entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", s.testProperties.Test_suites...)
|
entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", s.testProperties.Test_suites...)
|
||||||
if s.testConfig != nil {
|
if s.testConfig != nil {
|
||||||
entries.SetPath("LOCAL_FULL_TEST_CONFIG", s.testConfig)
|
entries.SetPath("LOCAL_FULL_TEST_CONFIG", s.testConfig)
|
||||||
|
|
|
@ -55,7 +55,7 @@ func testShBinary(t *testing.T, bp string) (*android.TestContext, android.Config
|
||||||
return ctx, config
|
return ctx, config
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestShTest(t *testing.T) {
|
func TestShTestTestData(t *testing.T) {
|
||||||
ctx, config := testShBinary(t, `
|
ctx, config := testShBinary(t, `
|
||||||
sh_test {
|
sh_test {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
|
@ -71,17 +71,10 @@ func TestShTest(t *testing.T) {
|
||||||
mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest)
|
mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest)
|
||||||
|
|
||||||
entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0]
|
entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0]
|
||||||
|
expected := []string{":testdata/data1", ":testdata/sub/data2"}
|
||||||
expectedPath := "/tmp/target/product/test_device/data/nativetest64/foo"
|
actual := entries.EntryMap["LOCAL_TEST_DATA"]
|
||||||
actualPath := entries.EntryMap["LOCAL_MODULE_PATH"][0]
|
if !reflect.DeepEqual(expected, actual) {
|
||||||
if expectedPath != actualPath {
|
t.Errorf("Unexpected test data expected: %q, actual: %q", expected, actual)
|
||||||
t.Errorf("Unexpected LOCAL_MODULE_PATH expected: %q, actual: %q", expectedPath, actualPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
expectedData := []string{":testdata/data1", ":testdata/sub/data2"}
|
|
||||||
actualData := entries.EntryMap["LOCAL_TEST_DATA"]
|
|
||||||
if !reflect.DeepEqual(expectedData, actualData) {
|
|
||||||
t.Errorf("Unexpected test data expected: %q, actual: %q", expectedData, actualData)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue