#!/bin/bash
#
-# Copyright (C) - 2016 Julien Desfossez <jdesfossez@efficios.com>
+# Copyright (C) 2016 Julien Desfossez <jdesfossez@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.
+# SPDX-License-Identifier: GPL-2.0-only
#
-# 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.
TEST_DESC="Perf counters"
function test_ust_raw()
{
- TRACE_PATH=$(mktemp -d)
- SESSION_NAME="ust_perf"
- CHAN_NAME="mychan"
- EVENT_NAME="tp:tptest"
- PMU="UNHALTED_REFERENCE_CYCLES"
- PERFID=$($CURDIR/find_event $PMU)
- test $? -eq "0"
- ok $? "Find PMU $PMU"
+ local TRACE_PATH=$(mktemp -d)
+ local SESSION_NAME="ust_perf"
+ local CHAN_NAME="mychan"
+ local EVENT_NAME="tp:tptest"
+ local PMU="UNHALTED_REFERENCE_CYCLES"
+ local tests_to_skip=9
+ local ret
+
+ # Find the raw perf id of the event.
+ PERFID=$("$CURDIR/find_event" "$PMU")
+ ret=$?
+ if [ "$ret" -eq "0" ]; then
+ pass "Find PMU $PMU"
+ elif [ "$ret" -eq "1" ]; then
+ skip 0 "PMU event not found." $tests_to_skip
+ return
+ elif [ "$ret" -eq "2" ]; then
+ skip 0 "PMU event not actionable." $tests_to_skip
+ return
+ else
+ fail "find_event returned $ret."
+ return
+ fi
create_lttng_session_ok $SESSION_NAME $TRACE_PATH
start_lttng_tracing_ok
- $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1
+ $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT >/dev/null 2>&1
stop_lttng_tracing_ok
function test_kernel_raw()
{
- TRACE_PATH=$(mktemp -d)
- SESSION_NAME="kernel_perf"
- CHAN_NAME="mychan"
- EVENT_NAME="lttng_test_filter_event"
- PMU="UNHALTED_REFERENCE_CYCLES"
- PERFID=$($CURDIR/find_event $PMU)
- test $? -eq "0"
- ok $? "Find PMU $PMU"
+ local TRACE_PATH=$(mktemp -d)
+ local SESSION_NAME="kernel_perf"
+ local CHAN_NAME="mychan"
+ local EVENT_NAME="lttng_test_filter_event"
+ local PMU="UNHALTED_REFERENCE_CYCLES"
+ local PERFID=""
+ local tests_to_skip=9
+ local ret
+
+ # Find the raw perf id of the event.
+ PERFID=$("$CURDIR/find_event" "$PMU")
+ ret=$?
+ if [ "$ret" -eq "0" ]; then
+ pass "Find PMU $PMU"
+ elif [ "$ret" -eq "1" ]; then
+ skip 0 "PMU event not found." $tests_to_skip
+ return
+ elif [ "$ret" -eq "2" ]; then
+ skip 0 "PMU event not actionable." $tests_to_skip
+ return
+ else
+ fail "find_event returned $ret."
+ return
+ fi
create_lttng_session_ok $SESSION_NAME $TRACE_PATH
{
modprobe lttng-test
test_kernel_raw
- rmmod lttng-test
+ modprobe --remove lttng-test
}
stop_lttng_sessiond