1# Copyright (C) 2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14ltp_source_dir = "third_party/ltp"
15ltp_script_dir = "kernel/linux/build/test/kernel_ltp"
16
17group("HatsKernelTest") {
18  testonly = true
19  deps = [ "syscalls:HatsSyscallsTest" ]
20}
21
22static_library("kernel_ltp_test") {
23  deps = [ ":generate_config" ]
24  include_dirs = [
25    "${root_build_dir}/tests/ltp_testcases/ltp/include",
26    "${root_build_dir}/tests/ltp_testcases/ltp/include/old",
27  ]
28  cflags = [ "-w" ]
29  defines = [
30    "LTPLIB",
31    "HAVE_ATOMIC_MEMORY_MODEL=1",
32    "HAVE_STRUCT_FILE_HANDLE",
33  ]
34  sources = [
35    "//third_party/ltp/lib/cloner.c",
36    "//third_party/ltp/lib/errnos.h",
37    "//third_party/ltp/lib/get_path.c",
38    "//third_party/ltp/lib/parse_opts.c",
39    "//third_party/ltp/lib/random_range.c",
40    "//third_party/ltp/lib/safe_file_ops.c",
41    "//third_party/ltp/lib/safe_macros.c",
42    "//third_party/ltp/lib/safe_net.c",
43    "//third_party/ltp/lib/safe_pthread.c",
44    "//third_party/ltp/lib/safe_stdio.c",
45    "//third_party/ltp/lib/self_exec.c",
46    "//third_party/ltp/lib/signame.h",
47    "//third_party/ltp/lib/tlibio.c",
48    "//third_party/ltp/lib/tst_af_alg.c",
49    "//third_party/ltp/lib/tst_ansi_color.c",
50    "//third_party/ltp/lib/tst_arch.c",
51    "//third_party/ltp/lib/tst_assert.c",
52    "//third_party/ltp/lib/tst_bool_expr.c",
53    "//third_party/ltp/lib/tst_buffers.c",
54    "//third_party/ltp/lib/tst_capability.c",
55    "//third_party/ltp/lib/tst_cgroup.c",
56    "//third_party/ltp/lib/tst_checkpoint.c",
57    "//third_party/ltp/lib/tst_checksum.c",
58    "//third_party/ltp/lib/tst_clocks.c",
59    "//third_party/ltp/lib/tst_clone.c",
60    "//third_party/ltp/lib/tst_cmd.c",
61    "//third_party/ltp/lib/tst_coredump.c",
62    "//third_party/ltp/lib/tst_cpu.c",
63    "//third_party/ltp/lib/tst_crypto.c",
64    "//third_party/ltp/lib/tst_device.c",
65    "//third_party/ltp/lib/tst_dir_is_empty.c",
66    "//third_party/ltp/lib/tst_fill_file.c",
67    "//third_party/ltp/lib/tst_fill_fs.c",
68    "//third_party/ltp/lib/tst_fips.c",
69    "//third_party/ltp/lib/tst_fs_has_free.c",
70    "//third_party/ltp/lib/tst_fs_link_count.c",
71    "//third_party/ltp/lib/tst_fs_setup.c",
72    "//third_party/ltp/lib/tst_fs_type.c",
73    "//third_party/ltp/lib/tst_get_bad_addr.c",
74    "//third_party/ltp/lib/tst_hugepage.c",
75    "//third_party/ltp/lib/tst_ioctl.c",
76    "//third_party/ltp/lib/tst_kconfig.c",
77    "//third_party/ltp/lib/tst_kernel.c",
78    "//third_party/ltp/lib/tst_kvercmp.c",
79    "//third_party/ltp/lib/tst_lockdown.c",
80    "//third_party/ltp/lib/tst_memutils.c",
81    "//third_party/ltp/lib/tst_mkfs.c",
82    "//third_party/ltp/lib/tst_module.c",
83    "//third_party/ltp/lib/tst_net.c",
84    "//third_party/ltp/lib/tst_netdevice.c",
85    "//third_party/ltp/lib/tst_parse_opts.c",
86    "//third_party/ltp/lib/tst_path_has_mnt_flags.c",
87    "//third_party/ltp/lib/tst_pid.c",
88    "//third_party/ltp/lib/tst_process_state.c",
89    "//third_party/ltp/lib/tst_res.c",
90    "//third_party/ltp/lib/tst_resource.c",
91    "//third_party/ltp/lib/tst_rtctime.c",
92    "//third_party/ltp/lib/tst_rtnetlink.c",
93    "//third_party/ltp/lib/tst_safe_file_at.c",
94    "//third_party/ltp/lib/tst_safe_io_uring.c",
95    "//third_party/ltp/lib/tst_safe_macros.c",
96    "//third_party/ltp/lib/tst_safe_sysv_ipc.c",
97    "//third_party/ltp/lib/tst_safe_timerfd.c",
98    "//third_party/ltp/lib/tst_sig.c",
99    "//third_party/ltp/lib/tst_sig_proc.c",
100    "//third_party/ltp/lib/tst_status.c",
101    "//third_party/ltp/lib/tst_supported_fs_types.c",
102    "//third_party/ltp/lib/tst_sys_conf.c",
103    "//third_party/ltp/lib/tst_taint.c",
104    "//third_party/ltp/lib/tst_test.c",
105    "//third_party/ltp/lib/tst_timer.c",
106    "//third_party/ltp/lib/tst_timer_test.c",
107    "//third_party/ltp/lib/tst_tmpdir.c",
108    "//third_party/ltp/lib/tst_uid.c",
109    "//third_party/ltp/lib/tst_virt.c",
110    "//third_party/ltp/lib/tst_wallclock.c",
111  ]
112}
113
114action("generate_config") {
115  script = "generate_config.sh"
116  outputs = [ "${root_build_dir}/tests/ltp_testcases/output" ]
117  args = [
118    rebase_path("${root_build_dir}/../../${ltp_source_dir}"),
119    rebase_path("${root_build_dir}/../../${ltp_script_dir}"),
120    rebase_path("${root_build_dir}/tests/ltp_testcases"),
121  ]
122}
123