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"
22 static struct lib_desc lib_desc
[] = {
24 .soname
= LTTNG_UST_LIB_ABI0_SO_NAME
,
27 .soname
= LTTNG_UST_LIB_ABI1_SO_NAME
,
30 .soname
= LTTNG_UST_LIB_ABI1_SO_NAME
,
35 int dlopen_ust(struct lib_desc
*desc
)
37 int ret
= EXIT_SUCCESS
;
39 desc
->handle
= dlopen(desc
->soname
, RTLD_NOW
| RTLD_GLOBAL
);
41 printf("Error: dlopen of liblttng-ust shared library (%s).\n", desc
->soname
);
44 printf("Success: dlopen of liblttng-ust shared library (%s).\n", desc
->soname
);
53 return dlopen_ust(&lib_desc
[0]);
59 return dlopen_ust(&lib_desc
[1]);
63 int dlopen_abi0_abi1(void)
65 int ret
= EXIT_SUCCESS
;
67 ret
= dlopen_ust(&lib_desc
[0]);
68 if (ret
!= EXIT_SUCCESS
)
71 ret
= dlopen_ust(&lib_desc
[1]);
77 int dlopen_abi1_abi0(void)
79 int ret
= EXIT_SUCCESS
;
81 ret
= dlopen_ust(&lib_desc
[1]);
82 if (ret
!= EXIT_SUCCESS
)
85 ret
= dlopen_ust(&lib_desc
[0]);
91 int dlopen_abi1_abi1(void)
93 int ret
= EXIT_SUCCESS
;
95 ret
= dlopen_ust(&lib_desc
[1]);
96 if (ret
!= EXIT_SUCCESS
)
99 ret
= dlopen_ust(&lib_desc
[2]);
105 void usage(char **argv
)
107 printf("Usage: %s <test_type>\n", argv
[0]);
108 printf(" test_type: abi0, abi1, abi0_abi1, abi1_abi0, abi1_abi1\n");
111 int main(int argc
, char **argv
)
113 int ret
= EXIT_SUCCESS
;
114 const char *test_type
;
123 printf("This application is NOT linked on liblttng-ust.\n");
125 if (strcmp(test_type
, "abi0") == 0)
127 else if (strcmp(test_type
, "abi1") == 0)
129 else if (strcmp(test_type
, "abi0_abi1") == 0)
130 ret
= dlopen_abi0_abi1();
131 else if (strcmp(test_type
, "abi1_abi0") == 0)
132 ret
= dlopen_abi1_abi0();
133 else if (strcmp(test_type
, "abi1_abi1") == 0)
134 ret
= dlopen_abi1_abi1();