13298bea7Sopenharmony_ci# Copyright (C) 2022 Huawei Device Co., Ltd.
23298bea7Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
33298bea7Sopenharmony_ci# you may not use this file except in compliance with the License.
43298bea7Sopenharmony_ci# You may obtain a copy of the License at
53298bea7Sopenharmony_ci#
63298bea7Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
73298bea7Sopenharmony_ci#
83298bea7Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
93298bea7Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
103298bea7Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
113298bea7Sopenharmony_ci# See the License for the specific language governing permissions and
123298bea7Sopenharmony_ci# limitations under the License.
133298bea7Sopenharmony_ci
143298bea7Sopenharmony_ciltp_source_dir = "third_party/ltp"
153298bea7Sopenharmony_ciltp_script_dir = "kernel/linux/build/test/kernel_ltp"
163298bea7Sopenharmony_ci
173298bea7Sopenharmony_cigroup("HatsKernelTest") {
183298bea7Sopenharmony_ci  testonly = true
193298bea7Sopenharmony_ci  deps = [ "syscalls:HatsSyscallsTest" ]
203298bea7Sopenharmony_ci}
213298bea7Sopenharmony_ci
223298bea7Sopenharmony_cistatic_library("kernel_ltp_test") {
233298bea7Sopenharmony_ci  deps = [ ":generate_config" ]
243298bea7Sopenharmony_ci  include_dirs = [
253298bea7Sopenharmony_ci    "${root_build_dir}/tests/ltp_testcases/ltp/include",
263298bea7Sopenharmony_ci    "${root_build_dir}/tests/ltp_testcases/ltp/include/old",
273298bea7Sopenharmony_ci  ]
283298bea7Sopenharmony_ci  cflags = [ "-w" ]
293298bea7Sopenharmony_ci  defines = [
303298bea7Sopenharmony_ci    "LTPLIB",
313298bea7Sopenharmony_ci    "HAVE_ATOMIC_MEMORY_MODEL=1",
323298bea7Sopenharmony_ci    "HAVE_STRUCT_FILE_HANDLE",
333298bea7Sopenharmony_ci  ]
343298bea7Sopenharmony_ci  sources = [
353298bea7Sopenharmony_ci    "//third_party/ltp/lib/cloner.c",
363298bea7Sopenharmony_ci    "//third_party/ltp/lib/errnos.h",
373298bea7Sopenharmony_ci    "//third_party/ltp/lib/get_path.c",
383298bea7Sopenharmony_ci    "//third_party/ltp/lib/parse_opts.c",
393298bea7Sopenharmony_ci    "//third_party/ltp/lib/random_range.c",
403298bea7Sopenharmony_ci    "//third_party/ltp/lib/safe_file_ops.c",
413298bea7Sopenharmony_ci    "//third_party/ltp/lib/safe_macros.c",
423298bea7Sopenharmony_ci    "//third_party/ltp/lib/safe_net.c",
433298bea7Sopenharmony_ci    "//third_party/ltp/lib/safe_pthread.c",
443298bea7Sopenharmony_ci    "//third_party/ltp/lib/safe_stdio.c",
453298bea7Sopenharmony_ci    "//third_party/ltp/lib/self_exec.c",
463298bea7Sopenharmony_ci    "//third_party/ltp/lib/signame.h",
473298bea7Sopenharmony_ci    "//third_party/ltp/lib/tlibio.c",
483298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_af_alg.c",
493298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_ansi_color.c",
503298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_arch.c",
513298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_assert.c",
523298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_bool_expr.c",
533298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_buffers.c",
543298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_capability.c",
553298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_cgroup.c",
563298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_checkpoint.c",
573298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_checksum.c",
583298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_clocks.c",
593298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_clone.c",
603298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_cmd.c",
613298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_coredump.c",
623298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_cpu.c",
633298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_crypto.c",
643298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_device.c",
653298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_dir_is_empty.c",
663298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_fill_file.c",
673298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_fill_fs.c",
683298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_fips.c",
693298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_fs_has_free.c",
703298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_fs_link_count.c",
713298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_fs_setup.c",
723298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_fs_type.c",
733298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_get_bad_addr.c",
743298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_hugepage.c",
753298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_ioctl.c",
763298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_kconfig.c",
773298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_kernel.c",
783298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_kvercmp.c",
793298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_lockdown.c",
803298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_memutils.c",
813298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_mkfs.c",
823298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_module.c",
833298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_net.c",
843298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_netdevice.c",
853298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_parse_opts.c",
863298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_path_has_mnt_flags.c",
873298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_pid.c",
883298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_process_state.c",
893298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_res.c",
903298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_resource.c",
913298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_rtctime.c",
923298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_rtnetlink.c",
933298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_safe_file_at.c",
943298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_safe_io_uring.c",
953298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_safe_macros.c",
963298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_safe_sysv_ipc.c",
973298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_safe_timerfd.c",
983298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_sig.c",
993298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_sig_proc.c",
1003298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_status.c",
1013298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_supported_fs_types.c",
1023298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_sys_conf.c",
1033298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_taint.c",
1043298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_test.c",
1053298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_timer.c",
1063298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_timer_test.c",
1073298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_tmpdir.c",
1083298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_uid.c",
1093298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_virt.c",
1103298bea7Sopenharmony_ci    "//third_party/ltp/lib/tst_wallclock.c",
1113298bea7Sopenharmony_ci  ]
1123298bea7Sopenharmony_ci}
1133298bea7Sopenharmony_ci
1143298bea7Sopenharmony_ciaction("generate_config") {
1153298bea7Sopenharmony_ci  script = "generate_config.sh"
1163298bea7Sopenharmony_ci  outputs = [ "${root_build_dir}/tests/ltp_testcases/output" ]
1173298bea7Sopenharmony_ci  args = [
1183298bea7Sopenharmony_ci    rebase_path("${root_build_dir}/../../${ltp_source_dir}"),
1193298bea7Sopenharmony_ci    rebase_path("${root_build_dir}/../../${ltp_script_dir}"),
1203298bea7Sopenharmony_ci    rebase_path("${root_build_dir}/tests/ltp_testcases"),
1213298bea7Sopenharmony_ci  ]
1223298bea7Sopenharmony_ci}
123