1# Copyright (C) 2021 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. 13import("posix_interface_config.gni") 14 15template("posix_interface_bin") { 16 _output_dir = "${target_out_dir}" 17 _output_extension = "run-test" 18 executable("module_${target_name}") { 19 forward_variables_from(invoker, [ "sources" ]) 20 cflags = [ "-D_POSIX_C_SOURCE=200809L" ] 21 include_dirs = 22 [ "//third_party/ltp/testcases/open_posix_testsuite/include" ] 23 output_extension = "${_output_extension}" 24 output_dir = "${_output_dir}" 25 } 26 27 _output_filename = "module_${target_name}.${_output_extension}" 28 _output_file = "${_output_dir}/${_output_filename}" 29 _archive_filename = "$target_name.${_output_extension}" 30 _archive_file = "${posix_interface_output_dir}/${_archive_filename}" 31 _suite_out_dir = "${xts_out_dir}" 32 _project_type = "app" 33 _arguments = [ 34 "build_module_with_testbundle", 35 "--build_gen_dir", 36 rebase_path("$root_gen_dir"), 37 "--build_target_name", 38 target_name, 39 "--buildgen_testfile", 40 rebase_path(_output_file), 41 "--project_path", 42 rebase_path("."), 43 "--test_xml", 44 rebase_path(TESTCONFIG_FILENAME), 45 "--project_type", 46 _project_type, 47 "--suite_out_dir", 48 rebase_path("${_suite_out_dir}"), 49 "--archive_testfile", 50 rebase_path("${_archive_file}"), 51 ] 52 53 _deps = [ ":module_${target_name}" ] 54 55 action(target_name) { 56 deps = _deps 57 script = rebase_path("//test/xts/tools/build/suite.py") 58 args = _arguments 59 outputs = [ _archive_file ] 60 } 61} 62 63template("posix_interface_json") { 64 _output_dir = "${target_out_dir}" 65 _output_file = "${_output_dir}/${target_name}.json" 66 copy("json_${target_name}") { 67 sources = invoker.sources 68 outputs = [ "${_output_file}" ] 69 } 70 71 _archive_file = "${posix_interfacejson_output_dir}/${posix_interface_module}" 72 _suite_out_dir = "${xts_out_dir}" 73 _project_type = "operate_json" 74 _arguments = [ 75 "build_module_with_testbundle", 76 "--build_gen_dir", 77 rebase_path("$root_gen_dir"), 78 "--build_target_name", 79 target_name, 80 "--buildgen_testfile", 81 rebase_path("${_output_file}"), 82 "--project_path", 83 rebase_path("."), 84 "--test_xml", 85 rebase_path(TESTCONFIG_FILENAME), 86 "--project_type", 87 _project_type, 88 "--suite_out_dir", 89 rebase_path("${_suite_out_dir}"), 90 "--archive_testfile", 91 rebase_path("${_archive_file}"), 92 ] 93 _deps = invoker.deps + [ ":json_${target_name}" ] 94 action(target_name) { 95 deps = _deps 96 script = rebase_path("//test/xts/tools/build/suite.py") 97 args = _arguments 98 outputs = [ _archive_file ] 99 } 100} 101