X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=tests%2Fregression%2Fabi0-conflict%2Fapp_noust_dlopen.c;h=e0519c81d6bcda96e5aa2f94b310af2cdc1c793a;hb=dbbb73968ec9af48c2b0b9ea65a4b03843109f7d;hp=9a52bc79da8429d0aeb5e1c4d89670278b32f001;hpb=c117e9884c3acc65408d8f65b2cd86a8511df1cc;p=lttng-ust.git diff --git a/tests/regression/abi0-conflict/app_noust_dlopen.c b/tests/regression/abi0-conflict/app_noust_dlopen.c index 9a52bc79..e0519c81 100644 --- a/tests/regression/abi0-conflict/app_noust_dlopen.c +++ b/tests/regression/abi0-conflict/app_noust_dlopen.c @@ -14,18 +14,34 @@ #define LTTNG_UST_LIB_ABI0_SO_NAME "libfakeust0.so" #define LTTNG_UST_LIB_ABI1_SO_NAME "liblttng-ust.so.1" +struct lib_desc { + const char *soname; + void *handle; +}; + +static struct lib_desc lib_desc[] = { + [0] = { + .soname = LTTNG_UST_LIB_ABI0_SO_NAME, + }, + [1] = { + .soname = LTTNG_UST_LIB_ABI1_SO_NAME, + }, + [2] = { + .soname = LTTNG_UST_LIB_ABI1_SO_NAME, + }, +}; + static -int dlopen_ust(const char *lib_soname) +int dlopen_ust(struct lib_desc *desc) { int ret = EXIT_SUCCESS; - void *handle; - handle = dlopen(lib_soname, RTLD_NOW | RTLD_GLOBAL); - if (!handle) { - printf("Error: dlopen of liblttng-ust shared library (%s).\n", lib_soname); + desc->handle = dlopen(desc->soname, RTLD_NOW | RTLD_GLOBAL); + if (!desc->handle) { + printf("Error: dlopen of liblttng-ust shared library (%s).\n", desc->soname); ret = EXIT_FAILURE; } else { - printf("Success: dlopen of liblttng-ust shared library (%s).\n", lib_soname); + printf("Success: dlopen of liblttng-ust shared library (%s).\n", desc->soname); } return ret; @@ -34,13 +50,13 @@ int dlopen_ust(const char *lib_soname) static int dlopen_abi0(void) { - return dlopen_ust(LTTNG_UST_LIB_ABI0_SO_NAME); + return dlopen_ust(&lib_desc[0]); } static int dlopen_abi1(void) { - return dlopen_ust(LTTNG_UST_LIB_ABI1_SO_NAME); + return dlopen_ust(&lib_desc[1]); } static @@ -48,11 +64,11 @@ int dlopen_abi0_abi1(void) { int ret = EXIT_SUCCESS; - ret = dlopen_ust(LTTNG_UST_LIB_ABI0_SO_NAME); + ret = dlopen_ust(&lib_desc[0]); if (ret != EXIT_SUCCESS) return ret; - ret = dlopen_ust(LTTNG_UST_LIB_ABI1_SO_NAME); + ret = dlopen_ust(&lib_desc[1]); return ret; } @@ -62,11 +78,11 @@ int dlopen_abi1_abi0(void) { int ret = EXIT_SUCCESS; - ret = dlopen_ust(LTTNG_UST_LIB_ABI1_SO_NAME); + ret = dlopen_ust(&lib_desc[1]); if (ret != EXIT_SUCCESS) return ret; - ret = dlopen_ust(LTTNG_UST_LIB_ABI0_SO_NAME); + ret = dlopen_ust(&lib_desc[0]); return ret; } @@ -76,11 +92,11 @@ int dlopen_abi1_abi1(void) { int ret = EXIT_SUCCESS; - ret = dlopen_ust(LTTNG_UST_LIB_ABI1_SO_NAME); + ret = dlopen_ust(&lib_desc[1]); if (ret != EXIT_SUCCESS) return ret; - ret = dlopen_ust(LTTNG_UST_LIB_ABI1_SO_NAME); + ret = dlopen_ust(&lib_desc[2]); return ret; }