1 /*
2 * Copyright (c) 2022 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 "dso_easy_symver.h"
17 #include "dso_hard_symver.h"
18 #include "dso_no_symver.h"
19 #include "dso_symver.h"
20
21 /**
22 * @tc.name : dynlink_0100
23 * @tc.desc : invoke a symbol without versions directly
24 * @tc.level : Level 0
25 */
dynlink_0100(void)26 void dynlink_0100(void)
27 {
28 symver_log("start");
29
30 const char *result = dso_no_symver();
31 symver_streq(result, dso_no_symver_symbol);
32
33 symver_log("end");
34 }
35
36 /**
37 * @tc.name : dynlink_0200
38 * @tc.desc : invoke a symbol with versions directly
39 * @tc.level : Level 1
40 */
dynlink_0200(void)41 void dynlink_0200(void)
42 {
43 symver_log("start");
44
45 const char *result = dso_easy_symver();
46 symver_streq(result, dso_easy_symver_symbol_stable);
47
48 symver_log("end");
49 }
50
51 /**
52 * @tc.name : dynlink_0300
53 * @tc.desc : invoke a symbol with versions directly
54 * @tc.level : Level 1
55 */
dynlink_0300(void)56 void dynlink_0300(void)
57 {
58 symver_log("start");
59
60 const char *result = dso_hard_symver_ld();
61 symver_streq(result, dso_hard_symver_ld_symbol_stable);
62
63 symver_log("end");
64 }
65
main(int argc,char * argv[])66 int main(int argc, char *argv[])
67 {
68 symver_log("start");
69
70 dynlink_0100();
71 dynlink_0200();
72 dynlink_0300();
73
74 symver_log("t_status = %d", t_status);
75 symver_log("end");
76
77 return t_status;
78 }
79