Merge "Make testSdkResult compatible with android.TestResult" am: 4cd3d05a0c am: d87a5255a1 am: 4d8205b84b

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1628639

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic4e3ed1b3caef936a8ca0ba45c18843e49e482ec
This commit is contained in:
Paul Duffin 2021-03-11 19:11:45 +00:00 committed by Automerger Merge Worker
commit 439451c5f7
2 changed files with 9 additions and 15 deletions

View File

@ -125,7 +125,7 @@ func TestSdkDependsOnSourceEvenWhenPrebuiltPreferred(t *testing.T) {
`)
// Make sure that the mysdk module depends on "sdkmember" and not "prebuilt_sdkmember".
java.CheckModuleDependencies(t, result.ctx, "mysdk", "android_common", []string{"sdkmember"})
java.CheckModuleDependencies(t, result.TestContext, "mysdk", "android_common", []string{"sdkmember"})
result.CheckSnapshot("mysdk", "",
checkAndroidBpContents(`// This is auto-generated. DO NOT EDIT.
@ -224,11 +224,11 @@ func TestBasicSdkWithJavaLibrary(t *testing.T) {
}
`)
sdkMemberV1 := result.ctx.ModuleForTests("sdkmember_mysdk_1", "android_common").Rule("combineJar").Output
sdkMemberV2 := result.ctx.ModuleForTests("sdkmember_mysdk_2", "android_common").Rule("combineJar").Output
sdkMemberV1 := result.ModuleForTests("sdkmember_mysdk_1", "android_common").Rule("combineJar").Output
sdkMemberV2 := result.ModuleForTests("sdkmember_mysdk_2", "android_common").Rule("combineJar").Output
javalibForMyApex := result.ctx.ModuleForTests("myjavalib", "android_common_apex10000_mysdk_1")
javalibForMyApex2 := result.ctx.ModuleForTests("myjavalib", "android_common_apex10000_mysdk_2")
javalibForMyApex := result.ModuleForTests("myjavalib", "android_common_apex10000_mysdk_1")
javalibForMyApex2 := result.ModuleForTests("myjavalib", "android_common_apex10000_mysdk_2")
// Depending on the uses_sdks value, different libs are linked
ensureListContains(t, pathsToStrings(javalibForMyApex.Rule("javac").Implicits), sdkMemberV1.String())

View File

@ -136,9 +136,8 @@ func runTests(t *testing.T, ctx *android.TestContext, config android.Config) *te
_, errs = ctx.PrepareBuildActions(config)
android.FailIfErrored(t, errs)
return &testSdkResult{
TestHelper: android.TestHelper{T: t},
ctx: ctx,
config: config,
TestHelper: android.TestHelper{T: t},
TestContext: ctx,
}
}
@ -184,8 +183,7 @@ func pathsToStrings(paths android.Paths) []string {
// checking the state of the build structures.
type testSdkResult struct {
android.TestHelper
ctx *android.TestContext
config android.Config
*android.TestContext
}
// Analyse the sdk build rules to extract information about what it is doing.
@ -257,11 +255,7 @@ func (r *testSdkResult) getSdkSnapshotBuildInfo(sdk *sdk) *snapshotBuildInfo {
}
func (r *testSdkResult) Module(name string, variant string) android.Module {
return r.ctx.ModuleForTests(name, variant).Module()
}
func (r *testSdkResult) ModuleForTests(name string, variant string) android.TestingModule {
return r.ctx.ModuleForTests(name, variant)
return r.ModuleForTests(name, variant).Module()
}
// Check the snapshot build rules.