From: David Goulet Date: Fri, 3 Oct 2014 15:05:13 +0000 (-0400) Subject: Test: Add syscall listing X-Git-Tag: v2.6.0-rc1~12 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=02db71bac53b6537d8774df68c8a39a807a39b93;p=lttng-tools.git Test: Add syscall listing For both available syscall and session event. Signed-off-by: David Goulet --- diff --git a/tests/regression/kernel/test_syscall b/tests/regression/kernel/test_syscall index e3b29e819..16df6a895 100755 --- a/tests/regression/kernel/test_syscall +++ b/tests/regression/kernel/test_syscall @@ -20,13 +20,104 @@ TEST_DESC="Kernel tracer - System calls" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../.. -NUM_TESTS=132 +NUM_TESTS=155 # test command issues at least open and close system calls TESTCMD="cat /proc/cpuinfo > /dev/null" source $TESTDIR/utils/utils.sh +function validate_list() +{ + local session_name=$1 + local event_name=$2 + local opt=$3 + + out=$($TESTDIR/../src/bin/lttng/$LTTNG_BIN list $session_name $opt | grep $event_name) + if [ -z "$out" ]; then + fail "Validate syscall listing" + diag "$event_name not found when listing $session_name (opt $opt)" + else + pass "Validate syscall listing. Found $event_name." + fi +} + +function test_syscall_event_list() +{ + local EVENT_NAME="getpid" + + diag "Syscall event listing" + + validate_list "" $EVENT_NAME "-k --syscall" +} + +function test_syscall_simple_list() +{ + TRACE_PATH=$(mktemp -d) + SESSION_NAME="kernel_syscall_simple_list" + local EVENT_NAME="close" + + diag "Syscall simple listing" + + create_lttng_session $SESSION_NAME $TRACE_PATH + + lttng_enable_kernel_syscall_ok $SESSION_NAME $EVENT_NAME + + validate_list $SESSION_NAME $EVENT_NAME + + start_lttng_tracing + eval ${TESTCMD} + stop_lttng_tracing + + # ensure each is there. + validate_trace_exp "-e syscall_entry_$EVENT_NAME: -e compat_syscall_entry_$EVENT_NAME:" $TRACE_PATH + validate_trace_exp "-e syscall_exit_$EVENT_NAME: -e compat_syscall_exit_$EVENT_NAME:" $TRACE_PATH + + # ensure trace only contains those. + validate_trace_only_exp "-e syscall_entry_$EVENT_NAME: -e compat_syscall_entry_$EVENT_NAME: -e syscall_exit_$EVENT_NAME: -e compat_syscall_exit_$EVENT_NAME:" $TRACE_PATH + + destroy_lttng_session $SESSION_NAME + + rm -rf $TRACE_PATH +} + +function test_syscall_simple_list_two() +{ + TRACE_PATH=$(mktemp -d) + SESSION_NAME="kernel_syscall_simple_list_two" + local EVENT_NAME="close" + local EVENT_NAME2="read" + + diag "Syscall simple listing" + + create_lttng_session $SESSION_NAME $TRACE_PATH + + lttng_enable_kernel_syscall_ok $SESSION_NAME $EVENT_NAME + lttng_enable_kernel_syscall_ok $SESSION_NAME $EVENT_NAME2 + + validate_list $SESSION_NAME $EVENT_NAME + validate_list $SESSION_NAME $EVENT_NAME2 + + start_lttng_tracing + eval ${TESTCMD} + stop_lttng_tracing + + # ensure each is there. + validate_trace_exp "-e syscall_entry_$EVENT_NAME: -e compat_syscall_entry_$EVENT_NAME:" $TRACE_PATH + validate_trace_exp "-e syscall_exit_$EVENT_NAME: -e compat_syscall_exit_$EVENT_NAME:" $TRACE_PATH + + # ensure each is there. + validate_trace_exp "-e syscall_entry_$EVENT_NAME2: -e compat_syscall_entry_$EVENT_NAME2:" $TRACE_PATH + validate_trace_exp "-e syscall_exit_$EVENT_NAME2: -e compat_syscall_exit_$EVENT_NAME2:" $TRACE_PATH + + # ensure trace only contains those. + validate_trace_only_exp "-e syscall_entry_$EVENT_NAME: -e compat_syscall_entry_$EVENT_NAME: -e syscall_exit_$EVENT_NAME: -e compat_syscall_exit_$EVENT_NAME: -e syscall_entry_$EVENT_NAME2: -e compat_syscall_entry_$EVENT_NAME2: -e syscall_exit_$EVENT_NAME2: -e compat_syscall_exit_$EVENT_NAME2:" $TRACE_PATH + + destroy_lttng_session $SESSION_NAME + + rm -rf $TRACE_PATH +} + function test_syscall_single() { TRACE_PATH=$(mktemp -d) @@ -498,6 +589,9 @@ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || { start_lttng_sessiond + test_syscall_event_list + test_syscall_simple_list + test_syscall_simple_list_two test_syscall_single test_syscall_two test_syscall_all