Lines Matching refs:t

59 func testApp(t *testing.T, bp string) *android.TestContext {
64 run(t, ctx, config)
69 func TestApp(t *testing.T) {
71 t.Run(moduleType, func(t *testing.T) {
72 ctx := testApp(t, moduleType+` {
93 t.Errorf("expected aapt2 compile inputs expected:\n %#v\n got:\n %#v",
108 t.Errorf("expected aapt2 link implicits expected:\n %#v\n got:\n %#v",
115 func TestAppSplits(t *testing.T) {
116 ctx := testApp(t, `
137 t.Fatal(err)
140 t.Errorf(`want OutputFiles("") = %q, got %q`, w, g)
144 func TestAndroidAppSet(t *testing.T) {
145 ctx, config := testJava(t, `
155 t.Errorf("expected output %s is missing", packedSplitApks)
158 t.Errorf("wrong allow-prereleased value: '%s', expected 'true'", s)
161 t.Errorf("wrong partition value: '%s', expected 'system'", s)
163 mkEntries := android.AndroidMkEntriesForTest(t, config, "", module.Module())[0]
167 t.Errorf("Unexpected LOCAL_APK_SET_INSTALL_FILE value: '%s', expected: '%s',",
172 func TestAndroidAppSet_Variants(t *testing.T) {
222 run(t, ctx, config)
228 t.Errorf("%s: bad build arg value for '%s': '%s', expected '%s'",
235 func TestPlatformAPIs(t *testing.T) {
236 testJava(t, `
244 testJava(t, `
252 testJavaError(t, "platform_apis must be true when sdk_version is empty.", `
259 testJavaError(t, "platform_apis must be false when sdk_version is not empty.", `
269 func TestAndroidAppLinkType(t *testing.T) {
270 testJava(t, `
292 …testJavaError(t, "Adjust sdk_version: property of the source or target module so that target modul…
314 testJava(t, `
336 …testJavaError(t, "Adjust sdk_version: property of the source or target module so that target modul…
358 func TestUpdatableApps(t *testing.T) {
469 t.Run(test.name, func(t *testing.T) {
471 testJava(t, test.bp)
473 testJavaError(t, test.expectedError, test.bp)
479 func TestUpdatableApps_TransitiveDepsShouldSetMinSdkVersion(t *testing.T) {
480 …testJavaError(t, `module "bar".*: should support min_sdk_version\(29\)`, cc.GatherRequiredDepsForT…
497 func TestUpdatableApps_JniLibsShouldShouldSupportMinSdkVersion(t *testing.T) {
498 testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
517 func TestUpdatableApps_JniLibShouldBeBuiltAgainstMinSdkVersion(t *testing.T) {
552 ctx, _ := testJavaWithConfig(t, testConfig(nil, bp, fs))
565 t.Error("should link with ndk_crtbegin_so.29 and ndk_crtend_so.29")
569 func TestUpdatableApps_ErrorIfJniLibDoesntSupportMinSdkVersion(t *testing.T) {
586 testJavaError(t, `"libjni" .*: sdk_version\(current\) is higher than min_sdk_version\(29\)`, bp)
589 func TestUpdatableApps_ErrorIfDepSdkVersionIsHigher(t *testing.T) {
615 testJavaError(t, `"libjni" .*: links "libbar" built against newer API version "current"`, bp)
618 func TestResourceDirs(t *testing.T) {
654 t.Run(testCase.name, func(t *testing.T) {
657 run(t, ctx, config)
670 t.Errorf("expected resource files %q, got %q",
677 func TestLibraryAssets(t *testing.T) {
742 ctx := testApp(t, bp)
745 t.Run(test.name, func(t *testing.T) {
758 t.Errorf("Can't find asset flag %q in aapt2 link flags %q", test.assetFlag, aapt2Flags)
762 t.Errorf("aapt2 link flags %q contain unexpected asset flag", aapt2Flags)
770 t.Errorf("Unexpected mergeAssets inputs: %v, expected: %v",
778 func TestAndroidResources(t *testing.T) {
963 t.Run(testCase.name, func(t *testing.T) {
975 run(t, ctx, config)
1010 t.Fatalf("Unexpected overlayType %d", d.overlayType)
1023 t.Errorf("expected %s resource files:\n %#v\n got:\n %#v",
1027 t.Errorf("expected %s overlay files:\n %#v\n got:\n %#v",
1031 t.Errorf("expected %s rroDirs: %#v\n got:\n %#v",
1039 func TestAppSdkVersion(t *testing.T) {
1092 t.Run(moduleType+" "+test.name, func(t *testing.T) {
1111 run(t, ctx, config)
1120 t.Fatalf("missing --min-sdk-version or --target-sdk-version in link flags: %q", linkFlags)
1127 t.Errorf("incorrect --min-sdk-version, expected %q got %q",
1132 t.Errorf("incorrect --target-sdk-version, expected %q got %q",
1140 func TestJNIABI(t *testing.T) {
1141 ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
1196 t.Run(test.name, func(t *testing.T) {
1208 t.Errorf("want abis %v, got %v", test.abis, abis)
1214 func TestAppSdkVersionByPartition(t *testing.T) {
1215 testJavaError(t, "sdk_version must have a value when the module is located at vendor or product", `
1224 testJava(t, `
1245 …testJavaErrorWithConfig(t, "sdk_version must have a value when the module is located at vendor or …
1247 testJavaWithConfig(t, config)
1252 func TestJNIPackaging(t *testing.T) {
1253 ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
1323 t.Run(test.name, func(t *testing.T) {
1327 t.Errorf("expected jni packaged %v, got %v", w, g)
1332 t.Errorf("expected jni compressed %v, got %v", w, g)
1336 t.Errorf("expected input %q to use sdk variant", jniLibZip.Implicits[0].String())
1343 func TestJNISDK(t *testing.T) {
1344 ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
1413 t.Run(test.name, func(t *testing.T) {
1418 t.Fatalf("expected exactly one jni library, got %q", jniLibZip.Implicits.Strings())
1424 t.Errorf("expected SDK JNI library %q, got %q", sdkJNI, gotJNI)
1428 t.Errorf("expected platform JNI library %q, got %q", vendorJNI, gotJNI)
1432 t.Errorf("expected platform JNI library %q, got %q", platformJNI, gotJNI)
1438 t.Run("jni_uses_platform_apis_error", func(t *testing.T) {
1439 testJavaError(t, `jni_uses_platform_apis: can only be set for modules that set sdk_version`, `
1448 t.Run("jni_uses_sdk_apis_error", func(t *testing.T) {
1449 testJavaError(t, `jni_uses_sdk_apis: can only be set for modules that do not set sdk_version`, `
1460 func TestCertificates(t *testing.T) {
1556 t.Run(test.name, func(t *testing.T) {
1563 run(t, ctx, config)
1569t.Errorf("Incorrect signing flags, expected: %q, got: %q", test.expectedCertificate, signCertifica…
1574 t.Errorf("Incorrect signing flags, expected: %q, got: %q", test.expectedLineage, signFlags)
1580 func TestPackageNameOverride(t *testing.T) {
1621 t.Run(test.name, func(t *testing.T) {
1628 run(t, ctx, config)
1638 t.Errorf("Can't find %q in output files.\nAll outputs:%v", e, outputs)
1645 func TestInstrumentationTargetOverridden(t *testing.T) {
1663 run(t, ctx, config)
1670 t.Errorf("target package renaming flag, %q is missing in aapt2 link flags, %q", e, aapt2Flags)
1674 func TestOverrideAndroidApp(t *testing.T) {
1675 ctx, _ := testJava(t, `
1760 t.Errorf("Can't find %q in output files.\nAll outputs:%v", expectedApkPath, outputs)
1767 t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected.certFlag, certFlag)
1773 t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected.lineageFlag, lineageFlag)
1779 t.Errorf("Incorrect overrides property value, expected: %q, got: %q",
1786 t.Errorf("Incorrect overrides property value for logging parent, expected: %q, got: %q",
1794t.Errorf("package renaming flag, %q is missing in aapt2 link flags, %q", expected.aaptFlag, aapt2F…
1799 func TestOverrideAndroidAppDependency(t *testing.T) {
1800 ctx, _ := testJava(t, `
1830 t.Errorf("baz classpath %v does not contain %q", javac.Args["classpath"], fooTurbine)
1837 t.Errorf("qux classpath %v does not contain %q", javac.Args["classpath"], barTurbine)
1841 func TestOverrideAndroidTest(t *testing.T) {
1842 ctx, _ := testJava(t, `
1911 t.Errorf("Can't find %q in output files.\nAll outputs:%v", expectedApkPath, outputs)
1917 t.Errorf("Incorrect overrides property value, expected: %q, got: %q",
1925 t.Errorf("classpath %q does not contain %q", javac.Args["classpath"], turbine)
1931 checkAapt2LinkFlag(t, aapt2Flags, "rename-manifest-package", expected.packageFlag)
1932 …checkAapt2LinkFlag(t, aapt2Flags, "rename-instrumentation-target-package", expected.targetPackageF…
1936 func TestAndroidTest_FixTestConfig(t *testing.T) {
1937 ctx, _ := testJava(t, `
2000 t.Errorf("test_config_fixer was expected to run, but didn't")
2004 t.Errorf("Flag %q was not found in command: %q", flag, params.RuleParams.Command)
2010 t.Errorf("test_config_fixer was not expected to run, but did: %q", params.RuleParams.Command)
2017 func TestAndroidAppImport(t *testing.T) {
2018 ctx, _ := testJava(t, `
2034 t.Errorf("can't find dexpreopt outputs")
2042 t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected, signingFlag)
2046 func TestAndroidAppImport_NoDexPreopt(t *testing.T) {
2047 ctx, _ := testJava(t, `
2063 t.Errorf("dexpreopt shouldn't have run.")
2067 func TestAndroidAppImport_Presigned(t *testing.T) {
2068 ctx, _ := testJava(t, `
2084 t.Errorf("can't find dexpreopt outputs")
2088 t.Errorf("signing rule shouldn't be included.")
2091 t.Errorf("can't find aligning rule")
2095 func TestAndroidAppImport_SigningLineage(t *testing.T) {
2096 ctx, _ := testJava(t, `
2112 t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected, signingFlag)
2116 func TestAndroidAppImport_DefaultDevCert(t *testing.T) {
2117 ctx, _ := testJava(t, `
2133 t.Errorf("can't find dexpreopt outputs")
2141 t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected, signingFlag)
2145 func TestAndroidAppImport_DpiVariants(t *testing.T) {
2209 run(t, ctx, config)
2215 t.Errorf("failed to extract the src apk path from %q", jniRuleCommand)
2218 t.Errorf("wrong src apk, expected: %q got: %q", test.expected, matches[1])
2223 func TestAndroidAppImport_Filename(t *testing.T) {
2224 ctx, config := testJava(t, `
2256 t.Errorf("can't find output named %q - all outputs: %v", test.expected, variant.AllOutputs())
2262 t, config, "", a)[0].EntryMap["LOCAL_INSTALLED_MODULE_STEM"]
2264 t.Errorf("Incorrect LOCAL_INSTALLED_MODULE_STEM value '%s', expected '%s'",
2270 func TestAndroidAppImport_ArchVariants(t *testing.T) {
2319 ctx, _ := testJava(t, test.bp)
2325 t.Errorf("failed to extract the src apk path from %q", jniRuleCommand)
2328 t.Errorf("wrong src apk, expected: %q got: %q", test.expected, matches[1])
2333 func TestAndroidTestImport(t *testing.T) {
2334 ctx, config := testJava(t, `
2348 entries := android.AndroidMkEntriesForTest(t, config, "", test)[0]
2352 t.Errorf("Unexpected module tags - expected: %q, actual: %q", expected, actual)
2357 t.Errorf("Unexpected test data - expected: %q, actual: %q", expected, actual)
2361 func TestAndroidTestImport_NoJinUncompressForPresigned(t *testing.T) {
2362 ctx, _ := testJava(t, `
2385 t.Errorf("Unexpected JNI uncompress rule command: " + jniRule)
2391 t.Errorf("Unexpected JNI uncompress rule: " + jniRule)
2394 t.Errorf("Presigned test apk should be aligned")
2398 func TestAndroidTestImport_Preprocessed(t *testing.T) {
2399 ctx, _ := testJava(t, `
2421 t.Errorf("Unexpected JNI uncompress rule: " + jniRule)
2426 t.Errorf("signing rule shouldn't be included for preprocessed.")
2429 t.Errorf("aligning rule shouldn't be for preprocessed")
2434 func TestStl(t *testing.T) {
2435 ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
2476 t.Run(test.name, func(t *testing.T) {
2490 t.Errorf("missing jni %q in %q", jni, jnis)
2497 func TestUsesLibraries(t *testing.T) {
2556 run(t, ctx, config)
2564 t.Errorf("unexpected manifest_fixer args: wanted %q in %q", w, manifestFixerArgs)
2567 t.Errorf("unexpected manifest_fixer args: wanted %q in %q", w, manifestFixerArgs)
2573 t.Errorf("wanted %q in %q", w, cmd)
2577 t.Errorf("wanted %q in %q", w, cmd)
2583 t.Errorf("wanted %q in %q", w, cmd)
2587 t.Errorf("wanted %q in %q", w, cmd)
2594 t.Errorf("wanted %q in %q", w, cmd)
2600 t.Errorf("wanted %q in %q", w, cmd)
2604 func TestCodelessApp(t *testing.T) {
2668 t.Run(test.name, func(t *testing.T) {
2669 ctx := testApp(t, test.bp)
2674 t.Errorf("unexpected manifest_fixer args: %q", manifestFixerArgs)
2680 func TestEmbedNotice(t *testing.T) {
2681 ctx, _ := testJavaWithFS(t, cc.GatherRequiredDepsForTest(android.Android)+`
2751 t.Errorf("number of input notice files: expected = 3, actual = %q", noticeInputs)
2754 t.Errorf("APP_NOTICE is missing from notice files, %q", noticeInputs)
2757 t.Errorf("LIB_NOTICE is missing from notice files, %q", noticeInputs)
2760 t.Errorf("GENRULE_NOTICE is missing from notice files, %q", noticeInputs)
2767 t.Errorf("asset dir flag for NOTICE, %q is missing in aapt2 link flags, %q", e, aapt2Flags)
2776 t.Errorf("bar shouldn't have the asset dir flag for NOTICE: %q", e)
2785 t.Errorf("baz shouldn't have the asset dir flag for NOTICE: %q", e)
2789 func TestUncompressDex(t *testing.T) {
2863 test := func(t *testing.T, bp string, want bool, unbundled bool) {
2864 t.Helper()
2873 run(t, ctx, config)
2881 t.Errorf("want uncompressed in dex %v, got %v", want, uncompressedInDexJar)
2885 t.Errorf("want aligned %v, got %v", want, aligned)
2890 t.Run(tt.name, func(t *testing.T) {
2891 t.Run("platform", func(t *testing.T) {
2892 test(t, tt.bp, tt.uncompressedPlatform, false)
2894 t.Run("unbundled", func(t *testing.T) {
2895 test(t, tt.bp, tt.uncompressedUnbundled, true)
2901 func checkAapt2LinkFlag(t *testing.T, aapt2Flags, flagName, expectedValue string) {
2905 t.Errorf("%q is missing in aapt2 link flags, %q", expectedFlag, aapt2Flags)
2910 t.Errorf("unexpected flag, %q is found in aapt2 link flags, %q", unexpectedFlag, aapt2Flags)
2915 func TestRuntimeResourceOverlay(t *testing.T) {
2952 run(t, ctx, config)
2961 t.Errorf("expected values, %q are missing in aapt2 link flags, %q", absentFlags, aapt2Flags)
2968 t.Errorf("Stactic lib res package %q missing in overlay list: %q", staticLibPackage, overlayList)
2974 t.Errorf("Resource lib flag %q missing in aapt2 link flags: %q", resourceLibFlag, aapt2Flags)
2982t.Errorf("Incorrect signing lineage flags, expected: %q, got: %q", expectedLineageFlag, lineageFla…
2987 t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected, signingFlag)
2989 androidMkEntries := android.AndroidMkEntriesForTest(t, config, "", m.Module())[0]
2993 t.Errorf("Unexpected LOCAL_CERTIFICATE value: %v, expected: %v", path, expectedPath)
3000 t.Errorf("Unexpected LOCAL_MODULE_PATH value: %v, expected: %v", path, expectedPath)
3005 androidMkEntries = android.AndroidMkEntriesForTest(t, config, "", m.Module())[0]
3009 t.Errorf("Unexpected LOCAL_MODULE_PATH value: %v, expected: %v", path, expectedPath)
3015t.Errorf("Unexpected LOCAL_OVERRIDES_PACKAGES value: %v, expected: %v", overrides, expectedOverrid…
3019 func TestOverrideRuntimeResourceOverlay(t *testing.T) {
3020 ctx, _ := testJava(t, `
3076 t.Errorf("Can't find %q in output files.\nAll outputs:%v", expectedApkPath, outputs)
3082 t.Errorf("Incorrect overrides property value, expected: %q, got: %q",
3089 checkAapt2LinkFlag(t, aapt2Flags, "rename-manifest-package", expected.packageFlag)
3090 checkAapt2LinkFlag(t, aapt2Flags, "rename-overlay-target-package", expected.targetPackageFlag)
3094 func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) {
3095 ctx, config := testJava(t, `
3123 t.Errorf("expected values, %q are missing in aapt2 link flags, %q", absentFlags, aapt2Flags)
3127 path := android.AndroidMkEntriesForTest(t, config, "", m.Module())[0].EntryMap["LOCAL_MODULE_PATH"]
3130 t.Errorf("Unexpected LOCAL_MODULE_PATH value: %q, expected: %q", path, expectedPath)
3142 t.Errorf("unexpected value, %q is present in aapt2 link flags, %q", unexpectedFlags, aapt2Flags)
3146 path = android.AndroidMkEntriesForTest(t, config, "", m.Module())[0].EntryMap["LOCAL_MODULE_PATH"]
3149 t.Errorf("Unexpected LOCAL_MODULE_PATH value: %v, expected: %v", path, expectedPath)