Merge "Convert system modules tests to use fixtures" am: 6f688d03c8 am: df0b483089

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib4aebc9e5b74c373a6072286a454ed721e53be7f
This commit is contained in:
Paul Duffin 2021-03-11 15:41:41 +00:00 committed by Automerger Merge Worker
commit fea2bed0f8
1 changed files with 6 additions and 13 deletions

View File

@ -15,12 +15,11 @@
package java package java
import ( import (
"strings"
"testing" "testing"
) )
func TestJavaSystemModules(t *testing.T) { func TestJavaSystemModules(t *testing.T) {
ctx, _ := testJava(t, ` result := javaFixtureFactory.RunTestWithBp(t, `
java_system_modules { java_system_modules {
name: "system-modules", name: "system-modules",
libs: ["system-module1", "system-module2"], libs: ["system-module1", "system-module2"],
@ -40,21 +39,18 @@ func TestJavaSystemModules(t *testing.T) {
`) `)
// check the existence of the module // check the existence of the module
systemModules := ctx.ModuleForTests("system-modules", "android_common") systemModules := result.ModuleForTests("system-modules", "android_common")
cmd := systemModules.Rule("jarsTosystemModules") cmd := systemModules.Rule("jarsTosystemModules")
// make sure the command compiles against the supplied modules. // make sure the command compiles against the supplied modules.
for _, module := range []string{"system-module1.jar", "system-module2.jar"} { for _, module := range []string{"system-module1.jar", "system-module2.jar"} {
if !strings.Contains(cmd.Args["classpath"], module) { result.AssertStringDoesContain("system modules classpath", cmd.Args["classpath"], module)
t.Errorf("system modules classpath %v does not contain %q", cmd.Args["classpath"],
module)
}
} }
} }
func TestJavaSystemModulesImport(t *testing.T) { func TestJavaSystemModulesImport(t *testing.T) {
ctx, _ := testJava(t, ` result := javaFixtureFactory.RunTestWithBp(t, `
java_system_modules_import { java_system_modules_import {
name: "system-modules", name: "system-modules",
libs: ["system-module1", "system-module2"], libs: ["system-module1", "system-module2"],
@ -70,15 +66,12 @@ func TestJavaSystemModulesImport(t *testing.T) {
`) `)
// check the existence of the module // check the existence of the module
systemModules := ctx.ModuleForTests("system-modules", "android_common") systemModules := result.ModuleForTests("system-modules", "android_common")
cmd := systemModules.Rule("jarsTosystemModules") cmd := systemModules.Rule("jarsTosystemModules")
// make sure the command compiles against the supplied modules. // make sure the command compiles against the supplied modules.
for _, module := range []string{"system-module1.jar", "system-module2.jar"} { for _, module := range []string{"system-module1.jar", "system-module2.jar"} {
if !strings.Contains(cmd.Args["classpath"], module) { result.AssertStringDoesContain("system modules classpath", cmd.Args["classpath"], module)
t.Errorf("system modules classpath %v does not contain %q", cmd.Args["classpath"],
module)
}
} }
} }