summaryrefslogtreecommitdiff
path: root/java/androidmk_test.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2025-02-12 22:42:20 -0800
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2025-02-12 22:42:20 -0800
commita17496cb5d6effeb341f6b95acd5a4d4735642bf (patch)
tree051c99c1fae6383de4b5d2785dbb7a00dd3571c3 /java/androidmk_test.go
parent852f109a206ccc5fdd869de833a97e0d1b9a09a2 (diff)
parent8ea2abcb0ff0f2e23391dbde621d62c0980138e7 (diff)
Merge "Don't panic in ModuleForTests and friends" into main am: 4a80748e09 am: 8ea2abcb0f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3490133 Change-Id: If401bc7e4ed94f982391e49aa059015cbaecca5f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'java/androidmk_test.go')
-rw-r--r--java/androidmk_test.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/java/androidmk_test.go b/java/androidmk_test.go
index 9306e72a3..b4b13b11a 100644
--- a/java/androidmk_test.go
+++ b/java/androidmk_test.go
@@ -32,7 +32,7 @@ func TestRequired(t *testing.T) {
}
`)
- mod := ctx.ModuleForTests("foo", "android_common").Module()
+ mod := ctx.ModuleForTests(t, "foo", "android_common").Module()
entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
expected := []string{"libfoo"}
@@ -52,7 +52,7 @@ func TestHostdex(t *testing.T) {
}
`)
- mod := ctx.ModuleForTests("foo", "android_common").Module()
+ mod := ctx.ModuleForTests(t, "foo", "android_common").Module()
entriesList := android.AndroidMkEntriesForTest(t, ctx, mod)
if len(entriesList) != 2 {
t.Errorf("two entries are expected, but got %d", len(entriesList))
@@ -84,7 +84,7 @@ func TestHostdexRequired(t *testing.T) {
}
`)
- mod := ctx.ModuleForTests("foo", "android_common").Module()
+ mod := ctx.ModuleForTests(t, "foo", "android_common").Module()
entriesList := android.AndroidMkEntriesForTest(t, ctx, mod)
if len(entriesList) != 2 {
t.Errorf("two entries are expected, but got %d", len(entriesList))
@@ -120,7 +120,7 @@ func TestHostdexSpecificRequired(t *testing.T) {
}
`)
- mod := ctx.ModuleForTests("foo", "android_common").Module()
+ mod := ctx.ModuleForTests(t, "foo", "android_common").Module()
entriesList := android.AndroidMkEntriesForTest(t, ctx, mod)
if len(entriesList) != 2 {
t.Errorf("two entries are expected, but got %d", len(entriesList))
@@ -158,7 +158,7 @@ func TestJavaSdkLibrary_RequireXmlPermissionFile(t *testing.T) {
`)
// Verify the existence of internal modules
- result.ModuleForTests("foo-shared_library.xml", "android_common")
+ result.ModuleForTests(t, "foo-shared_library.xml", "android_common")
testCases := []struct {
moduleName string
@@ -168,7 +168,7 @@ func TestJavaSdkLibrary_RequireXmlPermissionFile(t *testing.T) {
{"foo-no_shared_library", []string{"foo-no_shared_library.impl"}},
}
for _, tc := range testCases {
- mod := result.ModuleForTests(tc.moduleName, "android_common").Module()
+ mod := result.ModuleForTests(t, tc.moduleName, "android_common").Module()
entries := android.AndroidMkEntriesForTest(t, result.TestContext, mod)[0]
actual := entries.EntryMap["LOCAL_REQUIRED_MODULES"]
if !reflect.DeepEqual(tc.expected, actual) {
@@ -205,7 +205,7 @@ func TestAndroidTestHelperApp_LocalDisableTestConfig(t *testing.T) {
}
`)
- mod := ctx.ModuleForTests("foo", "android_common").Module()
+ mod := ctx.ModuleForTests(t, "foo", "android_common").Module()
entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
expected := []string{"true"}
@@ -254,7 +254,7 @@ func TestGetOverriddenPackages(t *testing.T) {
}
for _, expected := range expectedVariants {
- mod := ctx.ModuleForTests(expected.name, expected.variantName).Module()
+ mod := ctx.ModuleForTests(t, expected.name, expected.variantName).Module()
entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
actual := entries.EntryMap["LOCAL_OVERRIDES_PACKAGES"]
@@ -304,7 +304,7 @@ func TestJniAsRequiredDeps(t *testing.T) {
}
for _, tc := range testcases {
- mod := ctx.ModuleForTests(tc.name, "android_common").Module()
+ mod := ctx.ModuleForTests(t, tc.name, "android_common").Module()
entries := android.AndroidMkEntriesForTest(t, ctx.TestContext, mod)[0]
required := entries.EntryMap["LOCAL_REQUIRED_MODULES"]
android.AssertDeepEquals(t, "unexpected required deps", tc.expected, required)