diff mbox series

[lttng-tools] Fix: skip test when ust doesn'thave perf support

Message ID 20190320214900.16654-1-mjeanson@efficios.com
State Accepted, archived
Delegated to: Jérémie Galarneau
Headers show
Series [lttng-tools] Fix: skip test when ust doesn'thave perf support | expand

Commit Message

Michael Jeanson March 20, 2019, 9:49 p.m. UTC
Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
---
 tests/regression/ust/test_event_perf | 43 +++++++++++++++++++++++-----
 1 file changed, 36 insertions(+), 7 deletions(-)

Comments

Jérémie Galarneau March 29, 2019, 6:52 p.m. UTC | #1
Merged in master, stable-2.11, stable-2.10, and stable-2.9.

Thanks!
J?r?mie

On Wed, Mar 20, 2019 at 05:49:00PM -0400, Michael Jeanson wrote:
> Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
> ---
>  tests/regression/ust/test_event_perf | 43 +++++++++++++++++++++++-----
>  1 file changed, 36 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/regression/ust/test_event_perf b/tests/regression/ust/test_event_perf
> index 4e665e65..9b1dea3e 100755
> --- a/tests/regression/ust/test_event_perf
> +++ b/tests/regression/ust/test_event_perf
> @@ -41,6 +41,29 @@ function enable_ust_lttng_event_per_chan()
>  	ok $? "Enable event $event_name for session $sess_name in channel $chan_name"
>  }
>  
> +function add_context_ust_skip_ok()
> +{
> +	local session_name=$1
> +	local channel_name=$2
> +	local context_name=$3
> +	local skip_num=$4
> +
> +	local ret
> +
> +	"$TESTDIR/../src/bin/lttng/$LTTNG_BIN" add-context -u \
> +		-s "$session_name" -c "$channel_name" \
> +		-t "$context_name"  1>"$OUTPUT_DEST" 2>"$ERROR_OUTPUT_DEST"
> +	ret=$?
> +
> +	if [ "$ret" == "4" ]; then
> +		skip 0 "Current UST lib doesn't implement '$context_name' context" "$skip_num"
> +	else
> +		ok $ret "Add context command for type: $context_name"
> +	fi
> +
> +	return $ret
> +}
> +
>  # Only test parsing of the enabling by raw ID
>  function test_parsing_raw()
>  {
> @@ -54,7 +77,7 @@ function test_parsing_raw()
>  
>  	enable_ust_lttng_event_per_chan $SESSION_NAME $EVENT_NAME $CHAN_NAME
>  
> -	add_context_ust_ok $SESSION_NAME $CHAN_NAME "perf:thread:raw:r0110:test"
> +	add_context_ust_skip_ok $SESSION_NAME $CHAN_NAME "perf:thread:raw:r0110:test" 1
>  	add_context_ust_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw:rZZZ:test"
>  	add_context_ust_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw:b0110:test"
>  	add_context_ust_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw:r0110:"
> @@ -76,24 +99,30 @@ function test_event_basic()
>  	SESSION_NAME="ust_event_basic"
>  	CHAN_NAME="mychan"
>  
> +	local ret
> +
>  	create_lttng_session_ok $SESSION_NAME $TRACE_PATH
>  
>  	enable_ust_lttng_channel_ok $SESSION_NAME $CHAN_NAME
>  
>  	enable_ust_lttng_event_per_chan $SESSION_NAME $EVENT_NAME $CHAN_NAME
>  
> -	add_context_ust_ok $SESSION_NAME $CHAN_NAME "perf:thread:page-fault"
> +	add_context_ust_skip_ok $SESSION_NAME $CHAN_NAME "perf:thread:page-fault" 4
> +	ret=$?
>  
> -	start_lttng_tracing_ok
> +	if [ "$ret" != "4" ]; then
> +		start_lttng_tracing_ok
>  
> -	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1
> +		$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1
>  
> -	stop_lttng_tracing_ok
> +		stop_lttng_tracing_ok
> +
> +		validate_trace "perf_thread_page_fault" "$TRACE_PATH"
> +	fi
>  
>  	destroy_lttng_session_ok $SESSION_NAME
>  
> -	validate_trace "perf_thread_page_fault" $TRACE_PATH
> -	rm -rf $TRACE_PATH
> +	rm -rf "$TRACE_PATH"
>  }
>  
>  # MUST set TESTDIR before calling those functions
> -- 
> 2.17.1
>
diff mbox series

Patch

diff --git a/tests/regression/ust/test_event_perf b/tests/regression/ust/test_event_perf
index 4e665e65..9b1dea3e 100755
--- a/tests/regression/ust/test_event_perf
+++ b/tests/regression/ust/test_event_perf
@@ -41,6 +41,29 @@  function enable_ust_lttng_event_per_chan()
 	ok $? "Enable event $event_name for session $sess_name in channel $chan_name"
 }
 
+function add_context_ust_skip_ok()
+{
+	local session_name=$1
+	local channel_name=$2
+	local context_name=$3
+	local skip_num=$4
+
+	local ret
+
+	"$TESTDIR/../src/bin/lttng/$LTTNG_BIN" add-context -u \
+		-s "$session_name" -c "$channel_name" \
+		-t "$context_name"  1>"$OUTPUT_DEST" 2>"$ERROR_OUTPUT_DEST"
+	ret=$?
+
+	if [ "$ret" == "4" ]; then
+		skip 0 "Current UST lib doesn't implement '$context_name' context" "$skip_num"
+	else
+		ok $ret "Add context command for type: $context_name"
+	fi
+
+	return $ret
+}
+
 # Only test parsing of the enabling by raw ID
 function test_parsing_raw()
 {
@@ -54,7 +77,7 @@  function test_parsing_raw()
 
 	enable_ust_lttng_event_per_chan $SESSION_NAME $EVENT_NAME $CHAN_NAME
 
-	add_context_ust_ok $SESSION_NAME $CHAN_NAME "perf:thread:raw:r0110:test"
+	add_context_ust_skip_ok $SESSION_NAME $CHAN_NAME "perf:thread:raw:r0110:test" 1
 	add_context_ust_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw:rZZZ:test"
 	add_context_ust_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw:b0110:test"
 	add_context_ust_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw:r0110:"
@@ -76,24 +99,30 @@  function test_event_basic()
 	SESSION_NAME="ust_event_basic"
 	CHAN_NAME="mychan"
 
+	local ret
+
 	create_lttng_session_ok $SESSION_NAME $TRACE_PATH
 
 	enable_ust_lttng_channel_ok $SESSION_NAME $CHAN_NAME
 
 	enable_ust_lttng_event_per_chan $SESSION_NAME $EVENT_NAME $CHAN_NAME
 
-	add_context_ust_ok $SESSION_NAME $CHAN_NAME "perf:thread:page-fault"
+	add_context_ust_skip_ok $SESSION_NAME $CHAN_NAME "perf:thread:page-fault" 4
+	ret=$?
 
-	start_lttng_tracing_ok
+	if [ "$ret" != "4" ]; then
+		start_lttng_tracing_ok
 
-	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1
+		$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1
 
-	stop_lttng_tracing_ok
+		stop_lttng_tracing_ok
+
+		validate_trace "perf_thread_page_fault" "$TRACE_PATH"
+	fi
 
 	destroy_lttng_session_ok $SESSION_NAME
 
-	validate_trace "perf_thread_page_fault" $TRACE_PATH
-	rm -rf $TRACE_PATH
+	rm -rf "$TRACE_PATH"
 }
 
 # MUST set TESTDIR before calling those functions