tests: Move to kernel style SPDX license identifiers
[lttng-tools.git] / tests / regression / kernel / test_userspace_probe
index f6da00dd4b0f1ebc42deec20de595c7c9e52e333..9886f1e1561d6849b2bfee7dbb63e001776f7219 100755 (executable)
@@ -1,20 +1,10 @@
 #!/bin/bash
 #
-# Copyright (C) 2017 Erica Bugden <erica.bugden@efficios.com>
-# Copyright (C) 2017 Francis Deslauriers <francis.deslauriers@efficios.com>
+# Copyright (C) 2017 Erica Bugden <erica.bugden@efficios.com>
+# Copyright (C) 2017 Francis Deslauriers <francis.deslauriers@efficios.com>
 #
-# This library is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation; version 2.1 of the License.
+# SPDX-License-Identifier: LGPL-2.1-only
 #
-# This library 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 Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
 TEST_DESC="Userspace probe - Testing userspace probe on ELF symbol"
 
@@ -32,7 +22,7 @@ SDT_TEST_BIN_NAME="userspace-probe-sdt-binary"
 SDT_TEST_BIN="$SDT_TEST_BIN_DIR/$SDT_TEST_BIN_NAME"
 ELF_SYMBOL="test_function"
 PROBE_EVENT_NAME=userspace_probe_test_event
-NUM_TESTS=87
+NUM_TESTS=93
 OUTPUT_DEST=/dev/null
 ERROR_OUTPUT_DEST=/dev/null
 
@@ -139,6 +129,31 @@ function test_userspace_probe_enable_elf_symbol_not_function ()
        rm -rf "$TRACE_PATH"
 }
 
+function test_userspace_probe_unsupported_types ()
+{
+       TRACE_PATH=$(mktemp -d)
+       SESSION_NAME="test_userspace_probe_unsupported_types"
+       # Userspace probe at an address or at an offset to a function
+       # instrumentation description types are not supported at the moment.
+       ENABLE_EXPR_1="elf:$ELF_TEST_BIN:0x400030"
+       ENABLE_EXPR_2="elf:$ELF_TEST_BIN:4194364"
+       ENABLE_EXPR_3="elf:$ELF_TEST_BIN:$ELF_SYMBOL+0x21"
+       ENABLE_EXPR_4="elf:$ELF_TEST_BIN:$ELF_SYMBOL+2"
+
+       diag "Userspace probe enable with unsupported instrumentation description type"
+
+       create_lttng_session_ok $SESSION_NAME "$TRACE_PATH"
+
+       lttng_enable_kernel_userspace_probe_event_fail $SESSION_NAME "$ENABLE_EXPR_1" $PROBE_EVENT_NAME
+       lttng_enable_kernel_userspace_probe_event_fail $SESSION_NAME "$ENABLE_EXPR_2" $PROBE_EVENT_NAME
+       lttng_enable_kernel_userspace_probe_event_fail $SESSION_NAME "$ENABLE_EXPR_3" $PROBE_EVENT_NAME
+       lttng_enable_kernel_userspace_probe_event_fail $SESSION_NAME "$ENABLE_EXPR_4" $PROBE_EVENT_NAME
+
+       destroy_lttng_session_ok $SESSION_NAME
+
+       rm -rf "$TRACE_PATH"
+}
+
 function test_userspace_probe_enable_implicit_probe_type ()
 {
        TRACE_PATH=$(mktemp -d)
@@ -816,6 +831,7 @@ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
        test_userspace_probe_enable_elf_missing_symbol_name
        test_userspace_probe_enable_elf_nonexistant_symbol
        test_userspace_probe_enable_elf_symbol_not_function
+       test_userspace_probe_unsupported_types
 
        # Successful userspace probe elf enabling
        test_userspace_probe_enable_implicit_probe_type
This page took 0.031658 seconds and 5 git commands to generate.