From: Mathieu Desnoyers Date: Wed, 24 Sep 2014 16:18:19 +0000 (-0400) Subject: Test: add disable syscalls when none are enabled X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=d96f6315f068984c2edda2ac612bacbdb2c7b0d2;hp=8cfcd41c7fac2e14d8f8527238d928bd4ec732fb;p=lttng-tools.git Test: add disable syscalls when none are enabled Signed-off-by: Mathieu Desnoyers --- diff --git a/tests/regression/kernel/test_syscall b/tests/regression/kernel/test_syscall index 5e6b7467b..657c5eea2 100755 --- a/tests/regression/kernel/test_syscall +++ b/tests/regression/kernel/test_syscall @@ -20,7 +20,7 @@ TEST_DESC="Kernel tracer - System calls" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. -NUM_TESTS=124 +NUM_TESTS=132 # test command issues at least open and close system calls TESTCMD="cat /proc/cpuinfo > /dev/null" @@ -415,6 +415,38 @@ function test_syscall_disable_all_disable_one() rm -rf $TRACE_PATH } +function test_syscall_enable_channel_disable_all() +{ + TRACE_PATH=$(mktemp -d) + SESSION_NAME="kernel_syscall_enable_channel_disable_all" + CHANNEL_NAME="channel" + + create_lttng_session $SESSION_NAME $TRACE_PATH + + lttng_enable_kernel_channel_ok $SESSION_NAME $CHANNEL_NAME + lttng_disable_kernel_syscall_fail $SESSION_NAME "-a" $CHANNEL_NAME + + destroy_lttng_session $SESSION_NAME + + rm -rf $TRACE_PATH +} + +function test_syscall_enable_channel_disable_one() +{ + TRACE_PATH=$(mktemp -d) + SESSION_NAME="kernel_syscall_enable_channel_disable_all" + CHANNEL_NAME="channel" + + create_lttng_session $SESSION_NAME $TRACE_PATH + + lttng_enable_kernel_channel_ok $SESSION_NAME $CHANNEL_NAME + lttng_disable_kernel_syscall_fail $SESSION_NAME "open" $CHANNEL_NAME + + destroy_lttng_session $SESSION_NAME + + rm -rf $TRACE_PATH +} + # MUST set TESTDIR before calling those functions plan_tests $NUM_TESTS @@ -446,6 +478,8 @@ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || test_syscall_enable_unknown test_syscall_enable_all_enable_one test_syscall_disable_all_disable_one + test_syscall_enable_channel_disable_all + test_syscall_enable_channel_disable_one stop_lttng_sessiond } diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 2647769f2..e2cd7f881 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -181,6 +181,58 @@ function lttng_disable_kernel_syscall_fail() lttng_disable_kernel_syscall 1 ${*} } +function lttng_enable_kernel_channel() +{ + local expected_to_fail=$1 + local sess_name=$2 + local channel_name=$3 + + $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -k $channel_name -s $sess_name >$OUTPUT_DEST + ret=$? + if [[ $expected_to_fail -eq "1" ]]; then + test "$ret" -ne "0" + ok $? "Expected failure on kernel channel creation $channel_name in $sess_name" + else + ok $ret "Enable channel $channel_name for session $sess_name" + fi +} + +function lttng_enable_kernel_channel_ok() +{ + lttng_enable_kernel_channel 0 ${*} +} + +function lttng_enable_kernel_channel_fail() +{ + lttng_enable_kernel_channel 1 ${*} +} + +function lttng_disable_kernel_channel() +{ + local expected_to_fail=$1 + local sess_name=$2 + local channel_name=$3 + + $TESTDIR/../src/bin/lttng/$LTTNG_BIN disable-channel -k $channel_name -s $sess_name >$OUTPUT_DEST + ret=$? + if [[ $expected_to_fail -eq "1" ]]; then + test "$ret" -ne "0" + ok $? "Expected failure on kernel channel creation $channel_name in $sess_name" + else + ok $ret "disable channel $channel_name for session $sess_name" + fi +} + +function lttng_disable_kernel_channel_ok() +{ + lttng_disable_kernel_channel 0 ${*} +} + +function lttng_disable_kernel_channel_fail() +{ + lttng_disable_kernel_channel 1 ${*} +} + function start_lttng_relayd { local opt=$1