Cleanup: use `modprobe --remove` rather than `rmmod`
[lttng-tools.git] / tests / regression / tools / tracker / test_event_tracker
index 0daa2f8b5436dc26ae92f04a4a46d8fcf2d325b6..711690af6400daabc4627dc87c77e4730da5d541 100755 (executable)
@@ -1,20 +1,9 @@
 #!/bin/bash
 #
-# Copyright (C) 2013 Christian Babeux <christian.babeux@efficios.com>
-# Copyright (C) 2015-2018 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+# Copyright (C) 2013 Christian Babeux <christian.babeux@efficios.com>
+# Copyright (C) 2015-2018 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
 #
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License, version 2 only, as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# SPDX-License-Identifier: GPL-2.0-only
 
 TEST_DESC="LTTng - Event traker test"
 
@@ -28,7 +17,7 @@ TESTAPP_KERNEL_BIN="$TESTAPP_PATH/$TESTAPP_KERNEL_NAME/$TESTAPP_KERNEL_NAME"
 SESSION_NAME="tracker"
 NR_ITER=100
 NUM_GLOBAL_TESTS=2
-NUM_UST_TESTS=256
+NUM_UST_TESTS=283
 NUM_KERNEL_TESTS=462
 NUM_TESTS=$((NUM_UST_TESTS+NUM_KERNEL_TESTS+NUM_GLOBAL_TESTS))
 
@@ -345,6 +334,36 @@ function test_event_pid_track_untrack()
        rm -rf "$trace_path"
 }
 
+function test_event_ust_vpid_untrack_snapshot()
+{
+       local trace_path
+
+       trace_path=$(mktemp -d)
+
+       diag "Test_event_ust_vpid_untrack_snapshot"
+
+       create_lttng_session_ok $SESSION_NAME "$trace_path" "--snapshot"
+
+       enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME"
+
+       prepare_ust_app
+
+       lttng_untrack_ust_ok "--vpid --all"
+
+       start_lttng_tracing_ok
+
+       trace_ust_app
+       lttng_snapshot_record $SESSION_NAME
+
+       stop_lttng_tracing_ok
+       destroy_lttng_session_ok $SESSION_NAME
+
+       snapshot_count=$(find "$trace_path" -name metadata | wc -l)
+       is "$snapshot_count" 0 "Number of snapshot is zero"
+
+       rm -rf "$trace_path"
+}
+
 # MUST set TESTDIR before calling those functions
 plan_tests $NUM_TESTS
 
@@ -360,6 +379,10 @@ fi
 
 EVENT_NAME="tp:tptest"
 
+# Both ordering of tracker type and `--all` are valid.
+test_event_track_untrack ust 0 "${EVENT_NAME}" "--vgid --all"
+test_event_track_untrack ust 0 "${EVENT_NAME}" "--all --vgid"
+
 #vuid, vgid
 
 # non-matching
@@ -402,6 +425,10 @@ test_event_vpid_track_untrack ust 0 "${EVENT_NAME}"
 test_event_tracker ust 1 "${EVENT_NAME}" "--vpid --all"
 test_event_vpid_tracker ust 1 "${EVENT_NAME}"
 
+#snapshot untrack vpid
+
+test_event_ust_vpid_untrack_snapshot
+
 #pid (backward compat)
 
 #non-matching
@@ -510,7 +537,7 @@ skip $isroot "Root access is needed. Skipping all kernel tracker tests." $NUM_KE
        test_event_tracker kernel 1 "${EVENT_NAME}" "--pid --all"
        test_event_pid_tracker kernel 1 "${EVENT_NAME}"
 
-       rmmod lttng-test
+       modprobe --remove lttng-test
        ok $? "Unloading lttng-test module"
 }
 
This page took 0.025256 seconds and 4 git commands to generate.