1f6603c60Sopenharmony_ci# Copyright (C) 2021 Huawei Device Co., Ltd.
2f6603c60Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3f6603c60Sopenharmony_ci# you may not use this file except in compliance with the License.
4f6603c60Sopenharmony_ci# You may obtain a copy of the License at
5f6603c60Sopenharmony_ci#
6f6603c60Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7f6603c60Sopenharmony_ci#
8f6603c60Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9f6603c60Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10f6603c60Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11f6603c60Sopenharmony_ci# See the License for the specific language governing permissions and
12f6603c60Sopenharmony_ci# limitations under the License.
13f6603c60Sopenharmony_ciimport("//build/ohos_var.gni")
14f6603c60Sopenharmony_ciimport("//test/xts/tools/build/suite.gni")
15f6603c60Sopenharmony_ci
16f6603c60Sopenharmony_cigroup("toolchain") {
17f6603c60Sopenharmony_ci  testonly = true
18f6603c60Sopenharmony_ci  deps = [ "//third_party/musl:libctest" ]
19f6603c60Sopenharmony_ci  if (is_standard_system) {
20f6603c60Sopenharmony_ci    deps += [ ":tar_dllib" ]
21f6603c60Sopenharmony_ci  }
22f6603c60Sopenharmony_ci}
23f6603c60Sopenharmony_ci
24f6603c60Sopenharmony_ciaction("tar_testcases") {
25f6603c60Sopenharmony_ci  testonly = true
26f6603c60Sopenharmony_ci  deps = [
27f6603c60Sopenharmony_ci    "libc-test:ActsToolChainTest",
28f6603c60Sopenharmony_ci    "//third_party/musl:libctest",
29f6603c60Sopenharmony_ci  ]
30f6603c60Sopenharmony_ci  project_dir = rebase_path(".")
31f6603c60Sopenharmony_ci  print("project_dir-58:", project_dir)
32f6603c60Sopenharmony_ci  project_dird = rebase_path("tar_files.py", ".", root_out_dir)
33f6603c60Sopenharmony_ci  print("project_dird-60:", project_dird)
34f6603c60Sopenharmony_ci
35f6603c60Sopenharmony_ci  project_dirf = project_dir + "/" + project_dird
36f6603c60Sopenharmony_ci  print("project_dirf-64:", project_dirf)
37f6603c60Sopenharmony_ci
38f6603c60Sopenharmony_ci  test_path = string_replace(project_dirf, "/tar_files.py", "")
39f6603c60Sopenharmony_ci  script = rebase_path(
40f6603c60Sopenharmony_ci          "//test/xts/acts/commonlibrary/toolchain/libc-test/tar_files.py")
41f6603c60Sopenharmony_ci
42f6603c60Sopenharmony_ci  _outputs = [ "$target_out_dir/libc-test.tar" ]
43f6603c60Sopenharmony_ci  outputs = _outputs
44f6603c60Sopenharmony_ci
45f6603c60Sopenharmony_ci  input_path = rebase_path("$test_path/musl/libc-test")
46f6603c60Sopenharmony_ci  output_path =
47f6603c60Sopenharmony_ci      rebase_path("$test_path/suites/acts/acts/testcases/libc-test.tar")
48f6603c60Sopenharmony_ci
49f6603c60Sopenharmony_ci  print("root_build_dir-49", root_build_dir)
50f6603c60Sopenharmony_ci  args = [
51f6603c60Sopenharmony_ci    "--input_path",
52f6603c60Sopenharmony_ci    input_path,
53f6603c60Sopenharmony_ci    "--output_path",
54f6603c60Sopenharmony_ci    output_path,
55f6603c60Sopenharmony_ci    "--temp_path",
56f6603c60Sopenharmony_ci    "./libc-test",
57f6603c60Sopenharmony_ci  ]
58f6603c60Sopenharmony_ci}
59f6603c60Sopenharmony_ci
60f6603c60Sopenharmony_ciaction("tar_dllib") {
61f6603c60Sopenharmony_ci  testonly = true
62f6603c60Sopenharmony_ci  deps = [ ":tar_testcases" ]
63f6603c60Sopenharmony_ci  project_dir = rebase_path(".")
64f6603c60Sopenharmony_ci  print("project_dir-58:", project_dir)
65f6603c60Sopenharmony_ci  project_dird = rebase_path("tar_files.py", ".", root_out_dir)
66f6603c60Sopenharmony_ci  print("project_dird-60:", project_dird)
67f6603c60Sopenharmony_ci
68f6603c60Sopenharmony_ci  project_dirf = project_dir + "/" + project_dird
69f6603c60Sopenharmony_ci  print("project_dirf-64:", project_dirf)
70f6603c60Sopenharmony_ci
71f6603c60Sopenharmony_ci  dllib_path = string_replace(project_dirf, "/tar_files.py", "")
72f6603c60Sopenharmony_ci  script = rebase_path(
73f6603c60Sopenharmony_ci          "//test/xts/acts/commonlibrary/toolchain/libc-test/tar_files.py")
74f6603c60Sopenharmony_ci
75f6603c60Sopenharmony_ci  if (target_cpu == "arm") {
76f6603c60Sopenharmony_ci    _outputs = [ "$target_out_dir/libc-test-lib.tar" ]
77f6603c60Sopenharmony_ci    outputs = _outputs
78f6603c60Sopenharmony_ci
79f6603c60Sopenharmony_ci    input_path = rebase_path("$dllib_path/musl/libc-test-lib")
80f6603c60Sopenharmony_ci    output_path =
81f6603c60Sopenharmony_ci        rebase_path("$dllib_path/suites/acts/acts/testcases/libc-test-lib.tar")
82f6603c60Sopenharmony_ci
83f6603c60Sopenharmony_ci    print("root_build_dir-49", root_build_dir)
84f6603c60Sopenharmony_ci    args = [
85f6603c60Sopenharmony_ci      "--input_path",
86f6603c60Sopenharmony_ci      input_path,
87f6603c60Sopenharmony_ci      "--output_path",
88f6603c60Sopenharmony_ci      output_path,
89f6603c60Sopenharmony_ci      "--temp_path",
90f6603c60Sopenharmony_ci      "./libc-test-lib",
91f6603c60Sopenharmony_ci    ]
92f6603c60Sopenharmony_ci  } else if (target_cpu == "arm64") {
93f6603c60Sopenharmony_ci    _outputs = [ "$target_out_dir/libc-test-lib.tar" ]
94f6603c60Sopenharmony_ci    outputs = _outputs
95f6603c60Sopenharmony_ci
96f6603c60Sopenharmony_ci    input_path = rebase_path("$dllib_path/musl/libc-test-lib")
97f6603c60Sopenharmony_ci    output_path =
98f6603c60Sopenharmony_ci        rebase_path("$dllib_path/suites/acts/acts/testcases/libc-test-lib.tar")
99f6603c60Sopenharmony_ci    print("root_build_dir-49", root_build_dir)
100f6603c60Sopenharmony_ci    args = [
101f6603c60Sopenharmony_ci      "--input_path",
102f6603c60Sopenharmony_ci      input_path,
103f6603c60Sopenharmony_ci      "--output_path",
104f6603c60Sopenharmony_ci      output_path,
105f6603c60Sopenharmony_ci      "--temp_path",
106f6603c60Sopenharmony_ci      "./libc-test-lib",
107f6603c60Sopenharmony_ci    ]
108f6603c60Sopenharmony_ci  } else {
109f6603c60Sopenharmony_ci    _outputs = [ "" ]
110f6603c60Sopenharmony_ci    outputs = _outputs
111f6603c60Sopenharmony_ci
112f6603c60Sopenharmony_ci    input_path = rebase_path("")
113f6603c60Sopenharmony_ci    output_path = rebase_path("")
114f6603c60Sopenharmony_ci    print("root_build_dir-49", root_build_dir)
115f6603c60Sopenharmony_ci    args = [
116f6603c60Sopenharmony_ci      "--input_path",
117f6603c60Sopenharmony_ci      input_path,
118f6603c60Sopenharmony_ci      "--output_path",
119f6603c60Sopenharmony_ci      output_path,
120f6603c60Sopenharmony_ci      "--temp_path",
121f6603c60Sopenharmony_ci      "./libc-test-lib",
122f6603c60Sopenharmony_ci    ]
123f6603c60Sopenharmony_ci  }
124f6603c60Sopenharmony_ci}
125