Add abi0 conflict tests
[lttng-ust.git] / tests / regression / abi0-conflict / test_abi0_conflict
1 #!/bin/bash
2 # SPDX-License-Identifier: LGPL-2.1-only
3
4 if [ "x${UST_TESTS_SRCDIR:-}" != "x" ]; then
5 UTILSSH="$UST_TESTS_SRCDIR/utils/utils.sh"
6 else
7 UTILSSH="$(dirname "$0")/../../utils/utils.sh"
8 fi
9
10 # shellcheck source=../../utils/utils.sh
11 source "$UTILSSH"
12
13 # shellcheck source=../../utils/tap.sh
14 source "$UST_TESTS_SRCDIR/utils/tap.sh"
15
16 CURDIR="${UST_TESTS_BUILDDIR}/regression/abi0-conflict"
17
18 LIBFAKEUST0_PATH="${CURDIR}/.libs"
19 LIBFAKEUST0="${LIBFAKEUST0_PATH}/libfakeust0.so"
20
21 LIBUST1_PATH="${UST_TESTS_BUILDDIR}/../src/lib/lttng-ust/.libs/"
22 LIBUST1="${LIBUST1_PATH}/liblttng-ust.so.1"
23
24 STD_OUTPUT="/dev/null"
25 STD_ERROR="/dev/null"
26
27 # Force abort on CRIT() to detect ABI conflicts
28 export LTTNG_UST_ABORT_ON_CRITICAL=1
29
30 plan_tests 22
31
32 ###
33 ## LD_PRELOAD tests
34 ###
35
36 diag "LD_PRELOAD"
37
38 ## App NOT linked on liblttn-ust
39
40 "${CURDIR}/app_noust" >"$STD_OUTPUT" 2>"$STD_ERROR"
41 ok $? "LD_PRELOAD: no-ust app works"
42
43 LD_PRELOAD="${LIBFAKEUST0}" "${CURDIR}/app_noust" >"$STD_OUTPUT" 2>"$STD_ERROR"
44 ok $? "LD_PRELOAD: no-ust app with abi0 preload succeeds"
45
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"
48
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"
51
52
53 ## App linked on liblttn-ust.so.1
54
55 "${CURDIR}/app_ust" >"$STD_OUTPUT" 2>"$STD_ERROR"
56 ok $? "LD_PRELOAD: ust app works"
57
58 LD_PRELOAD="${LIBFAKEUST0}" "${CURDIR}/app_ust" >"$STD_OUTPUT" 2>"$STD_ERROR"
59 isnt $? 0 "LD_PRELOAD: ust app with abi0 preload fails"
60
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"
63
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"
66
67
68 ###
69 ## dlopen tests
70 ###
71
72 diag "dlopen"
73
74 ## App NOT linked on liblttn-ust
75
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"
78
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"
81
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"
84
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"
87
88 ## App linked on liblttn-ust.so.1
89
90 LD_LIBRARY_PATH="$LIBFAKEUST0_PATH:$LIBUST1_PATH" "${CURDIR}/app_ust_dlopen" abi1 >"$STD_OUTPUT" 2>"$STD_ERROR"
91 ok $? "dlopen: ust app works"
92
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"
95
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"
98
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"
101
102
103 ###
104 ## Indirect linking
105 ###
106
107 diag "Indirect linking"
108
109 ## App NOT linked on liblttn-ust
110
111 "${CURDIR}/app_noust_indirect_abi0" >"$STD_OUTPUT" 2>"$STD_ERROR"
112 ok $? "indirect: no-ust app with abi0 succeeds"
113
114 "${CURDIR}/app_noust_indirect_abi1" >"$STD_OUTPUT" 2>"$STD_ERROR"
115 ok $? "indirect: no-ust app with abi1 succeeds"
116
117 "${CURDIR}/app_noust_indirect_abi0_abi1" >"$STD_OUTPUT" 2>"$STD_ERROR"
118 isnt $? 0 "indirect: no-ust app with abi0 and abi1 fails"
119
120 ## App linked on liblttn-ust
121
122 "${CURDIR}/app_ust_indirect_abi0" >"$STD_OUTPUT" 2>"$STD_ERROR"
123 isnt $? 0 "indirect: ust app with abi0 fails"
124
125 "${CURDIR}/app_ust_indirect_abi1" >"$STD_OUTPUT" 2>"$STD_ERROR"
126 ok $? "indirect: ust app with abi1 succeeds"
127
128 "${CURDIR}/app_ust_indirect_abi0_abi1" >"$STD_OUTPUT" 2>"$STD_ERROR"
129 isnt $? 0 "indirect: ust app with abi0 and abi1 fails"
This page took 0.032271 seconds and 4 git commands to generate.