• Home
  • Raw
  • Download

Lines Matching refs:t

103 func run(t *testing.T, ctx *android.TestContext, config android.Config) {
104 t.Helper()
111 android.FailIfErrored(t, errs)
113 android.FailIfErrored(t, errs)
116 func testJavaError(t *testing.T, pattern string, bp string) (*android.TestContext, android.Config) {
117 t.Helper()
118 return testJavaErrorWithConfig(t, pattern, testConfig(nil, bp, nil))
121 func testJavaErrorWithConfig(t *testing.T, pattern string, config android.Config) (*android.TestCon…
122 t.Helper()
131 android.FailIfNoMatchingErrors(t, pattern, errs)
136 android.FailIfNoMatchingErrors(t, pattern, errs)
140 t.Fatalf("missing expected error %q (0 errors are returned)", pattern)
145 func testJavaWithFS(t *testing.T, bp string, fs map[string][]byte) (*android.TestContext, android.C…
146 t.Helper()
147 return testJavaWithConfig(t, testConfig(nil, bp, fs))
150 func testJava(t *testing.T, bp string) (*android.TestContext, android.Config) {
151 t.Helper()
152 return testJavaWithFS(t, bp, nil)
155 func testJavaWithConfig(t *testing.T, config android.Config) (*android.TestContext, android.Config)…
156 t.Helper()
158 run(t, ctx, config)
174 func TestJavaLinkType(t *testing.T) {
175 testJava(t, `
196 …testJavaError(t, "Adjust sdk_version: property of the source or target module so that target modul…
218 testJava(t, `
240 …testJavaError(t, "Adjust sdk_version: property of the source or target module so that target modul…
262 func TestSimple(t *testing.T) {
263 ctx, _ := testJava(t, `
286 t.Errorf(`foo inputs %v != ["a.java"]`, javac.Inputs)
294 t.Errorf("foo classpath %v does not contain %q", javac.Args["classpath"], barTurbine)
298 t.Errorf("foo classpath %v does not contain %q", javac.Args["classpath"], bazTurbine)
302 t.Errorf("foo combineJar inputs %v does not contain %q", combineJar.Inputs, baz)
306 func TestExportedPlugins(t *testing.T) {
371 t.Run(test.name, func(t *testing.T) {
372 ctx, _ := testJava(t, `
382t.Errorf("For library %v, expected %v, found %v", want.library, want.processors, javac.Args["proce…
389 func TestSdkVersionByPartition(t *testing.T) {
390 testJavaError(t, "sdk_version must have a value when the module is located at vendor or product", `
398 testJava(t, `
417 …testJavaErrorWithConfig(t, "sdk_version must have a value when the module is located at vendor or …
419 testJavaWithConfig(t, config)
424 func TestArchSpecific(t *testing.T) {
425 ctx, _ := testJava(t, `
439 t.Errorf(`foo inputs %v != ["a.java", "b.java"]`, javac.Inputs)
443 func TestBinary(t *testing.T) {
444 ctx, _ := testJava(t, `
466 t.Errorf("expected binary wrapper implicits [%q], got %v",
472 func TestPrebuilts(t *testing.T) {
473 ctx, _ := testJava(t, `
524 assertDeepEquals(t, "foo java sources incorrect",
527 assertDeepEquals(t, "foo java source jars incorrect",
532 t.Errorf("foo classpath %v does not contain %q", javac.Args["classpath"], barJar.String())
536 t.Errorf("foo classpath %v does not contain %q", javac.Args["classpath"], sdklibStubsJar.String())
540 t.Errorf("foo combineJar inputs %v does not contain %q", combineJar.Inputs, bazJar.String())
546 func assertDeepEquals(t *testing.T, message string, expected interface{}, actual interface{}) {
548 t.Errorf("%s: expected %q, found %q", message, expected, actual)
552 func TestJavaSdkLibraryImport(t *testing.T) {
553 ctx, _ := testJava(t, `
596t.Errorf("foo classpath %v does not contain %q", javac.Args["classpath"], sdklibStubsJar.String())
601 func TestDefaults(t *testing.T) {
602 ctx, _ := testJava(t, `
647 t.Errorf(`foo inputs %v != ["a.java"]`, javac.Inputs)
652 t.Errorf("foo classpath %v does not contain %q", javac.Args["classpath"], barTurbine)
657 t.Errorf("foo combineJar inputs %v does not contain %q", combineJar.Inputs, baz)
662 t.Errorf("atestOptimize should optimize APK")
667 t.Errorf("atestNoOptimize should not optimize APK")
672 t.Errorf("atestDefault should optimize APK")
676 func TestResources(t *testing.T) {
747 t.Run(test.name, func(t *testing.T) {
748 ctx, _ := testJavaWithFS(t, `
770 t.Errorf("foo combined jars %v does not contain %q",
775 t.Errorf("foo resource jar args %q is not %q",
782 func TestIncludeSrcs(t *testing.T) {
783 ctx, _ := testJavaWithFS(t, `
815 t.Errorf("foo combined jars %v does not contain %q", w, g)
819 t.Errorf("foo source jar args %q is not %q", w, g)
829 t.Errorf("bar combined resource jars %v does not contain %q", w, g)
833 t.Errorf("bar combined resource jars %v does not contain %q", w, g)
837 t.Errorf("bar combined jars %v does not contain %q", w, g)
841 t.Errorf("bar source jar args %q is not %q", w, g)
845 t.Errorf("bar resource jar args %q is not %q", w, g)
849 func TestGeneratedSources(t *testing.T) {
850 ctx, _ := testJavaWithFS(t, `
874 t.Fatalf(`gen output file %v is not ".../gen.java"`, genrule.Output.String())
881 t.Errorf(`foo inputs %v != ["a.java", ".../gen.java", "b.java"]`, javac.Inputs)
885 func TestTurbine(t *testing.T) {
886 ctx, _ := testJava(t, `
915 t.Errorf(`foo inputs %v != ["a.java"]`, fooTurbine.Inputs)
920t.Errorf("bar turbine classpath %v does not contain %q", barTurbine.Args["classpath"], fooHeaderJa…
923 t.Errorf("bar javac classpath %v does not contain %q", barJavac.Args["classpath"], fooHeaderJar)
926t.Errorf("bar turbine combineJar inputs %v does not contain %q", barTurbineCombined.Inputs, fooHea…
929 t.Errorf("baz javac classpath %v does not contain %q", bazJavac.Args["classpath"],
934 func TestSharding(t *testing.T) {
935 ctx, _ := testJava(t, `
947 t.Errorf("bar javac classpath %v does not contain %q", barJavac.Args["classpath"], barHeaderJar)
952 func TestDroiddoc(t *testing.T) {
953 ctx, _ := testJavaWithFS(t, `
996 t.Errorf("inputs of bar-doc must be []string{\"a.java\"}, but was %#v.", javaSrcs)
1001 t.Errorf("implicits of bar-doc must contain %q, but was %q.", w, g)
1005 t.Errorf("aidl inputs must be %q, but was %q", w, g)
1009 func TestDroidstubs(t *testing.T) {
1010 ctx, _ := testJavaWithFS(t, `
1060t.Errorf("For %q, expected metalava argument %q, but was not found %q", c.moduleName, expected, ac…
1065 func TestDroidstubsWithSystemModules(t *testing.T) {
1066 ctx, _ := testJava(t, `
1108 checkSystemModulesUseByDroidstubs(t, ctx, "stubs-source-system-modules", "source-jar.jar")
1110 checkSystemModulesUseByDroidstubs(t, ctx, "stubs-prebuilt-system-modules", "prebuilt-jar.jar")
1113 func checkSystemModulesUseByDroidstubs(t *testing.T, ctx *android.TestContext, moduleName string, s…
1120 t.Errorf("inputs of %q must be []string{%q}, but was %#v.", moduleName, systemJar, systemJars)
1124 func TestJarGenrules(t *testing.T) {
1125 ctx, _ := testJava(t, `
1159 t.Errorf("expected jargen inputs [%q], got %q", foo.Output.String(), jargen.Inputs.Strings())
1163 t.Errorf("bar classpath %v does not contain %q", bar.Args["classpath"], jargen.Output.String())
1167 t.Errorf("baz classpath %v does not contain %q", baz.Args["classpath"], jargen.Output.String())
1173 t.Errorf("bar combined jar inputs %v is not [%q, %q]",
1178 func TestExcludeFileGroupInSrcs(t *testing.T) {
1179 ctx, _ := testJava(t, `
1200 t.Errorf(`foo inputs %v != ["java-fg/c.java"]`, javac.Inputs)
1204 func TestJavaLibrary(t *testing.T) {
1214 run(t, ctx, config)
1217 func TestJavaSdkLibrary(t *testing.T) {
1218 ctx, _ := testJava(t, `
1304 t.Errorf("baz javac classpath %v does not contain %q", bazJavac.Args["classpath"],
1309 t.Errorf("baz javac classpath %v should not contain %q", bazJavac.Args["classpath"],
1314 t.Errorf("baz javac classpath %v should not contain %q", bazJavac.Args["classpath"],
1321 t.Errorf("baz-test javac classpath %v does not contain %q", bazTestJavac.Args["classpath"],
1328 t.Errorf("baz-29 javac classpath %v does not contain %q", baz29Javac.Args["classpath"],
1338 t.Errorf("qux should export %q but exports %q", w, sdkLibs)
1343 func TestJavaSdkLibrary_DoNotAccessImplWhenItIsNotBuilt(t *testing.T) {
1344 ctx, _ := testJava(t, `
1364 t.Errorf("expected %q, found %#q", expected, actual)
1368 func TestJavaSdkLibrary_UseSourcesFromAnotherSdkLibrary(t *testing.T) {
1369 testJava(t, `
1386 func TestJavaSdkLibrary_AccessOutputFiles_MissingScope(t *testing.T) {
1387 testJavaError(t, `"foo" does not provide api scope system`, `
1404 func TestJavaSdkLibraryImport_AccessOutputFiles(t *testing.T) {
1405 testJava(t, `
1427 func TestJavaSdkLibraryImport_AccessOutputFiles_Invalid(t *testing.T) {
1437 t.Run("stubs.source", func(t *testing.T) {
1438 testJavaError(t, `stubs.source not available for api scope public`, bp+`
1450 t.Run("api.txt", func(t *testing.T) {
1451 testJavaError(t, `api.txt not available for api scope public`, bp+`
1462 t.Run("removed-api.txt", func(t *testing.T) {
1463 testJavaError(t, `removed-api.txt not available for api scope public`, bp+`
1475 func TestJavaSdkLibrary_InvalidScopes(t *testing.T) {
1476 testJavaError(t, `module "foo": enabled api scope "system" depends on disabled scope "public"`, `
1493 func TestJavaSdkLibrary_SdkVersion_ForScope(t *testing.T) {
1494 testJava(t, `
1507 func TestJavaSdkLibrary_ModuleLib(t *testing.T) {
1508 testJava(t, `
1523 func TestJavaSdkLibrary_SystemServer(t *testing.T) {
1524 testJava(t, `
1539 func TestJavaSdkLibrary_MissingScope(t *testing.T) {
1540 testJavaError(t, `requires api scope module-lib from foo but it only has \[\] available`, `
1558 func TestJavaSdkLibrary_FallbackScope(t *testing.T) {
1559 testJava(t, `
1578 func TestJavaSdkLibrary_DefaultToStubs(t *testing.T) {
1579 ctx, _ := testJava(t, `
1601 t.Errorf("expected %q, found %#q", expected, actual)
1653 func TestCompilerFlags(t *testing.T) {
1658 t.Errorf("incorrect output:")
1659 t.Errorf(" input: %#v", testCase.in)
1660 t.Errorf(" expected: %#v", testCase.out)
1661 t.Errorf(" got: %#v", ctx.result)
1667 func checkPatchModuleFlag(t *testing.T, ctx *android.TestContext, moduleName string, expected strin…
1679t.Errorf("Unexpected patch-module flag for module %q - expected %q, but got %q", moduleName, expec…
1683 func TestPatchModule(t *testing.T) {
1684 t.Run("Java language level 8", func(t *testing.T) {
1709 ctx, _ := testJava(t, bp)
1711 checkPatchModuleFlag(t, ctx, "foo", "")
1712 checkPatchModuleFlag(t, ctx, "bar", "")
1713 checkPatchModuleFlag(t, ctx, "baz", "")
1716 t.Run("Java language level 9", func(t *testing.T) {
1738 ctx, _ := testJava(t, bp)
1740 checkPatchModuleFlag(t, ctx, "foo", "")
1742 checkPatchModuleFlag(t, ctx, "bar", expected)
1744 checkPatchModuleFlag(t, ctx, "baz", expected)
1748 func TestJavaSystemModules(t *testing.T) {
1749 ctx, _ := testJava(t, `
1776 t.Errorf("system modules classpath %v does not contain %q", cmd.Args["classpath"],
1782 func TestJavaSystemModulesImport(t *testing.T) {
1783 ctx, _ := testJava(t, `
1806 t.Errorf("system modules classpath %v does not contain %q", cmd.Args["classpath"],
1812 func TestJavaLibraryWithSystemModules(t *testing.T) {
1813 ctx, _ := testJava(t, `
1855 checkBootClasspathForSystemModule(t, ctx, "lib-with-source-system-modules", "/source-jar.jar")
1857 checkBootClasspathForSystemModule(t, ctx, "lib-with-prebuilt-system-modules", "/prebuilt-jar.jar")
1860 func checkBootClasspathForSystemModule(t *testing.T, ctx *android.TestContext, moduleName string, e…
1864t.Errorf("bootclasspath of %q must start with --system and end with %q, but was %#v.", moduleName,…