ANDROID: Add bionic-compat.h to kselftests.

Bionic does not provide pthread_cancel(). Copy bionic-compat.h from
previous fork of kselftests to here to solve the issue.

Link: https://android.googlesource.com/platform/external/linux-kselftest/+/refs/heads/main/android/include/bionic-compat.h
Bug: 369330443
Change-Id: Ifa1b5cbe55d6e8ab007787d94e31902ed8dfc37c
Signed-off-by: HONG Yifan <elsk@google.com>
Signed-off-by: Edward Liaw <edliaw@google.com>
This commit is contained in:
HONG Yifan
2024-09-25 12:02:38 -07:00
committed by Edward Liaw
parent d56bde2ef4
commit 2c1488cabe
2 changed files with 26 additions and 5 deletions
+12 -5
View File
@@ -1295,6 +1295,12 @@ _KSELFTEST_COPTS = [
"-O3",
"-pthread",
"-std=gnu99",
"-include",
paths.join(
package_relative_label(":x").workspace_root,
package_relative_label(":x").package,
"tools/testing/selftests/android/include/bionic-compat.h",
),
] + select({
":arm": ["-mcpu=cortex-a8"],
"//conditions:default": [],
@@ -1326,7 +1332,9 @@ config_setting(
cc_library(
name = "kselftest_headers_lib",
hdrs = glob(["tools/testing/selftests/*.h"]),
hdrs = glob(["tools/testing/selftests/*.h"]) + [
"tools/testing/selftests/android/include/bionic-compat.h",
],
copts = _KSELFTEST_COPTS,
defines = [
"_GNU_SOURCE=",
@@ -1398,6 +1406,9 @@ cc_library(
],
copts = _KSELFTEST_COPTS,
visibility = ["//visibility:private"],
deps = [
":kselftest_headers_lib",
],
)
cc_binary_with_abi(
@@ -1408,7 +1419,6 @@ cc_binary_with_abi(
target_compatible_with = ["@platforms//os:android"],
visibility = ["//visibility:private"],
deps = [
":kselftest_headers_lib",
":kselftest_vdso",
],
)
@@ -1421,7 +1431,6 @@ cc_binary_with_abi(
target_compatible_with = ["@platforms//os:android"],
visibility = ["//visibility:private"],
deps = [
":kselftest_headers_lib",
":kselftest_vdso",
],
)
@@ -1434,7 +1443,6 @@ cc_binary_with_abi(
target_compatible_with = ["@platforms//os:android"],
visibility = ["//visibility:private"],
deps = [
":kselftest_headers_lib",
":kselftest_vdso",
],
)
@@ -1447,7 +1455,6 @@ cc_binary_with_abi(
target_compatible_with = ["@platforms//os:android"],
visibility = ["//visibility:private"],
deps = [
":kselftest_headers_lib",
":kselftest_vdso",
],
)
@@ -0,0 +1,14 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __BIONIC_COMPAT_H
#define __BIONIC_COMPAT_H
#define _GNU_SOURCE
#include <sys/types.h>
static inline int pthread_cancel(pthread_t thread)
{
return 0;
}
#endif /* __BIONIC_COMPAT_H */