ANDROID: Add x86 specific self tests

Build and enable x86 kselftests

Bug: 310227391
Change-Id: Ica58f1e8e0994bbd7768a0e99ffe41c9e4741c81
Signed-off-by: Weijia He <hwj@google.com>
This commit is contained in:
Weijia He
2023-12-11 13:52:17 +08:00
committed by Treehugger Robot
parent 07e3cca929
commit bb9d33b2a7
2 changed files with 148 additions and 0 deletions
+142
View File
@@ -1851,6 +1851,142 @@ cc_binary_with_abi(
],
)
cc_binary_with_abi(
name = "kselftest_x86_single_step_syscall",
srcs = [
"tools/testing/selftests/x86/helpers.h",
"tools/testing/selftests/x86/single_step_syscall.c",
],
abis = ["x86_64"],
copts = [
"-std=gnu99",
"-O2",
"-pthread",
],
includes = ["tools/testing/selftests"],
linkopts = ["-static"],
path_prefix = _KSELFTEST_DIR,
target_compatible_with = ["@platforms//os:android"],
visibility = ["//visibility:private"],
deps = [
":kselftest_headers_lib",
],
)
cc_binary_with_abi(
name = "kselftest_x86_syscall_nt",
srcs = [
"tools/testing/selftests/x86/helpers.h",
"tools/testing/selftests/x86/syscall_nt.c",
],
abis = ["x86_64"],
copts = [
"-std=gnu99",
"-O2",
"-pthread",
],
includes = ["tools/testing/selftests"],
linkopts = ["-static"],
path_prefix = _KSELFTEST_DIR,
target_compatible_with = ["@platforms//os:android"],
visibility = ["//visibility:private"],
deps = [
":kselftest_headers_lib",
],
)
cc_binary_with_abi(
name = "kselftest_x86_ptrace_syscall",
srcs = [
"tools/testing/selftests/x86/helpers.h",
"tools/testing/selftests/x86/ptrace_syscall.c",
],
abis = ["x86_64"],
copts = [
"-std=gnu99",
"-O2",
"-pthread",
],
includes = ["tools/testing/selftests"],
linkopts = ["-static"],
path_prefix = _KSELFTEST_DIR,
target_compatible_with = ["@platforms//os:android"],
visibility = ["//visibility:private"],
deps = [
":kselftest_headers_lib",
],
)
cc_binary_with_abi(
name = "kselftest_x86_test_mremap_vdso",
srcs = [
"tools/testing/selftests/x86/helpers.h",
"tools/testing/selftests/x86/test_mremap_vdso.c",
],
abis = ["x86_64"],
copts = [
"-std=gnu99",
"-O2",
"-pthread",
],
includes = ["tools/testing/selftests"],
linkopts = ["-static"],
path_prefix = _KSELFTEST_DIR,
target_compatible_with = ["@platforms//os:android"],
visibility = ["//visibility:private"],
deps = [
":kselftest_headers_lib",
],
)
cc_binary_with_abi(
name = "kselftest_x86_check_initial_reg_state",
srcs = [
"tools/testing/selftests/x86/check_initial_reg_state.c",
"tools/testing/selftests/x86/helpers.h",
],
abis = ["x86_64"],
copts = [
"-std=gnu99",
"-O2",
"-pthread",
],
includes = ["tools/testing/selftests"],
linkopts = [
"-static",
"-Wl",
"-ereal_start",
],
path_prefix = _KSELFTEST_DIR,
target_compatible_with = ["@platforms//os:android"],
visibility = ["//visibility:private"],
deps = [
":kselftest_headers_lib",
],
)
cc_binary_with_abi(
name = "kselftest_x86_ldt_gdt",
srcs = [
"tools/testing/selftests/x86/helpers.h",
"tools/testing/selftests/x86/ldt_gdt.c",
],
abis = ["x86_64"],
copts = [
"-std=gnu99",
"-O2",
"-pthread",
],
includes = ["tools/testing/selftests"],
linkopts = ["-static"],
path_prefix = _KSELFTEST_DIR,
target_compatible_with = ["@platforms//os:android"],
visibility = ["//visibility:private"],
deps = [
":kselftest_headers_lib",
],
)
copy_file(
name = "kselftest_gen_config",
src = select({
@@ -1921,6 +2057,12 @@ android_filegroup(
":kselftest_vdso_vdso_test_clock_getres_x86_64",
":kselftest_vdso_vdso_test_getcpu_x86_64",
":kselftest_vdso_vdso_test_gettimeofday_x86_64",
":kselftest_x86_check_initial_reg_state_x86_64",
":kselftest_x86_ldt_gdt_x86_64",
":kselftest_x86_ptrace_syscall_x86_64",
":kselftest_x86_single_step_syscall_x86_64",
":kselftest_x86_syscall_nt_x86_64",
":kselftest_x86_test_mremap_vdso_x86_64",
],
cpu = "x86_64",
visibility = ["//visibility:private"],
@@ -85,5 +85,11 @@ SPDX-License-Identifier: GPL-2.0 OR Apache-2.0
<option name="test-command-line" key="kselftest_vdso_vdso_test_clock_getres" value="cd &ktest_dir;; ./kselftest_vdso_vdso_test_clock_getres" />
<option name="test-command-line" key="kselftest_vdso_vdso_test_getcpu" value="cd &ktest_dir;; ./kselftest_vdso_vdso_test_getcpu" />
<option name="test-command-line" key="kselftest_vdso_vdso_test_gettimeofday" value="cd &ktest_dir;; ./kselftest_vdso_vdso_test_gettimeofday" />
<option name="test-command-line" key="kselftest_x86_check_initial_reg_state" value="cd &ktest_dir;; ./kselftest_x86_check_initial_reg_state" />
<option name="test-command-line" key="kselftest_x86_ldt_gdt" value="cd &ktest_dir;; ./kselftest_x86_ldt_gdt" />
<option name="test-command-line" key="kselftest_x86_ptrace_syscall" value="cd &ktest_dir;; ./kselftest_x86_ptrace_syscall" />
<option name="test-command-line" key="kselftest_x86_single_step_syscall" value="cd &ktest_dir;; ./kselftest_x86_single_step_syscall" />
<option name="test-command-line" key="kselftest_x86_syscall_nt" value="cd &ktest_dir;; ./kselftest_x86_syscall_nt" />
<option name="test-command-line" key="kselftest_x86_test_mremap_vdso" value="cd &ktest_dir;; ./kselftest_x86_test_mremap_vdso" />
</test>
</configuration>