Lines Matching refs:t
55 func testCcWithConfig(t *testing.T, config android.Config) *android.TestContext {
56 t.Helper()
61 android.FailIfErrored(t, errs)
63 android.FailIfErrored(t, errs)
68 func testCc(t *testing.T, bp string) *android.TestContext {
69 t.Helper()
74 return testCcWithConfig(t, config)
77 func testCcNoVndk(t *testing.T, bp string) *android.TestContext {
78 t.Helper()
82 return testCcWithConfig(t, config)
85 func testCcErrorWithConfig(t *testing.T, pattern string, config android.Config) {
86 t.Helper()
93 android.FailIfNoMatchingErrors(t, pattern, errs)
99 android.FailIfNoMatchingErrors(t, pattern, errs)
103 t.Fatalf("missing expected error %q (0 errors are returned)", pattern)
106 func testCcError(t *testing.T, pattern string, bp string) {
110 testCcErrorWithConfig(t, pattern, config)
114 func testCcErrorProductVndk(t *testing.T, pattern string, bp string) {
119 testCcErrorWithConfig(t, pattern, config)
130 func TestFuchsiaDeps(t *testing.T) {
131 t.Helper()
145 ctx := testCcWithConfig(t, config)
163 t.Errorf("fuchsia libs must link libcompiler_rt and libbioniccompat")
167 func TestFuchsiaTargetDecl(t *testing.T) {
168 t.Helper()
182 ctx := testCcWithConfig(t, config)
189 t.Errorf("inputs of libTest must be []string{\"foo.o\", \"bar.o\"}, but was %#v.", objs)
193 func TestVendorSrc(t *testing.T) {
194 ctx := testCc(t, `
216 t.Errorf("inputs of libTest must be []string{\"foo.o\", \"bar.o\"}, but was %#v.", objs)
220 func checkVndkModule(t *testing.T, ctx *android.TestContext, name, subDir string,
223 t.Helper()
227 t.Errorf("%q must have variant %q", name, variant)
233 t.Errorf("%q must have libraryDecorator", name)
235 t.Errorf("%q must use %q as subdir but it is using %q", name, subDir,
241 t.Fatalf("%q must have `vndkdep`", name)
244 t.Errorf("%q IsVndk() must equal to true", name)
247 t.Errorf("%q isVndkSp() must equal to %t", name, isVndkSp)
253 t.Errorf("%q isVndkExt() must equal to %t", name, isVndkExt)
257 t.Errorf("%q must extend from %q but get %q", name, extends, actualExtends)
261 func checkSnapshot(t *testing.T, ctx *android.TestContext, singleton android.TestingSingleton, modu…
264 t.Errorf("%q must have output\n", moduleName)
269 t.Errorf("%q must have single output\n", moduleName)
276 …t.Errorf("The input of snapshot %q must be %q, but %q", moduleName, out.Input.String(), outputFile…
280 func checkWriteFileOutput(t *testing.T, params android.TestingBuildParams, expected []string) {
281 t.Helper()
282 assertString(t, params.Rule.String(), android.WriteFile.String())
284 assertArrayString(t, actual, expected)
287 func checkVndkOutput(t *testing.T, ctx *android.TestContext, output string, expected []string) {
288 t.Helper()
290 checkWriteFileOutput(t, vndkSnapshot.Output(output), expected)
293 func checkVndkLibrariesOutput(t *testing.T, ctx *android.TestContext, module string, expected []str…
294 t.Helper()
304 checkWriteFileOutput(t, vndkLibraries.Output(output), expected)
307 func TestVndk(t *testing.T) {
374 ctx := testCcWithConfig(t, config)
376 checkVndkModule(t, ctx, "libvndk", "vndk-VER", false, "", vendorVariant)
377 checkVndkModule(t, ctx, "libvndk_private", "vndk-VER", false, "", vendorVariant)
378 checkVndkModule(t, ctx, "libvndk_sp", "vndk-sp-VER", true, "", vendorVariant)
379 checkVndkModule(t, ctx, "libvndk_sp_private", "vndk-sp-VER", true, "", vendorVariant)
401 checkSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.so", vndkCoreLibPath, variant)
402 checkSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.so", vndkCoreLib2ndPath, variant2nd)
403 checkSnapshot(t, ctx, snapshotSingleton, "libvndk_sp", "libvndk_sp-x.so", vndkSpLibPath, variant)
404 …checkSnapshot(t, ctx, snapshotSingleton, "libvndk_sp", "libvndk_sp-x.so", vndkSpLib2ndPath, varian…
407 …checkSnapshot(t, ctx, snapshotSingleton, "llndk.libraries.txt", "llndk.libraries.txt", snapshotCon…
408 …checkSnapshot(t, ctx, snapshotSingleton, "vndkcore.libraries.txt", "vndkcore.libraries.txt", snaps…
409 …checkSnapshot(t, ctx, snapshotSingleton, "vndksp.libraries.txt", "vndksp.libraries.txt", snapshotC…
410 …checkSnapshot(t, ctx, snapshotSingleton, "vndkprivate.libraries.txt", "vndkprivate.libraries.txt",…
412 checkVndkOutput(t, ctx, "vndk/vndk.libraries.txt", []string{
426 …checkVndkLibrariesOutput(t, ctx, "llndk.libraries.txt", []string{"libc.so", "libdl.so", "libft2.so…
427 …checkVndkLibrariesOutput(t, ctx, "vndkcore.libraries.txt", []string{"libvndk-private.so", "libvndk…
428 …checkVndkLibrariesOutput(t, ctx, "vndkprivate.libraries.txt", []string{"libft2.so", "libvndk-priva…
429 …checkVndkLibrariesOutput(t, ctx, "vndksp.libraries.txt", []string{"libc++.so", "libvndk_sp-x.so", …
430 checkVndkLibrariesOutput(t, ctx, "vndkcorevariant.libraries.txt", nil)
433 func TestVndkWithHostSupported(t *testing.T) {
434 ctx := testCc(t, `
464 checkVndkLibrariesOutput(t, ctx, "vndkcore.libraries.txt", []string{"libvndk_host_supported.so"})
467 func TestVndkLibrariesTxtAndroidMk(t *testing.T) {
475 ctx := testCcWithConfig(t, config)
478 entries := android.AndroidMkEntriesForTest(t, config, "", module.Module())[0]
479 assertArrayString(t, entries.EntryMap["LOCAL_MODULE_STEM"], []string{"llndk.libraries.VER.txt"})
482 func TestVndkUsingCoreVariant(t *testing.T) {
524 ctx := testCcWithConfig(t, config)
526 …checkVndkLibrariesOutput(t, ctx, "vndkcorevariant.libraries.txt", []string{"libc++.so", "libvndk2.…
529 func TestDataLibs(t *testing.T) {
549 ctx := testCcWithConfig(t, config)
554 t.Errorf("Expected cc_test to produce output files, error: %s", err)
558 t.Errorf("expected exactly one output file. output files: [%s]", outputFiles)
562 t.Errorf("expected exactly one test data file. test data files: [%s]", testBinary.dataPaths())
570 t.Errorf("expected test output file to be 'main_test', but was '%s'", outputPath)
574 t.Errorf("expected test data file to be 'test_lib.so', but was '%s'", testBinaryPath)
579 func TestDataLibsRelativeInstallPath(t *testing.T) {
600 ctx := testCcWithConfig(t, config)
605 t.Fatalf("Expected cc_test to produce output files, error: %s", err)
608 t.Errorf("expected exactly one output file. output files: [%s]", outputFiles)
611 t.Errorf("expected exactly one test data file. test data files: [%s]", testBinary.dataPaths())
617 t.Errorf("expected test output file to be 'main_test', but was '%s'", outputPath)
619 entries := android.AndroidMkEntriesForTest(t, config, "", module)[0]
621 t.Errorf("expected LOCAL_TEST_DATA to end with `:test_lib.so:foo/bar/baz`,"+
626 func TestVndkWhenVndkVersionIsNotSet(t *testing.T) {
627 ctx := testCcNoVndk(t, `
638 checkVndkOutput(t, ctx, "vndk/vndk.libraries.txt", []string{
649 func TestVndkDepError(t *testing.T) {
651 testCcError(t, "dependency \".*\" of \".*\" missing variant", `
669 testCcError(t, "dependency \".*\" of \".*\" missing variant", `
688 testCcError(t, "dependency \".*\" of \".*\" missing variant", `
707 testCcError(t, "dependency \".*\" of \".*\" missing variant", `
727 testCcError(t, "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"", `
750 testCcError(t, "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"", `
769 testCcError(t, "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"", `
788 testCcError(t, "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"", `
808 testCcError(t, "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"", `
828 func TestDoubleLoadbleDep(t *testing.T) {
830 testCc(t, `
851 testCc(t, `
872 testCc(t, `
887 testCc(t, `
908 testCc(t, `
933 func TestVendorSnapshot(t *testing.T) {
988 ctx := testCcWithConfig(t, config)
1009 checkSnapshot(t, ctx, snapshotSingleton, "libvendor", "libvendor.so", sharedDir, sharedVariant)
1010 …checkSnapshot(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.so", sharedDi…
1018 checkSnapshot(t, ctx, snapshotSingleton, "libb", "libb.a", staticDir, staticVariant)
1019 checkSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.a", staticDir, staticVariant)
1020 checkSnapshot(t, ctx, snapshotSingleton, "libvendor", "libvendor.a", staticDir, staticVariant)
1021 …checkSnapshot(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.a", staticDir…
1032 checkSnapshot(t, ctx, snapshotSingleton, "vendor_bin", "vendor_bin", binaryDir, binaryVariant)
1033 …checkSnapshot(t, ctx, snapshotSingleton, "vendor_available_bin", "vendor_available_bin", binaryDir…
1046 checkSnapshot(t, ctx, snapshotSingleton, "obj", "obj.o", objectDir, objectVariant)
1053 t.Errorf("%q expected but not found", jsonFile)
1058 func TestDoubleLoadableDepError(t *testing.T) {
1060 …testCcError(t, "module \".*\" variant \".*\": link.* \".*\" which is not LL-NDK, VNDK-SP, .*double…
1081 …testCcError(t, "module \".*\" variant \".*\": link.* \".*\" which is not LL-NDK, VNDK-SP, .*double…
1100 …testCcError(t, "module \".*\" variant \".*\": link.* \".*\" which is not LL-NDK, VNDK-SP, .*double…
1115 …testCcError(t, "module \".*\" variant \".*\": link.* \".*\" which is not LL-NDK, VNDK-SP, .*double…
1133 …testCcError(t, "module \".*\" variant \".*\": link.* \".*\" which is not LL-NDK, VNDK-SP, .*double…
1154 …testCcError(t, "module \".*\" variant \".*\": link.* \".*\" which is not LL-NDK, VNDK-SP, .*double…
1178 func TestVndkExt(t *testing.T) {
1248 ctx := testCcWithConfig(t, config)
1250 checkVndkModule(t, ctx, "libvndk_ext", "vndk", false, "libvndk", vendorVariant)
1251 checkVndkModule(t, ctx, "libvndk_ext_product", "vndk", false, "libvndk", productVariant)
1254 assertString(t, mod_vendor.outputFile.Path().Base(), "libvndk2-suffix.so")
1257 assertString(t, mod_product.outputFile.Path().Base(), "libvndk2-suffix.so")
1260 func TestVndkExtWithoutBoardVndkVersion(t *testing.T) {
1262 ctx := testCcNoVndk(t, `
1286 t.Errorf("\"libvndk_ext\" must extend from \"libvndk\" but get %q", extends)
1290 func TestVndkExtWithoutProductVndkVersion(t *testing.T) {
1292 ctx := testCc(t, `
1316 t.Errorf("\"libvndk_ext_product\" must extend from \"libvndk\" but get %q", extends)
1320 func TestVndkExtError(t *testing.T) {
1322 testCcError(t, "must set `vendor: true` or `product_specific: true` to set `extends: \".*\"`", `
1342 testCcError(t, "must set `extends: \"\\.\\.\\.\"` to vndk extension", `
1362 testCcErrorProductVndk(t, "must set `extends: \"\\.\\.\\.\"` to vndk extension", `
1382 testCcErrorProductVndk(t, "must not set at the same time as `vndk: {extends: \"\\.\\.\\.\"}`", `
1405 func TestVndkExtInconsistentSupportSystemProcessError(t *testing.T) {
1407 testCcError(t, "module \".*\" with mismatched support_system_process", `
1429 testCcError(t, "module \".*\" with mismatched support_system_process", `
1452 func TestVndkExtVendorAvailableFalseError(t *testing.T) {
1455 testCcError(t, "`extends` refers module \".*\" which does not have `vendor_available: true`", `
1476 …testCcErrorProductVndk(t, "`extends` refers module \".*\" which does not have `vendor_available: t…
1498 func TestVendorModuleUseVndkExt(t *testing.T) {
1500 testCc(t, `
1550 func TestVndkExtUseVendorLib(t *testing.T) {
1552 testCc(t, `
1581 testCc(t, `
1612 func TestProductVndkExtDependency(t *testing.T) {
1674 testCcWithConfig(t, config)
1677 func TestVndkSpExtUseVndkError(t *testing.T) {
1680 testCcError(t, "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"", `
1715 testCcError(t, "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"", `
1759 func TestVndkUseVndkExtError(t *testing.T) {
1762 testCcError(t, "dependency \".*\" of \".*\" missing variant", `
1793 testCcError(t, "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"", `
1828 testCcError(t, "dependency \".*\" of \".*\" missing variant", `
1862 testCcError(t, "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"", `
1898 func TestEnforceProductVndkVersion(t *testing.T) {
1966 ctx := testCcWithConfig(t, config)
1968 checkVndkModule(t, ctx, "libvndk", "vndk-VER", false, "", productVariant)
1969 checkVndkModule(t, ctx, "libvndk_sp", "vndk-sp-VER", true, "", productVariant)
1972 func TestEnforceProductVndkVersionErrors(t *testing.T) {
1973 testCcErrorProductVndk(t, "dependency \".*\" of \".*\" missing variant:\n.*image:product.VER", `
1988 testCcErrorProductVndk(t, "dependency \".*\" of \".*\" missing variant:\n.*image:product.VER", `
2002 …testCcErrorProductVndk(t, "Vendor module that is not VNDK should not link to \".*\" which is marke…
2020 testCcErrorProductVndk(t, "dependency \".*\" of \".*\" missing variant:\n.*image:product.VER", `
2035 testCcErrorProductVndk(t, "dependency \".*\" of \".*\" missing variant:\n.*image:", `
2052 func TestMakeLinkType(t *testing.T) {
2123 ctx := testCcWithConfig(t, config)
2125 assertMapKeys(t, vndkCoreLibraries(config),
2127 assertMapKeys(t, vndkSpLibraries(config),
2129 assertMapKeys(t, llndkLibraries(config),
2131 assertMapKeys(t, vndkPrivateLibraries(config),
2153 t.Run(test.name, func(t *testing.T) {
2155 assertString(t, module.makeLinkType, test.expected)
2245 func TestSplitListForSize(t *testing.T) {
2259 t.Errorf("incorrect output:")
2260 t.Errorf(" input: %#v", testCase.in)
2261 t.Errorf(" size: %d", testCase.size)
2262 t.Errorf(" expected: %#v", testCase.out)
2263 t.Errorf(" got: %#v", outStrings)
2430 func TestLinkReordering(t *testing.T) {
2477 t.Error(err)
2492 func TestStaticLibDepReordering(t *testing.T) {
2493 ctx := testCc(t, `
2521 t.Errorf("staticDeps orderings were not propagated correctly"+
2530 func TestStaticLibDepReorderingWithShared(t *testing.T) {
2531 ctx := testCc(t, `
2555 t.Errorf("staticDeps orderings did not account for shared libs"+
2564 func checkEquals(t *testing.T, message string, expected, actual interface{}) {
2566 t.Errorf(message+
2575 func TestLlndkLibrary(t *testing.T) {
2576 ctx := testCc(t, `
2594 checkEquals(t, "variants for llndk stubs", expected, actual)
2597 checkEquals(t, "use VNDK version for default stubs", "current", params.Args["apiLevel"])
2600 checkEquals(t, "override apiLevel for versioned stubs", "1", params.Args["apiLevel"])
2603 func TestLlndkHeaders(t *testing.T) {
2604 ctx := testCc(t, `
2627 t.Errorf("cflags for libvendor must contain -Imy_include, but was %#v.", cflags)
2631 func checkRuntimeLibs(t *testing.T, expected []string, module *Module) {
2634 t.Errorf("incorrect runtime_libs for shared libs"+
2696 func TestRuntimeLibs(t *testing.T) {
2697 ctx := testCc(t, runtimeLibAndroidBp)
2703 checkRuntimeLibs(t, []string{"libvendor_available1"}, module)
2706 checkRuntimeLibs(t, []string{"libvendor_available1"}, module)
2713 checkRuntimeLibs(t, []string{"libvendor_available1.vendor"}, module)
2716 checkRuntimeLibs(t, []string{"libvendor_available1.vendor", "libvendor1"}, module)
2719 func TestExcludeRuntimeLibs(t *testing.T) {
2720 ctx := testCc(t, runtimeLibAndroidBp)
2724 checkRuntimeLibs(t, []string{"libvendor_available1"}, module)
2728 checkRuntimeLibs(t, nil, module)
2731 func TestRuntimeLibsNoVndk(t *testing.T) {
2732 ctx := testCcNoVndk(t, runtimeLibAndroidBp)
2739 checkRuntimeLibs(t, []string{"libvendor_available1"}, module)
2742 checkRuntimeLibs(t, []string{"libvendor_available1", "libvendor1"}, module)
2745 func checkStaticLibs(t *testing.T, expected []string, module *Module) {
2746 t.Helper()
2749 t.Errorf("incorrect static_libs"+
2768 func TestStaticLibDepExport(t *testing.T) {
2769 ctx := testCc(t, staticLibAndroidBp)
2774 …checkStaticLibs(t, []string{"lib1", "libc++demangle", "libclang_rt.builtins-aarch64-android", "lib…
2780 …checkStaticLibs(t, []string{"lib1", "libc++_static", "libc++demangle", "libclang_rt.builtins-aarch…
2855 func TestCompilerFlags(t *testing.T) {
2860 t.Errorf("incorrect output:")
2861 t.Errorf(" input: %#v", testCase.in)
2862 t.Errorf(" expected: %#v", testCase.out)
2863 t.Errorf(" got: %#v", ctx.result)
2868 func TestVendorPublicLibraries(t *testing.T) {
2869 ctx := testCc(t, `
2913 t.Errorf("cflags for libsystem must contain -Imy_include, but was %#v.", cflags)
2921 t.Errorf("libflags for libsystem must contain %#v, but was %#v", stubPaths[0], libflags)
2929 t.Errorf("libflags for libvendor must contain %#v, but was %#v", stubPaths[0], libflags)
2934 func TestRecovery(t *testing.T) {
2935 ctx := testCc(t, `
2955 t.Errorf("variants of librecovery must be \"%s\" only, but was %#v", arm64, variants)
2960 t.Errorf("multilib was set to 32 for librecovery32, but its variants has %s.", arm64)
2965 t.Errorf("recovery variant of libHalInRecovery must not specific to device, soc, or product")
2969 func TestDataLibsPrebuiltSharedTestLibrary(t *testing.T) {
2989 ctx := testCcWithConfig(t, config)
2994 t.Fatalf("Expected cc_test to produce output files, error: %s", err)
2997 t.Errorf("expected exactly one output file. output files: [%s]", outputFiles)
3000 t.Errorf("expected exactly one test data file. test data files: [%s]", testBinary.dataPaths())
3006 t.Errorf("expected test output file to be 'main_test', but was '%s'", outputPath)
3008 entries := android.AndroidMkEntriesForTest(t, config, "", module)[0]
3010 t.Errorf("expected LOCAL_TEST_DATA to end with `:test_lib.so:foo/bar/baz`,"+
3015 func TestVersionedStubs(t *testing.T) {
3016 ctx := testCc(t, `
3054 t.Errorf("variants of libFoo expected:\n")
3056 t.Errorf("%q\n", v)
3058 t.Errorf(", but got:\n")
3060 t.Errorf("%q\n", v)
3068 t.Errorf("%q is not found in %q", libFoo1StubPath, libFlags)
3075 t.Errorf("%q is not found in %q", libFoo1VersioningMacro, cFlags)
3079 func TestVersioningMacro(t *testing.T) {
3087 checkEquals(t, tc.moduleName, tc.expected, versioningMacroName(tc.moduleName))
3091 func TestStaticExecutable(t *testing.T) {
3092 ctx := testCc(t, `
3105 t.Errorf("Static lib %q was not found in %q", lib, libFlags)
3111 t.Errorf("Shared lib %q was found in %q", lib, libFlags)
3116 func TestStaticDepsOrderWithStubs(t *testing.T) {
3117 ctx := testCc(t, `
3147 t.Errorf("staticDeps orderings were not propagated correctly"+
3156 func TestErrorsIfAModuleDependsOnDisabled(t *testing.T) {
3157 testCcError(t, `module "libA" .* depends on disabled module "libB"`, `
3176 func TestFuzzTarget(t *testing.T) {
3177 ctx := testCc(t, `
3187 func TestAidl(t *testing.T) {
3190 func assertString(t *testing.T, got, expected string) {
3191 t.Helper()
3193 t.Errorf("expected %q got %q", expected, got)
3197 func assertArrayString(t *testing.T, got, expected []string) {
3198 t.Helper()
3200 t.Errorf("expected %d (%q) got (%d) %q", len(expected), expected, len(got), got)
3205 t.Errorf("expected %d-th %q (%q) got %q (%q)",
3212 func assertMapKeys(t *testing.T, m map[string]string, expected []string) {
3213 t.Helper()
3214 assertArrayString(t, android.SortedStringKeys(m), expected)
3217 func TestDefaults(t *testing.T) {
3218 ctx := testCc(t, `
3260 t.Errorf("libshared ld rule wanted %q, got %q", w, g)
3264 t.Errorf("libboth ld rule wanted %q, got %q", w, g)
3268 t.Errorf("binary ld rule wanted %q, got %q", w, g)
3273 t.Errorf("libstatic ar rule wanted %q, got %q", w, g)
3277 t.Errorf("libboth ar rule wanted %q, got %q", w, g)
3281 func TestProductVariableDefaults(t *testing.T) {
3310 android.FailIfErrored(t, errs)
3312 android.FailIfErrored(t, errs)
3316 t.Errorf("expected -DBAR in cppflags, got %q", libfoo.flags.Local.CppFlags)