1// 2// Copyright (C) 2016 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17cc_defaults { 18 name: "kselftest_defaults", 19 cflags: [ 20 // Hacks for bionic compatibility 21 "-include bionic-compat.h", 22 23 "-Wall", 24 25 // Silence noisy warnings 26 "-Wno-deprecated", 27 "-Wno-format", 28 "-Wno-gnu-designator", 29 "-Wno-macro-redefined", 30 "-Wno-missing-field-initializers", 31 "-Wno-parentheses-equality", 32 "-Wno-pointer-arith", 33 "-Wno-sign-compare", 34 "-Wno-unused-parameter", 35 "-Wno-shift-negative-value", 36 "-Wno-switch", 37 "-Wno-absolute-value", 38 "-Wno-non-literal-null-conversion", 39 "-Wno-unused-value", 40 "-Wno-unused-variable", 41 "-Wno-unused-parameter", 42 "-Wno-empty-body", 43 "-Wno-literal-conversion", 44 "-Werror", 45 ], 46 47 local_include_dirs: ["android/include"], 48 gtest: false, 49 no_named_install_directory: true, 50 51 test_per_src: true, 52 arch: { 53 mips: { 54 enabled: false, 55 }, 56 mips64: { 57 enabled: false, 58 }, 59 }, 60} 61 62// breakpoints test 63cc_test { 64 name: "kselftest_breakpoints_tests", 65 relative_install_path: "linux-kselftest/breakpoints", 66 srcs: [ 67 "tools/testing/selftests/breakpoints/step_after_suspend_test.c", 68 ], 69 defaults: ["kselftest_defaults"], 70 arch: { 71 arm: { 72 enabled: false, 73 }, 74 arm64: { 75 srcs: [ 76 "tools/testing/selftests/breakpoints/breakpoint_test_arm64.c", 77 ], 78 }, 79 x86: { 80 srcs: [ 81 "tools/testing/selftests/breakpoints/breakpoint_test.c", 82 ], 83 }, 84 }, 85} 86 87// capabilities test 88cc_test { 89 name: "kselftest_capabilities_test", 90 relative_install_path: "linux-kselftest/capabilities", 91 srcs: [ 92 "tools/testing/selftests/capabilities/test_execve.c", 93 "tools/testing/selftests/capabilities/validate_cap.c", 94 ], 95 defaults: ["kselftest_defaults"], 96 static_libs: ["libcap-ng"], 97} 98 99// Cpu-hotplug test 100sh_test { 101 name: "kselftest_cpu-hotplug_cpu-on-off-test", 102 sub_dir: "linux-kselftest/cpu-hotplug", 103 src: "tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh", 104 filename_from_src: true, 105 compile_multilib: "both", 106} 107 108// Efivarfs test 109cc_test { 110 name: "kselftest_efivarfs_tests", 111 relative_install_path: "linux-kselftest/efivarfs", 112 srcs: [ 113 "tools/testing/selftests/efivarfs/open-unlink.c", 114 "tools/testing/selftests/efivarfs/create-read.c", 115 ], 116 defaults: ["kselftest_defaults"], 117} 118 119sh_test { 120 name: "kselftest_efivarfs_efivarfs", 121 sub_dir: "linux-kselftest/efivarfs", 122 src: "tools/testing/selftests/efivarfs/efivarfs.sh", 123 filename_from_src: true, 124 compile_multilib: "both", 125} 126 127// Exec test 128cc_test { 129 name: "kselftest_exec_test", 130 relative_install_path: "linux-kselftest/exec", 131 srcs: [ 132 "tools/testing/selftests/exec/execveat.c", 133 ], 134 defaults: ["kselftest_defaults"], 135} 136 137sh_test { 138 name: "kselftest_exec_execveat.sh", 139 sub_dir: "linux-kselftest/exec", 140 src: "tools/testing/selftests/exec/execveat.sh", 141 filename_from_src: true, 142 compile_multilib: "both", 143} 144 145// Firmware test 146sh_test { 147 name: "kselftest_firmware_fw_fallback", 148 sub_dir: "linux-kselftest/firmware", 149 src: "tools/testing/selftests/firmware/fw_fallback.sh", 150 filename_from_src: true, 151 compile_multilib: "both", 152} 153 154sh_test { 155 name: "kselftest_firmware_fw_filesystem", 156 sub_dir: "linux-kselftest/firmware", 157 src: "tools/testing/selftests/firmware/fw_filesystem.sh", 158 filename_from_src: true, 159 compile_multilib: "both", 160} 161 162// Ftrace test 163sh_test { 164 name: "kselftest_ftrace_ftracetest", 165 sub_dir: "linux-kselftest/ftrace", 166 src: "tools/testing/selftests/ftrace/ftracetest", 167 filename_from_src: true, 168 compile_multilib: "both", 169} 170 171sh_test { 172 name: "kselftest_ftrace_test.d_functions", 173 sub_dir: "linux-kselftest/ftrace/test.d", 174 src: "tools/testing/selftests/ftrace/test.d/functions", 175 filename_from_src: true, 176 compile_multilib: "both", 177} 178 179sh_test { 180 name: "kselftest_ftrace_test.d_00basic_basic2", 181 sub_dir: "linux-kselftest/ftrace/test.d/00basic", 182 src: "tools/testing/selftests/ftrace/test.d/00basic/basic2.tc", 183 filename_from_src: true, 184 compile_multilib: "both", 185} 186 187sh_test { 188 name: "kselftest_ftrace_test.d_00basic_basic4", 189 sub_dir: "linux-kselftest/ftrace/test.d/00basic", 190 src: "tools/testing/selftests/ftrace/test.d/00basic/basic4.tc", 191 filename_from_src: true, 192 compile_multilib: "both", 193} 194 195sh_test { 196 name: "kselftest_ftrace_test.d_00basic_basic1", 197 sub_dir: "linux-kselftest/ftrace/test.d/00basic", 198 src: "tools/testing/selftests/ftrace/test.d/00basic/basic1.tc", 199 filename_from_src: true, 200 compile_multilib: "both", 201} 202 203sh_test { 204 name: "kselftest_ftrace_test.d_00basic_basic3", 205 sub_dir: "linux-kselftest/ftrace/test.d/00basic", 206 src: "tools/testing/selftests/ftrace/test.d/00basic/basic3.tc", 207 filename_from_src: true, 208 compile_multilib: "both", 209} 210 211sh_test { 212 name: "kselftest_ftrace_test.d_template", 213 sub_dir: "linux-kselftest/ftrace/test.d", 214 src: "tools/testing/selftests/ftrace/test.d/template", 215 filename_from_src: true, 216 compile_multilib: "both", 217} 218 219sh_test { 220 name: "kselftest_ftrace_test.d_instances_instance", 221 sub_dir: "linux-kselftest/ftrace/test.d/instances", 222 src: "tools/testing/selftests/ftrace/test.d/instances/instance.tc", 223 filename_from_src: true, 224 compile_multilib: "both", 225} 226 227sh_test { 228 name: "kselftest_ftrace_test.d_instances_instance-event", 229 sub_dir: "linux-kselftest/ftrace/test.d/instances", 230 src: "tools/testing/selftests/ftrace/test.d/instances/instance-event.tc", 231 filename_from_src: true, 232 compile_multilib: "both", 233} 234 235// Futex test 236cc_test { 237 name: "kselftest_futex_tests", 238 relative_install_path: "linux-kselftest/futex/functional", 239 srcs: [ 240 "tools/testing/selftests/futex/functional/futex_requeue_pi.c", 241 "tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c", 242 "tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c", 243 "tools/testing/selftests/futex/functional/futex_wait_private_mapped_file.c", 244 "tools/testing/selftests/futex/functional/futex_wait_timeout.c", 245 "tools/testing/selftests/futex/functional/futex_wait_uninitialized_heap.c", 246 "tools/testing/selftests/futex/functional/futex_wait_wouldblock.c", 247 ], 248 local_include_dirs: [ 249 "tools/testing/selftests/futex/include", 250 "tools/testing/selftests", 251 ], 252 cflags: [ 253 "-D_GNU_SOURCE", 254 "-pthread", 255 ], 256 defaults: ["kselftest_defaults"], 257} 258 259sh_test { 260 name: "kselftest_futex_functional_run.sh", 261 sub_dir: "linux-kselftest/futex/functional", 262 src: "tools/testing/selftests/futex/functional/run.sh", 263 filename_from_src: true, 264 compile_multilib: "both", 265} 266 267// intel_pstate test 268cc_test { 269 name: "kselftest_intel_pstate_tests", 270 relative_install_path: "linux-kselftest/intel_pstate", 271 srcs: [ 272 "tools/testing/selftests/intel_pstate/aperf.c", 273 "tools/testing/selftests/intel_pstate/msr.c", 274 ], 275 cflags: [ 276 "-D_GNU_SOURCE", 277 ], 278 defaults: ["kselftest_defaults"], 279 // TODO: test_data: intel_pstate/run.sh 280} 281 282sh_test { 283 name: "kselftest_intel_pstate_run.sh", 284 sub_dir: "linux-kselftest/intel_pstate", 285 src: "tools/testing/selftests/intel_pstate/run.sh", 286 filename_from_src: true, 287 compile_multilib: "both", 288} 289 290// Kcmp test 291cc_test { 292 name: "kselftest_kcmp_tests", 293 relative_install_path: "linux-kselftest/kcmp", 294 srcs: ["tools/testing/selftests/kcmp/kcmp_test.c"], 295 defaults: ["kselftest_defaults"], 296} 297 298// Lib test 299sh_test { 300 name: "kselftest_lib_printf", 301 sub_dir: "linux-kselftest/lib", 302 src: "tools/testing/selftests/lib/printf.sh", 303 filename_from_src: true, 304 compile_multilib: "both", 305} 306 307sh_test { 308 name: "kselftest_lib_bitmap", 309 sub_dir: "linux-kselftest/lib", 310 src: "tools/testing/selftests/lib/bitmap.sh", 311 filename_from_src: true, 312 compile_multilib: "both", 313} 314 315// media_tests test 316cc_test { 317 name: "kselftest_media_tests", 318 relative_install_path: "linux-kselftest/media_tests", 319 srcs: [ 320 "tools/testing/selftests/media_tests/media_device_test.c", 321 "tools/testing/selftests/media_tests/media_device_open.c", 322 "tools/testing/selftests/media_tests/video_device_test.c", 323 ], 324 defaults: ["kselftest_defaults"], 325} 326 327// Membarrier test 328cc_test { 329 name: "kselftest_membarrier_tests", 330 relative_install_path: "linux-kselftest/membarrier", 331 srcs: ["tools/testing/selftests/membarrier/membarrier_test.c"], 332 defaults: ["kselftest_defaults"], 333} 334 335// Memory-hotplug test 336sh_test { 337 name: "kselftest_memory-hotplug_mem-on-off-test", 338 sub_dir: "linux-kselftest/memory-hotplug", 339 src: "tools/testing/selftests/memory-hotplug/mem-on-off-test.sh", 340 filename_from_src: true, 341 compile_multilib: "both", 342} 343 344// Mount test 345cc_test { 346 name: "kselftest_mount_tests", 347 relative_install_path: "linux-kselftest/mount", 348 srcs: ["tools/testing/selftests/mount/unprivileged-remount-test.c"], 349 defaults: ["kselftest_defaults"], 350} 351 352// Net test 353cc_test { 354 name: "kselftest_net_tests", 355 relative_install_path: "linux-kselftest/net", 356 srcs: [ 357 "tools/testing/selftests/net/socket.c", 358 "tools/testing/selftests/net/psock_fanout.c", 359 "tools/testing/selftests/net/psock_tpacket.c", 360 "tools/testing/selftests/net/reuseport_dualstack.c", 361 "tools/testing/selftests/net/reuseaddr_conflict.c", 362 ], 363 defaults: ["kselftest_defaults"], 364 // TODO: test_data: net/test_bpf.sh 365} 366 367sh_test { 368 name: "kselftest_net_test_bpf", 369 sub_dir: "linux-kselftest/net", 370 src: "tools/testing/selftests/net/test_bpf.sh", 371 filename_from_src: true, 372 compile_multilib: "both", 373} 374 375// Pstore test 376sh_test { 377 name: "kselftest_pstore_pstore_tests", 378 sub_dir: "linux-kselftest/pstore", 379 src: "tools/testing/selftests/pstore/pstore_tests", 380 filename_from_src: true, 381 compile_multilib: "both", 382} 383 384sh_test { 385 name: "kselftest_pstore_pstore_post_reboot_tests", 386 sub_dir: "linux-kselftest/pstore", 387 src: "tools/testing/selftests/pstore/pstore_post_reboot_tests", 388 filename_from_src: true, 389 compile_multilib: "both", 390} 391 392sh_test { 393 name: "kselftest_pstore_common_tests", 394 sub_dir: "linux-kselftest/pstore", 395 src: "tools/testing/selftests/pstore/common_tests", 396 filename_from_src: true, 397 compile_multilib: "both", 398} 399 400sh_test { 401 name: "kselftest_pstore_pstore_crash_test", 402 sub_dir: "linux-kselftest/pstore", 403 src: "tools/testing/selftests/pstore/pstore_crash_test", 404 filename_from_src: true, 405 compile_multilib: "both", 406} 407 408// Ptrace test 409cc_test { 410 name: "kselftest_ptrace_tests", 411 relative_install_path: "linux-kselftest/ptrace", 412 srcs: ["tools/testing/selftests/ptrace/peeksiginfo.c"], 413 defaults: ["kselftest_defaults"], 414} 415 416// rtc test 417cc_test { 418 name: "kselftest_rtc_tests", 419 relative_install_path: "linux-kselftest/rtc", 420 srcs: ["tools/testing/selftests/rtc/rtctest.c"], 421 defaults: ["kselftest_defaults"], 422} 423 424// seccomp test 425cc_test { 426 name: "kselftest_seccomp_tests", 427 relative_install_path: "linux-kselftest/seccomp", 428 srcs: ["tools/testing/selftests/seccomp/seccomp_bpf.c"], 429 defaults: ["kselftest_defaults"], 430} 431 432// size test 433cc_test { 434 name: "kselftest_size_test", 435 relative_install_path: "linux-kselftest/size", 436 srcs: ["tools/testing/selftests/size/get_size.c"], 437 defaults: ["kselftest_defaults"], 438 nocrt: true, 439} 440 441// splice test 442cc_test { 443 name: "kselftest_splice_test", 444 relative_install_path: "linux-kselftest/splice", 445 srcs: ["tools/testing/selftests/splice/default_file_splice_read.c"], 446 defaults: ["kselftest_defaults"], 447} 448 449sh_test { 450 name: "kselftest_splice_default_file_splice_read.sh", 451 sub_dir: "linux-kselftest/splice", 452 src: "tools/testing/selftests/splice/default_file_splice_read.sh", 453 filename_from_src: true, 454 compile_multilib: "both", 455} 456 457// Static keys test 458sh_test { 459 name: "kselftest_static_keys_test_static_keys", 460 sub_dir: "linux-kselftest/static_keys", 461 src: "tools/testing/selftests/static_keys/test_static_keys.sh", 462 filename_from_src: true, 463 compile_multilib: "both", 464} 465 466// Timer test 467cc_test { 468 name: "kselftest_timer_tests", 469 relative_install_path: "linux-kselftest/timers", 470 srcs: [ 471 "tools/testing/selftests/timers/adjtick.c", 472 "tools/testing/selftests/timers/alarmtimer-suspend.c", 473 "tools/testing/selftests/timers/change_skew.c", 474 "tools/testing/selftests/timers/clocksource-switch.c", 475 "tools/testing/selftests/timers/freq-step.c", 476 "tools/testing/selftests/timers/inconsistency-check.c", 477 "tools/testing/selftests/timers/leap-a-day.c", 478 "tools/testing/selftests/timers/leapcrash.c", 479 "tools/testing/selftests/timers/nanosleep.c", 480 "tools/testing/selftests/timers/nsleep-lat.c", 481 "tools/testing/selftests/timers/posix_timers.c", 482 "tools/testing/selftests/timers/raw_skew.c", 483 "tools/testing/selftests/timers/set-2038.c", 484 "tools/testing/selftests/timers/set-tai.c", 485 "tools/testing/selftests/timers/set-timer-lat.c", 486 "tools/testing/selftests/timers/set-tz.c", 487 "tools/testing/selftests/timers/skew_consistency.c", 488 "tools/testing/selftests/timers/threadtest.c", 489 "tools/testing/selftests/timers/valid-adjtimex.c", 490 ], 491 cflags: [ 492 "-O3", 493 "-DKTEST", 494 ], 495 defaults: ["kselftest_defaults"], 496} 497 498// User test 499sh_test { 500 name: "kselftest_user_test_user_copy", 501 sub_dir: "linux-kselftest/user", 502 src: "tools/testing/selftests/user/test_user_copy.sh", 503 filename_from_src: true, 504 compile_multilib: "both", 505} 506 507// vdso test 508cc_test { 509 name: "kselftest_vdso_test", 510 relative_install_path: "linux-kselftest/vDSO", 511 srcs: [ 512 "tools/testing/selftests/vDSO/parse_vdso.c", 513 "tools/testing/selftests/vDSO/vdso_test.c", 514 ], 515 defaults: ["kselftest_defaults"], 516 test_per_src: false, 517} 518 519// Vm test 520cc_test { 521 name: "kselftest_vm_tests", 522 relative_install_path: "linux-kselftest/vm", 523 srcs: [ 524 "tools/testing/selftests/vm/compaction_test.c", 525 "tools/testing/selftests/vm/hugepage-mmap.c", 526 "tools/testing/selftests/vm/hugepage-shm.c", 527 "tools/testing/selftests/vm/map_hugetlb.c", 528 "tools/testing/selftests/vm/mlock-random-test.c", 529 "tools/testing/selftests/vm/mlock2-tests.c", 530 "tools/testing/selftests/vm/on-fault-limit.c", 531 "tools/testing/selftests/vm/thuge-gen.c", 532 "tools/testing/selftests/vm/transhuge-stress.c", 533 ], 534 defaults: ["kselftest_defaults"], 535 static_libs: ["libcap"], 536} 537 538cc_test { 539 name: "kselftest_vm64_tests", 540 relative_install_path: "linux-kselftest/vm", 541 srcs: [ 542 "tools/testing/selftests/vm/virtual_address_range.c", 543 ], 544 defaults: ["kselftest_defaults"], 545 enabled: false, 546 arch: { 547 arm64: { 548 enabled: true, 549 cflags: ["-D__aarch64__"], 550 }, 551 }, 552} 553 554sh_test { 555 name: "kselftest_vm_run_vmtests", 556 sub_dir: "linux-kselftest/vm", 557 src: "tools/testing/selftests/vm/run_vmtests", 558 filename_from_src: true, 559 compile_multilib: "both", 560} 561 562// x86 tests 563cc_test { 564 name: "kselftest_x86_tests", 565 relative_install_path: "linux-kselftest/x86", 566 srcs: [ 567 "tools/testing/selftests/x86/single_step_syscall.c", 568 "tools/testing/selftests/x86/syscall_nt.c", 569 "tools/testing/selftests/x86/test_mremap_vdso.c", 570 "tools/testing/selftests/x86/ldt_gdt.c", 571 ], 572 arch: { 573 arm: { 574 enabled: false, 575 }, 576 arm64: { 577 enabled: false, 578 }, 579 x86: { 580 srcs: [ 581 "tools/testing/selftests/x86/sysret_ss_attrs.c", 582 //"tools/testing/selftests/x86/entry_from_vm86.c", 583 "tools/testing/selftests/x86/syscall_arg_fault.c", 584 "tools/testing/selftests/x86/unwind_vdso.c", 585 "tools/testing/selftests/x86/test_FCMOV.c", 586 "tools/testing/selftests/x86/test_FCOMI.c", 587 "tools/testing/selftests/x86/test_FISTTP.c", 588 "tools/testing/selftests/x86/vdso_restorer.c", 589 ], 590 }, 591 }, 592 cflags: [ 593 "-O2", 594 "-pthread", 595 ], 596 c_std: "gnu99", 597 static_executable: true, 598 defaults: ["kselftest_defaults"], 599} 600 601cc_test { 602 name: "kselftest_x86_check_initial_reg_state", 603 stem: "check_initial_reg_state", 604 relative_install_path: "linux-kselftest/x86", 605 srcs: [ 606 "tools/testing/selftests/x86/check_initial_reg_state.c", 607 ], 608 arch: { 609 arm: { 610 enabled: false, 611 }, 612 arm64: { 613 enabled: false, 614 }, 615 }, 616 cflags: [ 617 "-O2", 618 "-pthread", 619 ], 620 c_std: "gnu99", 621 // check_initial_reg_state is special: it needs a custom entry, and it needs to be static so 622 // that its interpreter doesn't destroy its initial state. 623 ldflags: ["-Wl,-ereal_start"], 624 static_executable: true, 625 test_per_src: false, 626 defaults: ["kselftest_defaults"], 627} 628 629cc_test { 630 name: "kselftest_x86_ptrace_syscall", 631 stem: "ptrace_syscall", 632 relative_install_path: "linux-kselftest/x86", 633 srcs: [ 634 "tools/testing/selftests/x86/ptrace_syscall.c", 635 "tools/testing/selftests/x86/raw_syscall_helper_32.S", 636 ], 637 cflags: [ 638 "-O2", 639 "-pthread", 640 ], 641 c_std: "gnu99", 642 test_per_src: false, 643 defaults: ["kselftest_defaults"], 644 enabled: false, 645 arch: { 646 x86: { 647 enabled: true, 648 }, 649 }, 650} 651 652cc_test { 653 name: "kselftest_x86_test_syscall_vdso", 654 stem: "test_syscall_vdso", 655 relative_install_path: "linux-kselftest/x86", 656 srcs: [ 657 "tools/testing/selftests/x86/test_syscall_vdso.c", 658 "tools/testing/selftests/x86/thunks_32.S", 659 ], 660 cflags: [ 661 "-O2", 662 "-pthread", 663 ], 664 c_std: "gnu99", 665 static_executable: true, 666 test_per_src: false, 667 defaults: ["kselftest_defaults"], 668 enabled: false, 669 arch: { 670 x86: { 671 enabled: true, 672 }, 673 }, 674} 675 676// zram tests 677sh_test { 678 name: "kselftest_zram_zram.sh", 679 sub_dir: "linux-kselftest/zram", 680 src: "tools/testing/selftests/zram/zram.sh", 681 filename_from_src: true, 682 compile_multilib: "both", 683} 684 685sh_test { 686 name: "kselftest_zram_zram01.sh", 687 sub_dir: "linux-kselftest/zram", 688 src: "tools/testing/selftests/zram/zram01.sh", 689 filename_from_src: true, 690 compile_multilib: "both", 691} 692 693sh_test { 694 name: "kselftest_zram_zram02.sh", 695 sub_dir: "linux-kselftest/zram", 696 src: "tools/testing/selftests/zram/zram02.sh", 697 filename_from_src: true, 698 compile_multilib: "both", 699} 700 701sh_test { 702 name: "kselftest_zram_zram_lib.sh", 703 sub_dir: "linux-kselftest/zram", 704 src: "tools/testing/selftests/zram/zram_lib.sh", 705 filename_from_src: true, 706 compile_multilib: "both", 707} 708