Tests: add hidden trigger visibility test
[lttng-tools.git] / tests / regression / tools / base-path / test_ust
CommitLineData
2a166864
MD
1#!/bin/bash
2#
9d16b343 3# Copyright (C) 2019 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2a166864 4#
9d16b343
MJ
5# SPDX-License-Identifier: LGPL-2.1-only
6
2a166864
MD
7TEST_DESC="Streaming Base Path Override - User space tracing"
8
3c3c7935 9CURDIR=$(dirname "$0")/
2a166864 10TESTDIR=$CURDIR/../../..
2a166864
MD
11TESTAPP_PATH="$TESTDIR/utils/testapp"
12TESTAPP_NAME="gen-ust-events"
13TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
14EVENT_NAME="tp:tptest"
15
33e55711 16TRACE_PATH=$(mktemp --tmpdir -d tmp.test_base_path_ust_trace_path.XXXXXX)
2a166864 17
bd666153 18NUM_TESTS=42
2a166864 19
3c3c7935 20source "$TESTDIR/utils/utils.sh"
2a166864
MD
21
22if [ ! -x "$TESTAPP_BIN" ]; then
23 BAIL_OUT "No UST events binary detected."
24fi
25
26function ust_app_stream_base_path ()
27{
3c3c7935 28 local session_name="ust_app_stream_base_path"
2a166864
MD
29 local base_path="my/custom/path1"
30
31 diag "Test base path override for trace streaming"
32 create_lttng_session_uri $session_name net://localhost/$base_path
33 enable_ust_lttng_event_ok $session_name $EVENT_NAME
34
35 start_lttng_tracing_ok $session_name
36
37 $TESTAPP_BIN > /dev/null 2>&1
38
39 stop_lttng_tracing_ok $session_name
40 destroy_lttng_session_ok $session_name
41
42 # validate test
bd666153 43 validate_trace_path_ust_uid_network "$TRACE_PATH" "" "$base_path"
3c3c7935 44 if validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
2a166864 45 # only delete if successful
3c3c7935 46 rm -rf "$TRACE_PATH"
2a166864
MD
47 fi
48}
49
50function ust_app_snapshot_create_base_path ()
51{
3c3c7935 52 local session_name="ust_app_snapshot_create_base_path"
2a166864
MD
53 local base_path="my/custom/path2"
54
55 diag "Test base path override for remote trace snapshot (URI on create)"
56 create_lttng_session_uri $session_name net://localhost/$base_path \
57 --snapshot
58 enable_ust_lttng_event_ok $session_name $EVENT_NAME
59
60 start_lttng_tracing_ok $session_name
61
62 $TESTAPP_BIN > /dev/null 2>&1
63
64 stop_lttng_tracing_ok $session_name
65
66 lttng_snapshot_record $session_name
67
68 destroy_lttng_session_ok $session_name
69
70 # validate test
bd666153 71 validate_trace_path_ust_uid_snapshot_network "$TRACE_PATH" "" "snapshot-1" 0 "$base_path"
3c3c7935 72 if validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
2a166864 73 # only delete if successful
3c3c7935 74 rm -rf "$TRACE_PATH"
2a166864
MD
75 fi
76}
77
78function ust_app_snapshot_base_path ()
79{
3c3c7935 80 local session_name="ust_app_snapshot_base_path"
2a166864
MD
81 local base_path="my/custom/path3"
82
83 diag "Test base path override for remote trace snapshot (URI on snapshot)"
84 create_lttng_session_no_output $session_name --snapshot
85 enable_ust_lttng_event_ok $session_name $EVENT_NAME
86
87 start_lttng_tracing_ok $session_name
88
89 $TESTAPP_BIN > /dev/null 2>&1
90
91 stop_lttng_tracing_ok $session_name
92
93 lttng_snapshot_record $session_name net://localhost/$base_path
94
95 destroy_lttng_session_ok $session_name
96
97 # validate test
bd666153 98 validate_trace_path_ust_uid_snapshot_network "$TRACE_PATH" "" "snapshot-0" 0 "$base_path"
3c3c7935 99 if validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
2a166864 100 # only delete if successful
3c3c7935 101 rm -rf "$TRACE_PATH"
2a166864
MD
102 fi
103}
104
105function ust_app_snapshot_add_output_base_path ()
106{
3c3c7935 107 local session_name="ust_app_snapshot_add_output_base_path"
ac29b2c7 108 local base_path="my/custom/path4"
2a166864
MD
109
110 diag "Test base path override for remote trace snapshot (URI on add-output)"
111 create_lttng_session_no_output $session_name --snapshot
112 enable_ust_lttng_event_ok $session_name $EVENT_NAME
113
114 start_lttng_tracing_ok $session_name
115
116 $TESTAPP_BIN > /dev/null 2>&1
117
118 stop_lttng_tracing_ok $session_name
119
120 lttng_snapshot_add_output_ok $session_name net://localhost/$base_path
121 lttng_snapshot_record $session_name
122
123 destroy_lttng_session_ok $session_name
124
125 # validate test
bd666153 126 validate_trace_path_ust_uid_snapshot_network "$TRACE_PATH" "" "snapshot-1" 0 "$base_path"
3c3c7935 127 if validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
2a166864 128 # only delete if successful
3c3c7935 129 rm -rf "$TRACE_PATH"
2a166864
MD
130 fi
131}
132
ac29b2c7
JR
133function ust_app_stream_base_path_via_load ()
134{
135 local session_name="load-stream-extra-path"
136 local base_path="my/custom/path5"
137
138 diag "Test base path override for trace streaming using lttng load"
139 lttng_load_ok "-i $CURDIR/$session_name.lttng"
140 start_lttng_tracing_ok $session_name
141
142 $TESTAPP_BIN > /dev/null 2>&1
143
144 stop_lttng_tracing_ok $session_name
145 destroy_lttng_session_ok $session_name
146
147 # validate test
bd666153 148 validate_trace_path_ust_uid_network "$TRACE_PATH" "" "$base_path"
ac29b2c7
JR
149 if validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
150 # only delete if successful
151 rm -rf "$TRACE_PATH"
152 fi
153}
154
2a166864
MD
155plan_tests $NUM_TESTS
156
157print_test_banner "$TEST_DESC"
158
159start_lttng_relayd "-o $TRACE_PATH"
160start_lttng_sessiond
161
162tests=( ust_app_stream_base_path
163 ust_app_snapshot_create_base_path
164 ust_app_snapshot_base_path
ac29b2c7
JR
165 ust_app_snapshot_add_output_base_path
166 ust_app_stream_base_path_via_load
167)
3c3c7935 168for fct_test in "${tests[@]}";
2a166864
MD
169do
170 ${fct_test}
171done
172
173stop_lttng_sessiond
174stop_lttng_relayd
This page took 0.043688 seconds and 4 git commands to generate.