+ FIRST_LINE="$(trace_first_line $TRACE_PATH/)"
+ diag "First line (1st snapshot): $FIRST_LINE"
+ rm -rf $TRACE_PATH/
+
+ # Run test apps, wait for them to complete.
+ start_test_app
+ wait_test_apps
+
+ # Take second snapshot, remember first line.
+ lttng_snapshot_record $SESSION_NAME
+ FIRST_LINE_2="$(trace_first_line $TRACE_PATH/)"
+ diag "First line (2nd snapshot): $FIRST_LINE_2"
+ rm -rf $TRACE_PATH/
+
+ if [ x"$FIRST_LINE" != x"$FIRST_LINE_2" ]; then
+ pass "First snapshot event do not match"
+ else
+ fail "First snapshot event match"
+ fi
+
+ stop_lttng_tracing_ok $SESSION_NAME
+ destroy_lttng_session_ok $SESSION_NAME
+ taskset -p $OLDCPUSET $$ 1>/dev/null 2>&1
+}
+
+function test_ust_local_snapshot_max_size ()
+{
+ local possible_cpus
+ local cpus_list
+ local subbuf_size
+ local subbuf_count
+ local snapshot_max_size
+ local channel_max_size_per_cpu
+
+ IFS=" " read -r -a cpus_list <<< "$(get_exposed_cpus_list)"
+
+ possible_cpus=$(get_possible_cpus_count)
+ subbuf_size=$(getconf PAGE_SIZE)
+ subbuf_count=8
+ snapshot_max_size=$((subbuf_size*possible_cpus))
+ channel_max_size_per_cpu=$((subbuf_size*subbuf_count))
+
+ diag "Test local UST snapshots with max size $max_size"
+ create_lttng_session_no_output "$SESSION_NAME"
+
+ enable_mmap_overwrite_subbuf_ust_channel \
+ "$SESSION_NAME" "$CHANNEL_NAME" \
+ "$subbuf_size" "$subbuf_count"
+
+ enable_ust_lttng_event_ok "$SESSION_NAME" "$EVENT_NAME" "$CHANNEL_NAME"
+ start_lttng_tracing_ok "$SESSION_NAME"
+
+ snapshot_add_output "$SESSION_NAME" "file://$TRACE_PATH" "" "$snapshot_max_size"
+
+ # Fill all ring-buffers of the channel; assuming event size of at least one
+ # byte
+ for cpu in "${cpus_list[@]}";
+ do
+ diag "setting affinity to $cpu"
+ taskset --cpu-list "$cpu" "$TESTAPP_BIN" \
+ --iter "$channel_max_size_per_cpu"
+ done
+ diag "Filled channel ring-buffers"
+
+ lttng_snapshot_record "$SESSION_NAME"