2 * SPDX-License-Identifier: LGPL-2.1-only
4 * Copyright (C) 2021 Michael Jeanson <mjeanson@efficios.com>
14 #define LTTNG_UST_LIB_ABI0_SO_NAME "libfakeust0.so"
15 #define LTTNG_UST_LIB_ABI1_SO_NAME "liblttng-ust.so.1"
18 int dlopen_ust(const char *lib_soname
)
20 int ret
= EXIT_SUCCESS
;
23 handle
= dlopen(lib_soname
, RTLD_NOW
| RTLD_GLOBAL
);
25 printf("Error: dlopen of liblttng-ust shared library (%s).\n", lib_soname
);
28 printf("Success: dlopen of liblttng-ust shared library (%s).\n", lib_soname
);
37 return dlopen_ust(LTTNG_UST_LIB_ABI0_SO_NAME
);
43 return dlopen_ust(LTTNG_UST_LIB_ABI1_SO_NAME
);
47 int dlopen_abi0_abi1(void)
49 int ret
= EXIT_SUCCESS
;
51 ret
= dlopen_ust(LTTNG_UST_LIB_ABI0_SO_NAME
);
52 if (ret
!= EXIT_SUCCESS
)
55 ret
= dlopen_ust(LTTNG_UST_LIB_ABI1_SO_NAME
);
61 int dlopen_abi1_abi0(void)
63 int ret
= EXIT_SUCCESS
;
65 ret
= dlopen_ust(LTTNG_UST_LIB_ABI1_SO_NAME
);
66 if (ret
!= EXIT_SUCCESS
)
69 ret
= dlopen_ust(LTTNG_UST_LIB_ABI0_SO_NAME
);
75 int dlopen_abi1_abi1(void)
77 int ret
= EXIT_SUCCESS
;
79 ret
= dlopen_ust(LTTNG_UST_LIB_ABI1_SO_NAME
);
80 if (ret
!= EXIT_SUCCESS
)
83 ret
= dlopen_ust(LTTNG_UST_LIB_ABI1_SO_NAME
);
89 void usage(char **argv
)
91 printf("Usage: %s <test_type>\n", argv
[0]);
92 printf(" test_type: abi0, abi1, abi0_abi1, abi1_abi0, abi1_abi1\n");
95 int main(int argc
, char **argv
)
97 int ret
= EXIT_SUCCESS
;
98 const char *test_type
;
107 printf("This application is NOT linked on liblttng-ust.\n");
109 if (strcmp(test_type
, "abi0") == 0)
111 else if (strcmp(test_type
, "abi1") == 0)
113 else if (strcmp(test_type
, "abi0_abi1") == 0)
114 ret
= dlopen_abi0_abi1();
115 else if (strcmp(test_type
, "abi1_abi0") == 0)
116 ret
= dlopen_abi1_abi0();
117 else if (strcmp(test_type
, "abi1_abi1") == 0)
118 ret
= dlopen_abi1_abi1();