diff --git a/test/BUILD.gn b/test/BUILD.gn index 89103af7b54a1832bfce25003655b4694d208cba..a1db102b887c805cce44f94374a75db9a5ebd07f 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -47,6 +47,7 @@ group("linuxkerneltest") { ":accesstokenid_test", ":init_runtest", "fuzztest:fuzztest", + "kernel_ltp:HatsKernelTest", ] } } diff --git a/test/kernel_ltp/BUILD.gn b/test/kernel_ltp/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..ea351654b294c28c95eae0878f80972ba50a3e11 --- /dev/null +++ b/test/kernel_ltp/BUILD.gn @@ -0,0 +1,122 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ltp_source_dir = "//third_party/ltp" +ltp_script_dir = "kernel/linux/build/test/kernel_ltp" + +group("HatsKernelTest") { + testonly = true + deps = [ "syscalls:HatsSyscallsTest" ] +} + +static_library("kernel_ltp_test") { + include_dirs = [ + "${root_build_dir}/tests/ltp_testcases/include", + "${root_build_dir}/tests/ltp_testcases/include/lapi", + "${root_build_dir}/tests/ltp_testcases/ltp/include", + "${root_build_dir}/tests/ltp_testcases/ltp/include/old", + ] + + cflags = [ "-w" ] + defines = [ "LTPLIB" ] + deps = [ ":generate_config" ] + + sources = [ + "//third_party/ltp/lib/cloner.c", + "//third_party/ltp/lib/errnos.h", + "//third_party/ltp/lib/get_path.c", + "//third_party/ltp/lib/parse_opts.c", + "//third_party/ltp/lib/random_range.c", + "//third_party/ltp/lib/safe_file_ops.c", + "//third_party/ltp/lib/safe_macros.c", + "//third_party/ltp/lib/safe_net.c", + "//third_party/ltp/lib/safe_pthread.c", + "//third_party/ltp/lib/safe_stdio.c", + "//third_party/ltp/lib/self_exec.c", + "//third_party/ltp/lib/signame.h", + "//third_party/ltp/lib/tlibio.c", + "//third_party/ltp/lib/tst_af_alg.c", + "//third_party/ltp/lib/tst_ansi_color.c", + "//third_party/ltp/lib/tst_arch.c", + "//third_party/ltp/lib/tst_assert.c", + "//third_party/ltp/lib/tst_bool_expr.c", + "//third_party/ltp/lib/tst_buffers.c", + "//third_party/ltp/lib/tst_capability.c", + "//third_party/ltp/lib/tst_cgroup.c", + "//third_party/ltp/lib/tst_checkpoint.c", + "//third_party/ltp/lib/tst_checksum.c", + "//third_party/ltp/lib/tst_clocks.c", + "//third_party/ltp/lib/tst_clone.c", + "//third_party/ltp/lib/tst_cmd.c", + "//third_party/ltp/lib/tst_coredump.c", + "//third_party/ltp/lib/tst_cpu.c", + "//third_party/ltp/lib/tst_crypto.c", + "//third_party/ltp/lib/tst_device.c", + "//third_party/ltp/lib/tst_dir_is_empty.c", + "//third_party/ltp/lib/tst_fill_file.c", + "//third_party/ltp/lib/tst_fill_fs.c", + "//third_party/ltp/lib/tst_fips.c", + "//third_party/ltp/lib/tst_fs_has_free.c", + "//third_party/ltp/lib/tst_fs_link_count.c", + "//third_party/ltp/lib/tst_fs_setup.c", + "//third_party/ltp/lib/tst_fs_type.c", + "//third_party/ltp/lib/tst_get_bad_addr.c", + "//third_party/ltp/lib/tst_hugepage.c", + "//third_party/ltp/lib/tst_ioctl.c", + "//third_party/ltp/lib/tst_kconfig.c", + "//third_party/ltp/lib/tst_kernel.c", + "//third_party/ltp/lib/tst_kvercmp.c", + "//third_party/ltp/lib/tst_lockdown.c", + "//third_party/ltp/lib/tst_memutils.c", + "//third_party/ltp/lib/tst_mkfs.c", + "//third_party/ltp/lib/tst_module.c", + "//third_party/ltp/lib/tst_net.c", + "//third_party/ltp/lib/tst_netdevice.c", + "//third_party/ltp/lib/tst_parse_opts.c", + "//third_party/ltp/lib/tst_path_has_mnt_flags.c", + "//third_party/ltp/lib/tst_pid.c", + "//third_party/ltp/lib/tst_process_state.c", + "//third_party/ltp/lib/tst_res.c", + "//third_party/ltp/lib/tst_resource.c", + "//third_party/ltp/lib/tst_rtctime.c", + "//third_party/ltp/lib/tst_rtnetlink.c", + "//third_party/ltp/lib/tst_safe_file_at.c", + "//third_party/ltp/lib/tst_safe_io_uring.c", + "//third_party/ltp/lib/tst_safe_macros.c", + "//third_party/ltp/lib/tst_safe_sysv_ipc.c", + "//third_party/ltp/lib/tst_safe_timerfd.c", + "//third_party/ltp/lib/tst_sig.c", + "//third_party/ltp/lib/tst_sig_proc.c", + "//third_party/ltp/lib/tst_status.c", + "//third_party/ltp/lib/tst_supported_fs_types.c", + "//third_party/ltp/lib/tst_sys_conf.c", + "//third_party/ltp/lib/tst_taint.c", + "//third_party/ltp/lib/tst_test.c", + "//third_party/ltp/lib/tst_timer.c", + "//third_party/ltp/lib/tst_timer_test.c", + "//third_party/ltp/lib/tst_tmpdir.c", + "//third_party/ltp/lib/tst_uid.c", + "//third_party/ltp/lib/tst_virt.c", + "//third_party/ltp/lib/tst_wallclock.c", + ] +} + +action("generate_config") { + script = "generate_config.sh" + outputs = [ "${root_build_dir}/tests/ltp_testcases/output" ] + args = [ + rebase_path(ltp_source_dir, root_build_dir), + rebase_path("${root_build_dir}/../../${ltp_script_dir}"), + rebase_path("${root_build_dir}/tests/ltp_testcases"), + ] +} diff --git a/test/kernel_ltp/generate_config.sh b/test/kernel_ltp/generate_config.sh new file mode 100755 index 0000000000000000000000000000000000000000..e4b849077e9dc2a33b1ec0ab375540e3628d7533 --- /dev/null +++ b/test/kernel_ltp/generate_config.sh @@ -0,0 +1,72 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: generate_config.sh +# +# Description: generate config for linux test project +# +# Authors: Wu Fan +# +# History: August 4 2022 - generate config +# +################################################################################ + +IFS=$'\n' +input_file=$2/macrolists +change_file=$3/ltp/include/config.h + +function chang_config() +{ + while read line; do + if [[ $line == *"#"* ]]; then + continue + else + macro=$(echo $line | awk -F "'" '{print $2}') + flag=$(echo $line | awk -F "'" '{print $4}') + if [ "${flag}" == "true" ]; then + lines=$(sed -n "/${macro}/=" $change_file) + if [[ $lines > 0 ]]; then + sed -i "/${macro}/c\#define ${macro} 1" $change_file + else + echo "#define ${macro} 1" >> $change_file + fi + else + sed -i "/${macro}/c\/\* \#undef ${macro} \*\/" $change_file + fi + fi + done < $input_file + echo "typedef unsigned int __u32;" >> $change_file + echo "typedef signed int __s32;" >> $change_file +} + +if [ ! -e "$3/ltp" ]; then + cp -r $1/ $3 + cd $3/ltp + make autotools + ./configure --without-numa + add_notation=./include/tst_clone.h + sed -i "/^\#define clone/c\/\/ \#define clone(...) (use_the_ltp_clone_functions__do_not_use_clone)" $add_notation + chang_config + if [ ! -e "../include/lapi/syscalls.h" ]; then + mkdir -p ../include/lapi + cp ./include/config.h ../include/ + cp ./include/lapi/syscalls.h ../include/lapi/ + fi + cd - +fi + +echo $? diff --git a/test/kernel_ltp/kernel_interface_template.gni b/test/kernel_ltp/kernel_interface_template.gni new file mode 100644 index 0000000000000000000000000000000000000000..e7b8bd9be6f9b6b982b1ef3dc41e593efb50a8f5 --- /dev/null +++ b/test/kernel_ltp/kernel_interface_template.gni @@ -0,0 +1,32 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//build/ohos.gni") + +template("kernel_interface_bin") { + executable(target_name) { + forward_variables_from(invoker, "*") + cflags = [ "-w" ] + defines = [ "HAVE_ATOMIC_MEMORY_MODEL=1" ] + if (!defined(invoker.include_dirs)) { + include_dirs = [] + } + deps = [ "//kernel/linux/build/test/kernel_ltp:kernel_ltp_test" ] + include_dirs += [ + "${root_build_dir}/tests/ltp_testcases/include", + "${root_build_dir}/tests/ltp_testcases/include/lapi", + "${root_build_dir}/tests/ltp_testcases/ltp/include", + "${root_build_dir}/tests/ltp_testcases/ltp/include/old", + ] + output_extension = "run-test" + } +} diff --git a/test/kernel_ltp/macrolists b/test/kernel_ltp/macrolists new file mode 100644 index 0000000000000000000000000000000000000000..26c9a90aa2b376dc153251deaa8bae9d8d81c7fe --- /dev/null +++ b/test/kernel_ltp/macrolists @@ -0,0 +1,28 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +'HAVE_MALLINFO' 'false' +'HAVE_MALLOPT' 'false' +'HAVE_PREADV2' 'false' +'HAVE_PROFIL' 'false' +'HAVE_PWRITEV2' 'false' +'HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID_FSID___VAL' 'true' +'HAVE_RENAMEAT2' 'false' +'HAVE_STATX' 'false' +'HAVE_STRUCT_LOOP_CONFIG' 'true' +'HAVE_STRUCT_STATX' 'false' +'HAVE_STRUCT_STATX_TIMESTAMP' 'false' +'HAVE_STRUCT_TERMIO' 'false' +'HAVE_ASM_LDT_H' 'false' +'HAVE_PKEY_MPROTECT' 'false' +'_LINUX_KERNEL_H' 'true' +'HAVE_STRUCT_MMSGHDR ' 'true' diff --git a/test/kernel_ltp/syscalls/BUILD.gn b/test/kernel_ltp/syscalls/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..74c3d99c47add2b60ab0e2410376e7b979972190 --- /dev/null +++ b/test/kernel_ltp/syscalls/BUILD.gn @@ -0,0 +1,68 @@ +# # Copyright (C) 2022 Huawei Device Co., Ltd. +# # Licensed under the Apache License, Version 2.0 (the "License"); +# # you may not use this file except in compliance with the License. +# # You may obtain a copy of the License at +# # +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +group("HatsSyscallsTest") { + testonly = true + deps = [ + "abort:abort01", + "alarm:alarm02", + "alarm:alarm03", + "alarm:alarm05", + "alarm:alarm06", + "alarm:alarm07", + "capget:capget01", + "capget:capget02", + "capset:capset01", + "capset:capset02", + "capset:capset03", + "capset:capset04", + "clock_getres:clock_getres01", + "clock_gettime:clock_gettime01", + "clock_gettime:clock_gettime02", + "clock_gettime:clock_gettime03", + "clock_gettime:clock_gettime04", + "clock_gettime:leapsec01", + "clone3:clone301", + "clone3:clone302", + "dup:dup01", + "dup:dup02", + "dup:dup03", + "dup:dup04", + "dup:dup05", + "dup:dup06", + "dup:dup07", + "dup2:dup201", + "dup2:dup202", + "dup2:dup203", + "dup2:dup204", + "dup2:dup205", + "dup2:dup206", + "dup2:dup207", + "dup3:dup3_01", + "dup3:dup3_02", + "epoll_create1:epoll_create1_01", + "epoll_create1:epoll_create1_02", + "epoll_ctl:epoll_ctl01", + "epoll_ctl:epoll_ctl02", + "epoll_ctl:epoll_ctl03", + "epoll_ctl:epoll_ctl04", + "epoll_ctl:epoll_ctl05", + "epoll_wait:epoll_wait01", + "epoll_wait:epoll_wait02", + "epoll_wait:epoll_wait03", + "epoll_wait:epoll_wait04", + "exit:exit01", + "exit:exit02", + "exit_group:exit_group01", + ] +} diff --git a/test/kernel_ltp/syscalls/abort/BUILD.gn b/test/kernel_ltp/syscalls/abort/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..7496794aabcc60f49493765c81644c06949f631a --- /dev/null +++ b/test/kernel_ltp/syscalls/abort/BUILD.gn @@ -0,0 +1,20 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//kernel/linux/build/test/kernel_ltp/kernel_interface_template.gni") + +_output_dir = "${root_out_dir}/tests/ltp_testcases/SyscallsTest" + +kernel_interface_bin("abort01") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/abort/abort01.c" ] +} diff --git a/test/kernel_ltp/syscalls/alarm/BUILD.gn b/test/kernel_ltp/syscalls/alarm/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..597e3d97cbd9e87a15751fa885b3eb7a8afa632e --- /dev/null +++ b/test/kernel_ltp/syscalls/alarm/BUILD.gn @@ -0,0 +1,40 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//kernel/linux/build/test/kernel_ltp/kernel_interface_template.gni") + +_output_dir = "${root_out_dir}/tests/ltp_testcases/SyscallsTest" + +kernel_interface_bin("alarm02") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/alarm/alarm02.c" ] +} + +kernel_interface_bin("alarm03") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/alarm/alarm03.c" ] +} + +kernel_interface_bin("alarm05") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/alarm/alarm05.c" ] +} + +kernel_interface_bin("alarm06") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/alarm/alarm06.c" ] +} + +kernel_interface_bin("alarm07") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/alarm/alarm07.c" ] +} diff --git a/test/kernel_ltp/syscalls/capget/BUILD.gn b/test/kernel_ltp/syscalls/capget/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..936729fb5c0d5b1bc6fea167062859fbf2e1bb54 --- /dev/null +++ b/test/kernel_ltp/syscalls/capget/BUILD.gn @@ -0,0 +1,24 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//kernel/linux/build/test/kernel_ltp/kernel_interface_template.gni") + +_output_dir = "${root_out_dir}/tests/ltp_testcases/SyscallsTest" + +kernel_interface_bin("capget01") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/capget/capget01.c" ] +} +kernel_interface_bin("capget02") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/capget/capget02.c" ] +} diff --git a/test/kernel_ltp/syscalls/capset/BUILD.gn b/test/kernel_ltp/syscalls/capset/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8fdb1a9b8c31158426cbaf2bc2bbf99802aa28a4 --- /dev/null +++ b/test/kernel_ltp/syscalls/capset/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//kernel/linux/build/test/kernel_ltp/kernel_interface_template.gni") + +_output_dir = "${root_out_dir}/tests/ltp_testcases/SyscallsTest" + +kernel_interface_bin("capset01") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/capset/capset01.c" ] +} + +kernel_interface_bin("capset02") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/capset/capset02.c" ] +} + +kernel_interface_bin("capset03") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/capset/capset03.c" ] +} + +kernel_interface_bin("capset04") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/capset/capset04.c" ] +} diff --git a/test/kernel_ltp/syscalls/clock_getres/BUILD.gn b/test/kernel_ltp/syscalls/clock_getres/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..1638da61c9d30156b26cd29db0e4f045ae36701f --- /dev/null +++ b/test/kernel_ltp/syscalls/clock_getres/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//kernel/linux/build/test/kernel_ltp/kernel_interface_template.gni") + +_output_dir = "${root_out_dir}/tests/ltp_testcases/SyscallsTest" + +kernel_interface_bin("clock_getres01") { + output_dir = "${_output_dir}" + sources = [ + "//third_party/ltp/testcases/kernel/syscalls/clock_getres/clock_getres01.c", + ] +} diff --git a/test/kernel_ltp/syscalls/clock_gettime/BUILD.gn b/test/kernel_ltp/syscalls/clock_gettime/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..882b15d9e6a4c067297379c735693001007ae137 --- /dev/null +++ b/test/kernel_ltp/syscalls/clock_gettime/BUILD.gn @@ -0,0 +1,60 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//kernel/linux/build/test/kernel_ltp/kernel_interface_template.gni") + +_output_dir = "${root_out_dir}/tests/ltp_testcases/SyscallsTest" + +kernel_interface_bin("clock_gettime01") { + output_dir = "${_output_dir}" + sources = [ + "//third_party/ltp/libs/libltpvdso/parse_vdso.c", + "//third_party/ltp/libs/libltpvdso/vdso_helpers.c", + "//third_party/ltp/testcases/kernel/syscalls/clock_gettime/clock_gettime01.c", + ] +} + +kernel_interface_bin("clock_gettime02") { + output_dir = "${_output_dir}" + sources = [ + "//third_party/ltp/libs/libltpvdso/parse_vdso.c", + "//third_party/ltp/libs/libltpvdso/vdso_helpers.c", + "//third_party/ltp/testcases/kernel/syscalls/clock_gettime/clock_gettime02.c", + ] +} + +kernel_interface_bin("clock_gettime03") { + output_dir = "${_output_dir}" + sources = [ + "//third_party/ltp/libs/libltpvdso/parse_vdso.c", + "//third_party/ltp/libs/libltpvdso/vdso_helpers.c", + "//third_party/ltp/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c", + ] +} + +kernel_interface_bin("clock_gettime04") { + output_dir = "${_output_dir}" + sources = [ + "//third_party/ltp/libs/libltpvdso/parse_vdso.c", + "//third_party/ltp/libs/libltpvdso/vdso_helpers.c", + "//third_party/ltp/testcases/kernel/syscalls/clock_gettime/clock_gettime04.c", + ] +} + +kernel_interface_bin("leapsec01") { + output_dir = "${_output_dir}" + sources = [ + "//third_party/ltp/libs/libltpvdso/parse_vdso.c", + "//third_party/ltp/libs/libltpvdso/vdso_helpers.c", + "//third_party/ltp/testcases/kernel/syscalls/clock_gettime/leapsec01.c", + ] +} diff --git a/test/kernel_ltp/syscalls/clone3/BUILD.gn b/test/kernel_ltp/syscalls/clone3/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..af0c6e7d933d9786189ebfbb24a858a7a3945809 --- /dev/null +++ b/test/kernel_ltp/syscalls/clone3/BUILD.gn @@ -0,0 +1,25 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//kernel/linux/build/test/kernel_ltp/kernel_interface_template.gni") + +_output_dir = "${root_out_dir}/tests/ltp_testcases/SyscallsTest" + +kernel_interface_bin("clone301") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/clone3/clone301.c" ] +} + +kernel_interface_bin("clone302") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/clone3/clone302.c" ] +} diff --git a/test/kernel_ltp/syscalls/dup/BUILD.gn b/test/kernel_ltp/syscalls/dup/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..63fb83de234d3ebf60b28f59ab275aac1ccf612f --- /dev/null +++ b/test/kernel_ltp/syscalls/dup/BUILD.gn @@ -0,0 +1,50 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//kernel/linux/build/test/kernel_ltp/kernel_interface_template.gni") + +_output_dir = "${root_out_dir}/tests/ltp_testcases/SyscallsTest" + +kernel_interface_bin("dup01") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/dup/dup01.c" ] +} + +kernel_interface_bin("dup02") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/dup/dup02.c" ] +} + +kernel_interface_bin("dup03") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/dup/dup03.c" ] +} + +kernel_interface_bin("dup04") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/dup/dup04.c" ] +} + +kernel_interface_bin("dup05") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/dup/dup05.c" ] +} + +kernel_interface_bin("dup06") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/dup/dup06.c" ] +} + +kernel_interface_bin("dup07") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/dup/dup07.c" ] +} diff --git a/test/kernel_ltp/syscalls/dup2/BUILD.gn b/test/kernel_ltp/syscalls/dup2/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..485373f200ca40966c4111b8254a72de4d799fe1 --- /dev/null +++ b/test/kernel_ltp/syscalls/dup2/BUILD.gn @@ -0,0 +1,50 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//kernel/linux/build/test/kernel_ltp/kernel_interface_template.gni") + +_output_dir = "${root_out_dir}/tests/ltp_testcases/SyscallsTest" + +kernel_interface_bin("dup201") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/dup2/dup201.c" ] +} + +kernel_interface_bin("dup202") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/dup2/dup202.c" ] +} + +kernel_interface_bin("dup203") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/dup2/dup203.c" ] +} + +kernel_interface_bin("dup204") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/dup2/dup204.c" ] +} + +kernel_interface_bin("dup205") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/dup2/dup205.c" ] +} + +kernel_interface_bin("dup206") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/dup2/dup206.c" ] +} + +kernel_interface_bin("dup207") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/dup2/dup207.c" ] +} diff --git a/test/kernel_ltp/syscalls/dup3/BUILD.gn b/test/kernel_ltp/syscalls/dup3/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..526c7bb446c32f745bcfe6960839ff55fcb4c076 --- /dev/null +++ b/test/kernel_ltp/syscalls/dup3/BUILD.gn @@ -0,0 +1,25 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//kernel/linux/build/test/kernel_ltp/kernel_interface_template.gni") + +_output_dir = "${root_out_dir}/tests/ltp_testcases/SyscallsTest" + +kernel_interface_bin("dup3_01") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/dup3/dup3_01.c" ] +} + +kernel_interface_bin("dup3_02") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/dup3/dup3_02.c" ] +} diff --git a/test/kernel_ltp/syscalls/epoll_create1/BUILD.gn b/test/kernel_ltp/syscalls/epoll_create1/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..d07a3537f88dff7d324df74689e76b95962cc628 --- /dev/null +++ b/test/kernel_ltp/syscalls/epoll_create1/BUILD.gn @@ -0,0 +1,25 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//kernel/linux/build/test/kernel_ltp/kernel_interface_template.gni") + +_output_dir = "${root_out_dir}/tests/ltp_testcases/SyscallsTest" + +kernel_interface_bin("epoll_create1_01") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/epoll_create1/epoll_create1_01.c" ] +} + +kernel_interface_bin("epoll_create1_02") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/epoll_create1/epoll_create1_02.c" ] +} diff --git a/test/kernel_ltp/syscalls/epoll_ctl/BUILD.gn b/test/kernel_ltp/syscalls/epoll_ctl/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..cf5b7184f4ec15bf1999eee60250439e5344c390 --- /dev/null +++ b/test/kernel_ltp/syscalls/epoll_ctl/BUILD.gn @@ -0,0 +1,45 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//kernel/linux/build/test/kernel_ltp/kernel_interface_template.gni") + +_output_dir = "${root_out_dir}/tests/ltp_testcases/SyscallsTest" + +kernel_interface_bin("epoll_ctl01") { + output_dir = "${_output_dir}" + sources = + [ "//third_party/ltp/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c" ] +} + +kernel_interface_bin("epoll_ctl02") { + output_dir = "${_output_dir}" + sources = + [ "//third_party/ltp/testcases/kernel/syscalls/epoll_ctl/epoll_ctl02.c" ] +} + +kernel_interface_bin("epoll_ctl03") { + output_dir = "${_output_dir}" + sources = + [ "//third_party/ltp/testcases/kernel/syscalls/epoll_ctl/epoll_ctl03.c" ] +} + +kernel_interface_bin("epoll_ctl04") { + output_dir = "${_output_dir}" + sources = + [ "//third_party/ltp/testcases/kernel/syscalls/epoll_ctl/epoll_ctl04.c" ] +} + +kernel_interface_bin("epoll_ctl05") { + output_dir = "${_output_dir}" + sources = + [ "//third_party/ltp/testcases/kernel/syscalls/epoll_ctl/epoll_ctl05.c" ] +} diff --git a/test/kernel_ltp/syscalls/epoll_wait/BUILD.gn b/test/kernel_ltp/syscalls/epoll_wait/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..0456502ed916c7bf35df7dfb7375491489a4050c --- /dev/null +++ b/test/kernel_ltp/syscalls/epoll_wait/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//kernel/linux/build/test/kernel_ltp/kernel_interface_template.gni") + +_output_dir = "${root_out_dir}/tests/ltp_testcases/SyscallsTest" + +kernel_interface_bin("epoll_wait01") { + output_dir = "${_output_dir}" + sources = [ + "//third_party/ltp/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c", + ] +} + +kernel_interface_bin("epoll_wait02") { + output_dir = "${_output_dir}" + sources = [ + "//third_party/ltp/testcases/kernel/syscalls/epoll_wait/epoll_wait02.c", + ] +} + +kernel_interface_bin("epoll_wait03") { + output_dir = "${_output_dir}" + sources = [ + "//third_party/ltp/testcases/kernel/syscalls/epoll_wait/epoll_wait03.c", + ] +} + +kernel_interface_bin("epoll_wait04") { + output_dir = "${_output_dir}" + sources = [ + "//third_party/ltp/testcases/kernel/syscalls/epoll_wait/epoll_wait04.c", + ] +} diff --git a/test/kernel_ltp/syscalls/exit/BUILD.gn b/test/kernel_ltp/syscalls/exit/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..2c590d75cb0486986d9502f37816e5929bdf2bda --- /dev/null +++ b/test/kernel_ltp/syscalls/exit/BUILD.gn @@ -0,0 +1,25 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//kernel/linux/build/test/kernel_ltp/kernel_interface_template.gni") + +_output_dir = "${root_out_dir}/tests/ltp_testcases/SyscallsTest" + +kernel_interface_bin("exit01") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/exit/exit01.c" ] +} + +kernel_interface_bin("exit02") { + output_dir = "${_output_dir}" + sources = [ "//third_party/ltp/testcases/kernel/syscalls/exit/exit02.c" ] +} diff --git a/test/kernel_ltp/syscalls/exit_group/BUILD.gn b/test/kernel_ltp/syscalls/exit_group/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..1c38707cfec9dc63251e250650c2381f92f51093 --- /dev/null +++ b/test/kernel_ltp/syscalls/exit_group/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//kernel/linux/build/test/kernel_ltp/kernel_interface_template.gni") + +_output_dir = "${root_out_dir}/tests/ltp_testcases/SyscallsTest" + +kernel_interface_bin("exit_group01") { + output_dir = "${_output_dir}" + sources = [ + "//third_party/ltp/testcases/kernel/syscalls/exit_group/exit_group01.c", + ] +} diff --git a/test/moduletest/runtest/bin/mem_debug_t/testcases/bin/mem_debug10.sh b/test/moduletest/runtest/bin/mem_debug_t/testcases/bin/mem_debug10.sh index 38c2f0399e9b55c9296d8e407921d8e57aedb086..9b7524c34e714e6732f0518f8633bd2986843127 100644 --- a/test/moduletest/runtest/bin/mem_debug_t/testcases/bin/mem_debug10.sh +++ b/test/moduletest/runtest/bin/mem_debug_t/testcases/bin/mem_debug10.sh @@ -39,7 +39,7 @@ do_setup() do_test() { - set_check_lmkd_oom_score_adj -1001 1 0 + set_check_lmkd_oom_score_adj -1001 1 $lmkd_oom_score_adj_def set_check_lmkd_oom_score_adj -1000 0 -1000 set_check_lmkd_oom_score_adj 1 0 1 set_check_lmkd_oom_score_adj 1000 0 1000 diff --git a/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg04.sh b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg04.sh index 0f77902023f8b7201bf665f0ccb08b87701e07f0..06de2a25dda8f54d5ffdea8cf018b9701a7c0a30 100644 --- a/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg04.sh +++ b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg04.sh @@ -29,41 +29,23 @@ source tst_oh.sh do_setup() { - cpu_value=$(cat /sys/kernel/debug/tracing/events/rtg/find_rtg_cpu/enable) - - aa start -b ohos.samples.ecg -a ohos.samples.ecg.MainAbility - sleep 1 - PID=$(ps -ef | grep ohos.samples.ecg | grep -v grep | awk '{print $2}') - echo 1 > /sys/kernel/debug/tracing/events/rtg/find_rtg_cpu/enable } do_test() { - local res=0 - local sched_group_id=/proc/$PID/sched_group_id - - tst_res TINFO "Start sched RTG trace catching test ..." - bytrace -t 10 -b 32000 --overwrite sched ace app disk ohos graphic sync workq ability > rtgtrace.ftrace & - tst_res TINFO "Checking sched RTG trace ..." - sleep 3 - for i in $(seq 1 50);do - echo 0 > $sched_group_id - echo 2 > $sched_group_id - done - sleep 50 - cat rtgtrace.ftrace | grep "find_rtg_cpu" + ls /sys/kernel/debug/tracing/events/rtg/ | grep find_rtg_cpu && + ls /sys/kernel/debug/tracing/events/rtg/ | grep sched_rtg_task_each && + ls /sys/kernel/debug/tracing/events/rtg/ | grep sched_rtg_valid_normalized_util if [ $? -eq 0 ]; then - tst_res TPASS "trace info found." - rm -rf rtgtrace.ftrace + tst_res TPASS "trace nodes are existed" else - tst_res TFAIL "trace info no found!" + tst_res TFAIL "trace nodes are not existed" fi } do_clean() { - echo $cpu_value > /sys/kernel/debug/tracing/events/rtg/find_rtg_cpu/enable - aa force-stop ohos.samples.ecg + } do_setup