1 /**
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <dlfcn.h>
17 #include <dlfcn_ext.h>
18 #include <errno.h>
19 #include <stdio.h>
20 #include <string.h>
21
22 #include "functionalext.h"
23 #include "dlns_test.h"
24
25 /**
26 * @tc.name : dlopen_ext_0100
27 * @tc.desc : extinfo flag is 0, call dlopen_ext, return handle is not NULL.
28 * @tc.level : Level 0
29 */
dlopen_0100(void)30 void dlopen_0100(void)
31 {
32 dl_extinfo extinfo = {
33 .flag = 0,
34 .relro_fd = -1,
35 };
36
37 Dl_namespace dlns;
38 dlns_init(&dlns, "dlns_create_0100");
39
40 void *handle = dlopen_ns_ext(&dlns, dllNamePath, RTLD_LAZY, &extinfo);
41 EXPECT_PTRNE(__FUNCTION__, handle, NULL);
42 if(handle){
43 dlclose(handle);
44 };
45 }
46
main()47 int main(){
48 dlopen_0100();
49 return t_status;
50 }