From c932d348c5f7de8844ae8d32c49f2a1663fa887f Mon Sep 17 00:00:00 2001 From: Edward Liaw Date: Thu, 6 Jun 2024 22:09:09 +0000 Subject: [PATCH] ANDROID: Define common set of cflags for kselftests Use a common set of cflags (-D_GNU_SOURCE= and -pthread) for all kselftests. This should avoid _GNU_SOURCE issues going forward, make it easier to change copts that apply to all tests, and eliminate some configuration duplication. Bug: 339526723 Change-Id: If0f9f4a2aaa397c1d0cb1df8ea9fd1e3bec19149 Signed-off-by: Edward Liaw --- BUILD.bazel | 218 +++++++++++++++++++--------------------------------- 1 file changed, 79 insertions(+), 139 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 6a203dc242c8..75aedd119ce0 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1025,6 +1025,15 @@ ddk_headers( _KSELFTEST_DIR = "testcases/selftests" +_KSELFTEST_COPTS = [ + "-O3", + "-pthread", + "-std=gnu99", +] + select({ + ":arm": ["-mcpu=cortex-a8"], + "//conditions:default": [], +}) + config_setting( name = "x86_64", values = {"platforms": "//build/kernel/kleaf/impl:android_x86_64"}, @@ -1052,12 +1061,17 @@ config_setting( cc_library( name = "kselftest_headers_lib", hdrs = glob(["tools/testing/selftests/*.h"]), + copts = _KSELFTEST_COPTS, + defines = [ + "_GNU_SOURCE=", + ], visibility = ["//visibility:private"], ) cc_binary_with_abi( name = "kselftest_binderfs_binderfs_test", srcs = ["tools/testing/selftests/filesystems/binderfs/binderfs_test.c"], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1072,6 +1086,7 @@ cc_binary_with_abi( ":arm64": ["tools/testing/selftests/breakpoints/breakpoint_test_arm64.c"], "//conditions:default": [], }), + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1081,6 +1096,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_kcmp_kcmp_test", srcs = ["tools/testing/selftests/kcmp/kcmp_test.c"], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1090,6 +1106,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_ptrace_peeksiginfo", srcs = ["tools/testing/selftests/ptrace/peeksiginfo.c"], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1099,10 +1116,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_rtc_rtctest", srcs = ["tools/testing/selftests/rtc/rtctest.c"], - copts = select({ - ":arm": ["-mcpu=cortex-a8"], - "//conditions:default": [], - }), + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1116,12 +1130,14 @@ cc_library( "tools/testing/selftests/vDSO/parse_vdso.h", "tools/testing/selftests/vDSO/vdso_config.h", ], + copts = _KSELFTEST_COPTS, visibility = ["//visibility:private"], ) cc_binary_with_abi( name = "kselftest_vdso_vdso_test_abi", srcs = ["tools/testing/selftests/vDSO/vdso_test_abi.c"], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1134,6 +1150,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_vdso_vdso_test_clock_getres", srcs = ["tools/testing/selftests/vDSO/vdso_test_clock_getres.c"], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1146,6 +1163,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_vdso_vdso_test_getcpu", srcs = ["tools/testing/selftests/vDSO/vdso_test_getcpu.c"], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1158,6 +1176,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_vdso_vdso_test_gettimeofday", srcs = ["tools/testing/selftests/vDSO/vdso_test_gettimeofday.c"], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1170,6 +1189,7 @@ cc_binary_with_abi( cc_library( name = "kselftest_futex_headers_lib", hdrs = glob(["tools/testing/selftests/futex/include/*.h"]), + copts = _KSELFTEST_COPTS, visibility = ["//visibility:private"], ) @@ -1177,10 +1197,7 @@ cc_binary_with_abi( name = "kselftest_futex_futex_requeue_pi_mismatched_ops", srcs = ["tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c"], out = "futex_requeue_pi_mismatched_ops", - copts = [ - "-D_GNU_SOURCE=", - "-pthread", - ], + copts = _KSELFTEST_COPTS, includes = [ "tools/testing/selftests", "tools/testing/selftests/futex/include", @@ -1198,10 +1215,7 @@ cc_binary_with_abi( name = "kselftest_futex_futex_requeue_pi_signal_restart", srcs = ["tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c"], out = "futex_requeue_pi_signal_restart", - copts = [ - "-D_GNU_SOURCE=", - "-pthread", - ], + copts = _KSELFTEST_COPTS, includes = [ "tools/testing/selftests", "tools/testing/selftests/futex/include", @@ -1219,10 +1233,7 @@ cc_binary_with_abi( name = "kselftest_futex_futex_requeue_pi", srcs = ["tools/testing/selftests/futex/functional/futex_requeue_pi.c"], out = "futex_requeue_pi", - copts = [ - "-D_GNU_SOURCE=", - "-pthread", - ], + copts = _KSELFTEST_COPTS, includes = [ "tools/testing/selftests", "tools/testing/selftests/futex/include", @@ -1240,10 +1251,7 @@ cc_binary_with_abi( name = "kselftest_futex_futex_requeue", srcs = ["tools/testing/selftests/futex/functional/futex_requeue.c"], out = "futex_requeue", - copts = [ - "-D_GNU_SOURCE=", - "-pthread", - ], + copts = _KSELFTEST_COPTS, includes = [ "tools/testing/selftests", "tools/testing/selftests/futex/include", @@ -1261,10 +1269,7 @@ cc_binary_with_abi( name = "kselftest_futex_futex_wait_private_mapped_file", srcs = ["tools/testing/selftests/futex/functional/futex_wait_private_mapped_file.c"], out = "futex_wait_private_mapped_file", - copts = [ - "-D_GNU_SOURCE=", - "-pthread", - ], + copts = _KSELFTEST_COPTS, includes = [ "tools/testing/selftests", "tools/testing/selftests/futex/include", @@ -1282,10 +1287,7 @@ cc_binary_with_abi( name = "kselftest_futex_futex_wait_timeout", srcs = ["tools/testing/selftests/futex/functional/futex_wait_timeout.c"], out = "futex_wait_timeout", - copts = [ - "-D_GNU_SOURCE=", - "-pthread", - ], + copts = _KSELFTEST_COPTS, includes = [ "tools/testing/selftests", "tools/testing/selftests/futex/include", @@ -1303,10 +1305,7 @@ cc_binary_with_abi( name = "kselftest_futex_futex_wait_uninitialized_heap", srcs = ["tools/testing/selftests/futex/functional/futex_wait_uninitialized_heap.c"], out = "futex_wait_uninitialized_heap", - copts = [ - "-D_GNU_SOURCE=", - "-pthread", - ], + copts = _KSELFTEST_COPTS, includes = [ "tools/testing/selftests", "tools/testing/selftests/futex/include", @@ -1324,10 +1323,7 @@ cc_binary_with_abi( name = "kselftest_futex_futex_wait_wouldblock", srcs = ["tools/testing/selftests/futex/functional/futex_wait_wouldblock.c"], out = "futex_wait_wouldblock", - copts = [ - "-D_GNU_SOURCE=", - "-pthread", - ], + copts = _KSELFTEST_COPTS, includes = [ "tools/testing/selftests", "tools/testing/selftests/futex/include", @@ -1345,10 +1341,7 @@ cc_binary_with_abi( name = "kselftest_futex_futex_wait", srcs = ["tools/testing/selftests/futex/functional/futex_wait.c"], out = "futex_wait", - copts = [ - "-D_GNU_SOURCE=", - "-pthread", - ], + copts = _KSELFTEST_COPTS, includes = [ "tools/testing/selftests", "tools/testing/selftests/futex/include", @@ -1365,6 +1358,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_mm_compaction_test", srcs = ["tools/testing/selftests/mm/compaction_test.c"], + copts = _KSELFTEST_COPTS, includes = ["tools/testing/selftests"], path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], @@ -1378,6 +1372,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_mm_hugepage_mmap", srcs = ["tools/testing/selftests/mm/hugepage-mmap.c"], + copts = _KSELFTEST_COPTS, includes = ["tools/testing/selftests"], path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], @@ -1391,6 +1386,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_mm_hugepage_shm", srcs = ["tools/testing/selftests/mm/hugepage-shm.c"], + copts = _KSELFTEST_COPTS, includes = ["tools/testing/selftests"], path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], @@ -1404,6 +1400,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_mm_map_hugetlb", srcs = ["tools/testing/selftests/mm/map_hugetlb.c"], + copts = _KSELFTEST_COPTS, includes = ["tools/testing/selftests"], path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], @@ -1421,6 +1418,7 @@ cc_binary_with_abi( "tools/testing/selftests/mm/mlock-random-test.c", "tools/testing/selftests/mm/mlock2.h", ], + copts = _KSELFTEST_COPTS, includes = [ "tools/testing/selftests", "tools/testing/selftests/mm", @@ -1440,6 +1438,7 @@ cc_binary_with_abi( "tools/testing/selftests/mm/mlock2.h", "tools/testing/selftests/mm/mlock2-tests.c", ], + copts = _KSELFTEST_COPTS, includes = [ "tools/testing/selftests", "tools/testing/selftests/mm", @@ -1456,6 +1455,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_mm_on_fault_limit", srcs = ["tools/testing/selftests/mm/on-fault-limit.c"], + copts = _KSELFTEST_COPTS, includes = ["tools/testing/selftests"], path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], @@ -1469,6 +1469,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_mm_mremap_dontunmap", srcs = ["tools/testing/selftests/mm/mremap_dontunmap.c"], + copts = _KSELFTEST_COPTS, includes = ["tools/testing/selftests"], path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], @@ -1482,6 +1483,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_mm_mremap_test", srcs = ["tools/testing/selftests/mm/mremap_test.c"], + copts = _KSELFTEST_COPTS, includes = ["tools/testing/selftests"], path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], @@ -1499,9 +1501,7 @@ cc_library( "include/uapi/linux/fs.h", "tools/testing/selftests/mm/vm_util.h", ], - copts = [ - "-D_GNU_SOURCE=", - ], + copts = _KSELFTEST_COPTS, includes = [ "include/uapi/", "tools/testing/selftests", @@ -1517,8 +1517,7 @@ cc_binary_with_abi( srcs = [ "tools/testing/selftests/mm/thuge-gen.c", ], - copts = [ - "-D_GNU_SOURCE=", + copts = _KSELFTEST_COPTS + [ "-Wno-macro-redefined", ], includes = ["tools/testing/selftests"], @@ -1537,9 +1536,7 @@ cc_binary_with_abi( srcs = [ "tools/testing/selftests/mm/transhuge-stress.c", ], - copts = [ - "-D_GNU_SOURCE=", - ], + copts = _KSELFTEST_COPTS, includes = [ "tools/testing/selftests", "tools/testing/selftests/mm/", @@ -1563,6 +1560,7 @@ cc_library( "tools/testing/selftests/kselftest.h", "tools/testing/selftests/mm/uffd-common.h", ], + copts = _KSELFTEST_COPTS, includes = [ "include/uapi/", "tools/testing/selftests/mm/", @@ -1579,6 +1577,7 @@ cc_binary_with_abi( srcs = [ "tools/testing/selftests/mm/uffd-unit-tests.c", ], + copts = _KSELFTEST_COPTS, includes = [ "tools/testing/selftests", "tools/testing/selftests/mm/", @@ -1597,7 +1596,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_size_test_get_size", srcs = ["tools/testing/selftests/size/get_size.c"], - copts = select({ + copts = _KSELFTEST_COPTS + select({ ":x86_64": ["-mstackrealign"], "//conditions:default": [], }), @@ -1614,9 +1613,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_timers_adjtick", srcs = ["tools/testing/selftests/timers/adjtick.c"], - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1626,9 +1623,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_timers_alarmtimer_suspend", srcs = ["tools/testing/selftests/timers/alarmtimer-suspend.c"], - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1638,9 +1633,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_timers_change_skew", srcs = ["tools/testing/selftests/timers/change_skew.c"], - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1655,9 +1648,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_timers_clocksource_switch", srcs = ["tools/testing/selftests/timers/clocksource-switch.c"], - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1671,9 +1662,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_timers_freq_step", srcs = ["tools/testing/selftests/timers/freq-step.c"], - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1684,9 +1673,7 @@ cc_binary_with_abi( name = "kselftest_timers_inconsistency_check", srcs = ["tools/testing/selftests/timers/inconsistency-check.c"], out = "inconsistency-check", - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1696,9 +1683,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_timers_leap_a_day", srcs = ["tools/testing/selftests/timers/leap-a-day.c"], - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1708,9 +1693,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_timers_leapcrash", srcs = ["tools/testing/selftests/timers/leapcrash.c"], - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1721,9 +1704,7 @@ cc_binary_with_abi( name = "kselftest_timers_nanosleep", srcs = ["tools/testing/selftests/timers/nanosleep.c"], out = "nanosleep", - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1734,9 +1715,7 @@ cc_binary_with_abi( name = "kselftest_timers_nsleep_lat", srcs = ["tools/testing/selftests/timers/nsleep-lat.c"], out = "nsleep-lat", - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1746,9 +1725,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_timers_posix_timers", srcs = ["tools/testing/selftests/timers/posix_timers.c"], - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1759,9 +1736,7 @@ cc_binary_with_abi( name = "kselftest_timers_tests_raw_skew", srcs = ["tools/testing/selftests/timers/raw_skew.c"], out = "raw_skew", - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1771,9 +1746,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_timers_set_2038", srcs = ["tools/testing/selftests/timers/set-2038.c"], - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1788,9 +1761,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_timers_set_tai", srcs = ["tools/testing/selftests/timers/set-tai.c"], - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1800,9 +1771,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_timers_set_timer_lat", srcs = ["tools/testing/selftests/timers/set-timer-lat.c"], - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1812,9 +1781,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_timers_set_tz", srcs = ["tools/testing/selftests/timers/set-tz.c"], - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1824,9 +1791,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_timers_skew_consistency", srcs = ["tools/testing/selftests/timers/skew_consistency.c"], - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1839,9 +1804,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_timers_threadtest", srcs = ["tools/testing/selftests/timers/threadtest.c"], - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1851,9 +1814,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_timers_valid_adjtimex", srcs = ["tools/testing/selftests/timers/valid-adjtimex.c"], - copts = [ - "-O3", - ], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1863,7 +1824,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_net_socket", srcs = ["tools/testing/selftests/net/socket.c"], - copts = ["-Wno-gnu-variable-sized-type-not-at-end"], + copts = _KSELFTEST_COPTS + ["-Wno-gnu-variable-sized-type-not-at-end"], includes = ["tools/testing/selftests"], path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], @@ -1874,6 +1835,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_net_reuseaddr_conflict", srcs = ["tools/testing/selftests/net/reuseaddr_conflict.c"], + copts = _KSELFTEST_COPTS, includes = ["tools/testing/selftests"], path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], @@ -1887,7 +1849,7 @@ cc_binary_with_abi( "tools/testing/selftests/net/psock_lib.h", "tools/testing/selftests/net/psock_tpacket.c", ], - copts = ["-Wno-gnu-variable-sized-type-not-at-end"], + copts = _KSELFTEST_COPTS + ["-Wno-gnu-variable-sized-type-not-at-end"], includes = ["tools/testing/selftests"], path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], @@ -1898,6 +1860,7 @@ cc_binary_with_abi( cc_binary_with_abi( name = "kselftest_capabilities_test_execve", srcs = ["tools/testing/selftests/capabilities/test_execve.c"], + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1912,6 +1875,7 @@ cc_binary_with_abi( name = "kselftest_capabilities_validate_cap", srcs = ["tools/testing/selftests/capabilities/validate_cap.c"], out = "validate_cap", + copts = _KSELFTEST_COPTS, path_prefix = _KSELFTEST_DIR, target_compatible_with = ["@platforms//os:android"], visibility = ["//visibility:private"], @@ -1927,7 +1891,7 @@ cc_binary_with_abi( "tools/testing/selftests/clone3/clone3_selftests.h", "tools/testing/selftests/seccomp/seccomp_bpf.c", ], - copts = [ + copts = _KSELFTEST_COPTS + [ "-Wno-unused-function", "-D__GLIBC_PREREQ(a,b)", ], @@ -1951,11 +1915,7 @@ cc_binary_with_abi( "x86_64", "x86", ], - copts = [ - "-std=gnu99", - "-O2", - "-pthread", - ], + copts = _KSELFTEST_COPTS, includes = ["tools/testing/selftests"], linkopts = ["-static"], path_prefix = _KSELFTEST_DIR, @@ -1976,11 +1936,7 @@ cc_binary_with_abi( "x86_64", "x86", ], - copts = [ - "-std=gnu99", - "-O2", - "-pthread", - ], + copts = _KSELFTEST_COPTS, includes = ["tools/testing/selftests"], linkopts = ["-static"], path_prefix = _KSELFTEST_DIR, @@ -2001,11 +1957,7 @@ cc_binary_with_abi( "x86_64", "x86", ], - copts = [ - "-std=gnu99", - "-O2", - "-pthread", - ], + copts = _KSELFTEST_COPTS, includes = ["tools/testing/selftests"], linkopts = ["-static"], path_prefix = _KSELFTEST_DIR, @@ -2026,11 +1978,7 @@ cc_binary_with_abi( "x86_64", "x86", ], - copts = [ - "-std=gnu99", - "-O2", - "-pthread", - ], + copts = _KSELFTEST_COPTS, includes = ["tools/testing/selftests"], linkopts = ["-static"], path_prefix = _KSELFTEST_DIR, @@ -2051,11 +1999,7 @@ cc_binary_with_abi( "x86_64", "x86", ], - copts = [ - "-std=gnu99", - "-O2", - "-pthread", - ], + copts = _KSELFTEST_COPTS, includes = ["tools/testing/selftests"], linkopts = [ "-static", @@ -2080,11 +2024,7 @@ cc_binary_with_abi( "x86_64", "x86", ], - copts = [ - "-std=gnu99", - "-O2", - "-pthread", - ], + copts = _KSELFTEST_COPTS, includes = ["tools/testing/selftests"], linkopts = ["-static"], path_prefix = _KSELFTEST_DIR,