Pass system include dirs to header ABI checker
This commit fixes the incomplete ABI dumps for libc. The ABI checker
counts export_system_include_dir in the exported headers. It writes the
functions and types defined in the system headers to the dump files.
Test: make
Bug: 314010764
Change-Id: Ieae48d13b4fc4381c87a017213019e940d498967
diff --git a/cc/cc_test.go b/cc/cc_test.go
index d4955c6..3d75bf5 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -958,6 +958,7 @@
cc_library_headers {
name: "libexternal_llndk_headers",
export_include_dirs: ["include_llndk"],
+ export_system_include_dirs: ["include_system_llndk"],
llndk: {
symbol_file: "libllndk.map.txt",
},
@@ -973,6 +974,17 @@
},
export_include_dirs: ["include"],
}
+
+ cc_library {
+ name: "libllndk_with_system_headers",
+ llndk: {
+ symbol_file: "libllndk.map.txt",
+ export_llndk_headers: ["libexternal_llndk_headers"],
+ export_headers_as_system: true,
+ },
+ export_include_dirs: ["include"],
+ export_system_include_dirs: ["include_system"],
+ }
`)
actual := result.ModuleVariantsForTests("libllndk")
for i := 0; i < len(actual); i++ {
@@ -990,20 +1002,26 @@
params := result.ModuleForTests("libllndk", "android_vendor_arm_armv7-a-neon_shared").Description("generate stub")
android.AssertSame(t, "use Vendor API level for default stubs", "202404", params.Args["apiLevel"])
- checkExportedIncludeDirs := func(module, variant string, expectedDirs ...string) {
+ checkExportedIncludeDirs := func(module, variant string, expectedSystemDirs []string, expectedDirs ...string) {
t.Helper()
m := result.ModuleForTests(module, variant).Module()
f, _ := android.SingletonModuleProvider(result, m, FlagExporterInfoProvider)
android.AssertPathsRelativeToTopEquals(t, "exported include dirs for "+module+"["+variant+"]",
expectedDirs, f.IncludeDirs)
+ android.AssertPathsRelativeToTopEquals(t, "exported include dirs for "+module+"["+variant+"]",
+ expectedSystemDirs, f.SystemIncludeDirs)
}
- checkExportedIncludeDirs("libllndk", coreVariant, "include")
- checkExportedIncludeDirs("libllndk", vendorVariant, "include")
- checkExportedIncludeDirs("libllndk_with_external_headers", coreVariant, "include")
- checkExportedIncludeDirs("libllndk_with_external_headers", vendorVariant, "include_llndk")
- checkExportedIncludeDirs("libllndk_with_override_headers", coreVariant, "include")
- checkExportedIncludeDirs("libllndk_with_override_headers", vendorVariant, "include_llndk")
+ checkExportedIncludeDirs("libllndk", coreVariant, nil, "include")
+ checkExportedIncludeDirs("libllndk", vendorVariant, nil, "include")
+ checkExportedIncludeDirs("libllndk_with_external_headers", coreVariant, nil, "include")
+ checkExportedIncludeDirs("libllndk_with_external_headers", vendorVariant,
+ []string{"include_system_llndk"}, "include_llndk")
+ checkExportedIncludeDirs("libllndk_with_override_headers", coreVariant, nil, "include")
+ checkExportedIncludeDirs("libllndk_with_override_headers", vendorVariant, nil, "include_llndk")
+ checkExportedIncludeDirs("libllndk_with_system_headers", coreVariant, []string{"include_system"}, "include")
+ checkExportedIncludeDirs("libllndk_with_system_headers", vendorVariant,
+ []string{"include_system", "include", "include_system_llndk"}, "include_llndk")
checkAbiLinkerIncludeDirs := func(module string) {
t.Helper()
@@ -1016,12 +1034,14 @@
}
vendorModule := result.ModuleForTests(module, vendorVariant).Module()
vendorInfo, _ := android.SingletonModuleProvider(result, vendorModule, FlagExporterInfoProvider)
+ vendorDirs := android.Concat(vendorInfo.IncludeDirs, vendorInfo.SystemIncludeDirs)
android.AssertStringEquals(t, module+" has different exported include dirs for vendor variant and ABI check",
- android.JoinPathsWithPrefix(vendorInfo.IncludeDirs, "-I"), abiCheckFlags)
+ android.JoinPathsWithPrefix(vendorDirs, "-I"), abiCheckFlags)
}
checkAbiLinkerIncludeDirs("libllndk")
checkAbiLinkerIncludeDirs("libllndk_with_override_headers")
checkAbiLinkerIncludeDirs("libllndk_with_external_headers")
+ checkAbiLinkerIncludeDirs("libllndk_with_system_headers")
}
func TestLlndkHeaders(t *testing.T) {