1# Copyright (c) 2023 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 14import("../../../test_template.gni") 15 16rpath_configs = [ 17 "absolute", 18 "origin", 19] 20 21group("rpath_ns_test") { 22 testonly = true 23 deps = [ 24 ":lib_primary_multiple", 25 ":lib_support_001", 26 ":lib_support_002", 27 ":rpath_test", 28 ] 29 foreach(rp, rpath_configs) { 30 deps += [ ":lib_primary_${rp}" ] 31 } 32} 33 34ohos_executable("rpath_test") { 35 subsystem_name = "musl" 36 part_name = "libc-test" 37 sources = [ "rpath_test.c" ] 38 include_dirs = [ 39 "../common", 40 "//third_party/musl/porting/linux/user/include", 41 "//third_party/musl/libc-test/src/common", 42 ] 43 ldflags = [ "-Wl,-rpath=/data/tests/libc-test/src/rpath_lib" ] 44 configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] 45} 46 47foreach(rp, rpath_configs) { 48 ohos_shared_library("lib_primary_${rp}") { 49 sources = [ "lib_primary.c" ] 50 output_name = "libprimary_${rp}" 51 output_extension = "so" 52 deps = [ ":lib_support_001" ] 53 if (rp == "absolute") { 54 ldflags = 55 [ "-Wl,-rpath=/data/tests/libc-test/src/rpath_lib/rpath_support_A" ] 56 } else if (rp == "origin") { 57 ldflags = [ "-Wl,-rpath=\$ORIGIN/rpath_support_B/../rpath_support_A" ] 58 } 59 subsystem_name = "musl" 60 part_name = "libc-test-lib" 61 } 62} 63 64ohos_shared_library("lib_primary_multiple") { 65 sources = [ "lib_primary_multiple.c" ] 66 output_name = "libprimary_multiple" 67 output_extension = "so" 68 deps = [ 69 ":lib_support_001", 70 ":lib_support_002", 71 ] 72 ldflags = [ "-Wl,-rpath=/data/tests/libc-test/src/rpath_lib/rpath_support_A:\$ORIGIN/../rpath_support_C" ] 73 subsystem_name = "musl" 74 part_name = "libc-test-lib" 75} 76 77ohos_shared_library("lib_support_001") { 78 sources = [ "lib_support_001.c" ] 79 output_name = "libsupport_001" 80 output_extension = "so" 81 subsystem_name = "musl" 82 part_name = "libc-test-lib" 83} 84 85ohos_shared_library("lib_support_002") { 86 sources = [ "lib_support_002.c" ] 87 output_name = "libsupport_002" 88 output_extension = "so" 89 subsystem_name = "musl" 90 part_name = "libc-test-lib" 91} 92