2 # SPDX-License-Identifier: LGPL-2.1-only
4 if [ "x${UST_TESTS_SRCDIR:-}" != "x" ]; then
5 UTILSSH
="$UST_TESTS_SRCDIR/utils/utils.sh"
7 UTILSSH
="$(dirname "$0")/../../utils/utils.sh"
10 # shellcheck source=../../utils/utils.sh
13 # shellcheck source=../../utils/tap.sh
14 source "$UST_TESTS_SRCDIR/utils/tap.sh"
16 CURDIR
="${UST_TESTS_BUILDDIR}/regression/abi0-conflict"
18 LIBFAKEUST0_PATH
="${CURDIR}/.libs"
19 LIBFAKEUST0
="${LIBFAKEUST0_PATH}/libfakeust0.so"
21 LIBUST1_PATH
="${UST_TESTS_BUILDDIR}/../src/lib/lttng-ust/.libs/"
22 LIBUST1
="${LIBUST1_PATH}/liblttng-ust.so.1"
24 STD_OUTPUT
="/dev/null"
27 # Force abort on CRIT() to detect ABI conflicts
28 export LTTNG_UST_ABORT_ON_CRITICAL
=1
38 ## App NOT linked on liblttn-ust
40 "${CURDIR}/app_noust" >"$STD_OUTPUT" 2>"$STD_ERROR"
41 ok $?
"LD_PRELOAD: no-ust app works"
43 LD_PRELOAD
="${LIBFAKEUST0}" "${CURDIR}/app_noust" >"$STD_OUTPUT" 2>"$STD_ERROR"
44 ok $?
"LD_PRELOAD: no-ust app with abi0 preload succeeds"
46 LD_PRELOAD
="${LIBFAKEUST0}:${LIBUST1}" "${CURDIR}/app_noust" >"$STD_OUTPUT" 2>"$STD_ERROR"
47 isnt $?
0 "LD_PRELOAD: no-ust app with abi0 and abi1 preload fails"
49 LD_PRELOAD
="${LIBUST1}:${LIBFAKEUST0}" "${CURDIR}/app_noust" >"$STD_OUTPUT" 2>"$STD_ERROR"
50 isnt $?
0 "LD_PRELOAD: no-ust app with abi1 and abi0 preload fails"
53 ## App linked on liblttn-ust.so.1
55 "${CURDIR}/app_ust" >"$STD_OUTPUT" 2>"$STD_ERROR"
56 ok $?
"LD_PRELOAD: ust app works"
58 LD_PRELOAD
="${LIBFAKEUST0}" "${CURDIR}/app_ust" >"$STD_OUTPUT" 2>"$STD_ERROR"
59 isnt $?
0 "LD_PRELOAD: ust app with abi0 preload fails"
61 LD_PRELOAD
="${LIBFAKEUST0}:${LIBUST1}" "${CURDIR}/app_ust" >"$STD_OUTPUT" 2>"$STD_ERROR"
62 isnt $?
0 "LD_PRELOAD: ust app with abi0 and abi1 preload fails"
64 LD_PRELOAD
="${LIBUST1}:${LIBFAKEUST0}" "${CURDIR}/app_ust" >"$STD_OUTPUT" 2>"$STD_ERROR"
65 isnt $?
0 "LD_PRELOAD: ust app with abi1 and abi0 preload fails"
74 ## App NOT linked on liblttn-ust
76 LD_LIBRARY_PATH
="$LIBFAKEUST0_PATH:$LIBUST1_PATH" "${CURDIR}/app_noust_dlopen" abi0
>"$STD_OUTPUT" 2>"$STD_ERROR"
77 ok $?
"dlopen: no-ust app works"
79 LD_LIBRARY_PATH
="$LIBFAKEUST0_PATH:$LIBUST1_PATH" "${CURDIR}/app_noust_dlopen" abi1_abi1
>"$STD_OUTPUT" 2>"$STD_ERROR"
80 ok $?
"dlopen: no-ust app with abi1 and abi1 succeeds"
82 LD_LIBRARY_PATH
="$LIBFAKEUST0_PATH:$LIBUST1_PATH" "${CURDIR}/app_noust_dlopen" abi0_abi1
>"$STD_OUTPUT" 2>"$STD_ERROR"
83 isnt $?
0 "dlopen: no-ust app with abi0 and abi1 fails"
85 LD_LIBRARY_PATH
="$LIBFAKEUST0_PATH:$LIBUST1_PATH" "${CURDIR}/app_noust_dlopen" abi1_abi0
>"$STD_OUTPUT" 2>"$STD_ERROR"
86 isnt $?
0 "dlopen: no-ust app with abi1 and abi0 fails"
88 ## App linked on liblttn-ust.so.1
90 LD_LIBRARY_PATH
="$LIBFAKEUST0_PATH:$LIBUST1_PATH" "${CURDIR}/app_ust_dlopen" abi1
>"$STD_OUTPUT" 2>"$STD_ERROR"
91 ok $?
"dlopen: ust app works"
93 LD_LIBRARY_PATH
="$LIBFAKEUST0_PATH:$LIBUST1_PATH" "${CURDIR}/app_ust_dlopen" abi0
>"$STD_OUTPUT" 2>"$STD_ERROR"
94 isnt $?
0 "dlopen: ust app with abi0 fails"
96 LD_LIBRARY_PATH
="$LIBFAKEUST0_PATH:$LIBUST1_PATH" "${CURDIR}/app_ust_dlopen" abi0_abi1
>"$STD_OUTPUT" 2>"$STD_ERROR"
97 isnt $?
0 "dlopen: ust app with abi0 and abi1 fails"
99 LD_LIBRARY_PATH
="$LIBFAKEUST0_PATH:$LIBUST1_PATH" "${CURDIR}/app_ust_dlopen" abi1_abi0
>"$STD_OUTPUT" 2>"$STD_ERROR"
100 isnt $?
0 "dlopen: ust app with abi1 and abi0 fails"
107 diag
"Indirect linking"
109 ## App NOT linked on liblttn-ust
111 "${CURDIR}/app_noust_indirect_abi0" >"$STD_OUTPUT" 2>"$STD_ERROR"
112 ok $?
"indirect: no-ust app with abi0 succeeds"
114 "${CURDIR}/app_noust_indirect_abi1" >"$STD_OUTPUT" 2>"$STD_ERROR"
115 ok $?
"indirect: no-ust app with abi1 succeeds"
117 "${CURDIR}/app_noust_indirect_abi0_abi1" >"$STD_OUTPUT" 2>"$STD_ERROR"
118 isnt $?
0 "indirect: no-ust app with abi0 and abi1 fails"
120 ## App linked on liblttn-ust
122 "${CURDIR}/app_ust_indirect_abi0" >"$STD_OUTPUT" 2>"$STD_ERROR"
123 isnt $?
0 "indirect: ust app with abi0 fails"
125 "${CURDIR}/app_ust_indirect_abi1" >"$STD_OUTPUT" 2>"$STD_ERROR"
126 ok $?
"indirect: ust app with abi1 succeeds"
128 "${CURDIR}/app_ust_indirect_abi0_abi1" >"$STD_OUTPUT" 2>"$STD_ERROR"
129 isnt $?
0 "indirect: ust app with abi0 and abi1 fails"