From ba520a32ce71715968390d2e2ce3023d256b76a2 Mon Sep 17 00:00:00 2001 From: "Isaac J. Manjarres" Date: Thu, 5 Dec 2024 14:09:19 -0800 Subject: [PATCH] ANDROID: Add memfd self tests Memfd is important to Android, so add support for building and running the memfd self test in presubmit. Bug: 382547417 Signed-off-by: Isaac J. Manjarres (cherry picked from https://android-review.googlesource.com/q/commit:f369010a2a779c5df3c4063ba88e4cc04e92496a) Merged-In: I5df07ae00f6ee861c41f55e5ef46517b960c9d8f Change-Id: I5df07ae00f6ee861c41f55e5ef46517b960c9d8f --- BUILD.bazel | 24 +++++++++++++++++++ .../selftests/android/config_arm64.xml | 1 + .../selftests/android/config_x86_64.xml | 1 + 3 files changed, 26 insertions(+) diff --git a/BUILD.bazel b/BUILD.bazel index 0862bd4cc3bb..4c9909ad3012 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1989,6 +1989,28 @@ cc_binary_with_abi( ], ) +cc_library( + name = "kselftest_memfd", + srcs = ["tools/testing/selftests/memfd/common.c"], + hdrs = ["tools/testing/selftests/memfd/common.h"], + copts = _KSELFTEST_COPTS, + visibility = ["//visibility:private"], + deps = [ + ":kselftest_headers_lib", + ], +) + +cc_binary_with_abi( + name = "kselftest_memfd_test", + srcs = ["tools/testing/selftests/memfd/memfd_test.c"], + copts = _KSELFTEST_COPTS, + includes = ["tools/testing/selftests"], + path_prefix = _KSELFTEST_DIR, + target_compatible_with = ["@platforms//os:android"], + visibility = ["//visibility:private"], + deps = [":kselftest_memfd"], +) + cc_binary_with_abi( name = "kselftest_mm_compaction_test", srcs = ["tools/testing/selftests/mm/compaction_test.c"], @@ -2699,6 +2721,7 @@ pkg_filegroup( ":kselftest_futex_futex_wait_wouldblock_x86_64", ":kselftest_futex_futex_wait_x86_64", ":kselftest_kcmp_kcmp_test_x86_64", + ":kselftest_memfd_test_x86_64", ":kselftest_mm_compaction_test_x86_64", ":kselftest_mm_hugepage_mmap_x86_64", ":kselftest_mm_hugepage_shm_x86_64", @@ -2899,6 +2922,7 @@ pkg_filegroup( ":kselftest_futex_futex_wait_uninitialized_heap_arm64", ":kselftest_futex_futex_wait_wouldblock_arm64", ":kselftest_kcmp_kcmp_test_arm64", + ":kselftest_memfd_test_arm64", ":kselftest_mm_compaction_test_arm64", ":kselftest_mm_hugepage_mmap_arm64", ":kselftest_mm_hugepage_shm_arm64", diff --git a/tools/testing/selftests/android/config_arm64.xml b/tools/testing/selftests/android/config_arm64.xml index 9c06d3d6fda6..4981a2747a25 100644 --- a/tools/testing/selftests/android/config_arm64.xml +++ b/tools/testing/selftests/android/config_arm64.xml @@ -57,6 +57,7 @@ SPDX-License-Identifier: GPL-2.0 OR Apache-2.0