####################################################################
# Copyright (c) 2014, 2016 Ericsson
#
# All rights reserved. This program and the accompanying materials are
# made available under the terms of the Eclipse Public License v1.0 which
# accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Jonathan Rajotte - Initial API and implementation
# Bernd Hufmann - Added new test cases
# Marc-Andre Laperle - Adapted to MI 3.0 (LTTng 2.8)
####################################################################
####################################################################
# Scenario: Test lttng not installed
####################################################################
LttngNotInstalled
lttng --mi xml list
1
Command not found
####################################################################
# Scenario: Test lttng version
####################################################################
LttngVersion
lttng version
0
lttng version 2.8.0 - Isseki Nicho
Web site: http://lttng.org
lttng is free software and under the GPL license and part LGPL
####################################################################
# Scenario: Test lttng version
# output with prompt
####################################################################
LttngVersionWithPrompt
lttng version
0
Prompt> lttng version 2.8.0 - Isseki Nicho
Web site: http://lttng.org
lttng is free software and under the GPL license and part LGPL
####################################################################
# Scenario: Test lttng version (unsupported version)
####################################################################
LttngUnsupportedVersion
lttng version
0
lttng version 200.0.0 - Annedd'ale
Web site: http://lttng.org/
lttng is free software and under the GPL license and part LGPL
####################################################################
# Scenario: Test lttng version (noversion)
####################################################################
LttngNoVersion
lttng version
0
Web site: http://lttng.org/
lttng is free software and under the GPL license and part LGPL
####################################################################
# Scenario: Test lttng version (compiled from source)
####################################################################
LttngVersionCompiled
lttng --mi xml version
0
version
####################################################################
# Scenario: Test no sessions available
####################################################################
NoSessionAvailable
lttng --mi xml list
0
list
####################################################################
# Scenario: Test get sessions
####################################################################
GetSessionNames1
lttng --mi xml list
0
list
####################################################################
# Scenario: Test get sessions with tracing group
####################################################################
GetSessionWithTracingGroup
lttng -g group --mi xml list
0
list
####################################################################
# Scenario: Test lttng list where session doesn't exist
####################################################################
GetSessionNameNotExist
lttng --mi xml list test
1
list
Error: Session 'test' not found
Error: Command error
####################################################################
# Scenario: Test lttng -vvv list where session doesn't exist
####################################################################
GetSessionNameNotExistVerbose
lttng --mi xml -vvv list test
1
list
Error: Session 'test' not found
Error: Command error
####################################################################
# Scenario: Test lttng list with garbage output
####################################################################
GetSessionGarbageOut
lttng --mi xml list
0
asdfaereafsdcv 12333456434&*89**(())(^%$*
@#$%^&*()@#$%^&*()0834523094578kj;djkfs
a;sdf094v5u dsafj;sd9
####################################################################
# Scenario: Test lttng list with sample outputs
####################################################################
GetSession1
lttng --mi xml list mysession
0
list
lttng --mi xml list mysession1
0
list
####################################################################
# Scenario: Test lttng list in the presence of filter expressions
####################################################################
GetSessionFilterExpression
lttng --mi xml list mysession
0
list
####################################################################
# Scenario: Test lttng list (with live time interval)
####################################################################
GetSessionWithLiveInterval
lttng --mi xml list mysession
0
list
#------------------------------------------------------------------------------
lttng --mi xml snapshot list-output -s mysession
0
snapshot
true
#------------------------------------------------------------------------------
lttng --mi xml list mysession1
0
list
mysession1
/home/user/lttng-traces/mysession1-20120129-084256
true
0
0
#------------------------------------------------------------------------------
lttng --mi xml list mysession2
0
list
mysession2
tcp4://172.0.0.1:5342/ [data: 5343]
false
0
1000000
####################################################################
# Scenario: Test "lttng list -k" with sample output
####################################################################
GetKernelProvider1
lttng --mi xml list -k
0
list
KERNEL
PER_PID
sched_kthread_stop
TRACEPOINT
true
TRACE_EMERG
ALL
sched_kthread_stop_ret
TRACEPOINT
true
TRACE_EMERG
ALL
sched_wakeup_new
TRACEPOINT
true
TRACE_EMERG
ALL
####################################################################
# Scenario: Test "lttng list -k" with no kernel and no session daemon
####################################################################
ListWithNoKernel1
lttng --mi xml list -k
1
Spawning session daemon
Error: Unable to list kernel events
####################################################################
# Scenario: Test "lttng list -k" with no kernel and with session daemon
####################################################################
ListWithNoKernel2
lttng --mi xml list -k
1
Error: Unable to list kernel events
####################################################################
# Scenario: Test "lttng list -u" with sample output
####################################################################
GetUstProvider1
lttng --mi xml list -u -f
0
list
UST
PER_PID
9379
/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
ust_tests_hello:tptest_sighandler
TRACEPOINT
true
TRACE_DEBUG_MODULE
ALL
ust_tests_hello:tptest
TRACEPOINT
true
TRACE_INFO
ALL
doublefield
FLOAT
0
floatfield
FLOAT
0
stringfield
STRING
0
4852
/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
ust_tests_hello:tptest_sighandler
TRACEPOINT
true
TRACE_WARNING
ALL
ust_tests_hello:tptest
TRACEPOINT
true
TRACE_DEBUG_FUNCTION
ALL
doublefield
FLOAT
0
floatfield
FLOAT
0
stringfield
STRING
0
####################################################################
# Scenario: Test "lttng list -u" with no UST provider available
####################################################################
GetUstProvider2
lttng --mi xml list -u -f
0
list
UST
PER_PID
####################################################################
# Scenario: Test "lttng list -u" with no UST available (LTTng 2.0.x)
####################################################################
ListWithNoUst1
lttng --mi xml list -u -f
1
list
Error: Unable to list UST event fields: LTTng-UST tracer is not supported. Please rebuild lttng-tools with lttng-ust support enabled.
Error: Command error
####################################################################
# Scenario: Test "lttng list -u" with no UST available and no session daemon
####################################################################
ListWithNoUst2
lttng --mi xml list -u -f
1
list
Error: Unable to list UST event fields: LTTng-UST tracer is not supported. Please rebuild lttng-tools with lttng-ust support enabled.
Error: Command error
####################################################################
# Scenario: Test "lttng list -" with no kernel and with session daemon
####################################################################
ListWithNoUst3
lttng --mi xml list -u -f
1
list
Error: Unable to list kernel events: Tracing the kernel requires a root lttng-sessiond daemon, as well as "tracing" group membership or root user ID for the lttng client.
Error: Command Error
####################################################################
# Scenario: Test "lttng list -u -f" with sample output (version 2.6.0)
####################################################################
GetUstProvider3
lttng --mi xml list -u -f
0
list
UST
PER_PID
9379
/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
ust_tests_hello:tptest_sighandler
TRACEPOINT
true
TRACE_DEBUG_MODULE
ALL
ust_tests_hello:tptest
TRACEPOINT
true
TRACE_INFO
ALL
doublefield
FLOAT
0
floatfield
FLOAT
0
stringfield
STRING
0
4852
/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
ust_tests_hello:tptest_sighandler
TRACEPOINT
true
TRACE_WARNING
ALL
ust_tests_hello:tptest
TRACEPOINT
true
TRACE_DEBUG_FUNCTION
ALL
doublefield
FLOAT
0
floatfield
FLOAT
0
stringfield
STRING
0
####################################################################
# Scenario: Test "lttng create
####################################################################
CreateSession1
lttng --mi xml create mysession2
0
create
mysession2
/home/user/lttng-traces/mysession2-20120209-095418
false
0
0
true
####################################################################
# Scenario: Test "lttng create
####################################################################
CreateSessionWithPrompt
lttng --mi xml create mysession2
0
Prompt> Session mysession2 created.
Traces will be written in /home/user/lttng-traces/mysession2-20120209-095418
####################################################################
# Scenario: Test "lttng create with different variants
# and errors
####################################################################
CreateSessionVariants
lttng --mi xml create alreadyExist
1
create
false
Warning: Session mysession2 already exists
Error: Session name already exists
lttng --mi xml create session with spaces
0
create
session with spaces
/home/user/lttng-traces/session with spaces-20120209-095418
false
0
0
true
lttng --mi xml create wrongName
0
create
auto
/home/user/lttng-traces/auto-20120209-095418
false
0
0
true
lttng --mi xml create wrongPath -o /home/user/hallo
0
create
wrongPath
/home/user/lttng-traces/wrongPath-20120209-095418
false
0
0
true
lttng --mi xml create pathWithSpaces -o /home/user/hallo user/here
0
create
pathWithSpaces
/home/user/hallo user/here/pathWithSpaces-20120209-095418
false
0
0
true
####################################################################
# Scenario: Test "lttng destroy
####################################################################
DestroySession1
lttng --mi xml destroy mysession2
0
destroy
mysession2
/home/user/lttng-traces/mysession2-20140812-160632
false
0
0
true
####################################################################
# Scenario: Test "lttng enable-channel ..." with different inputs
####################################################################
ChannelHandling
lttng --mi xml enable-channel mychannel0,mychannel1 -k -s mysession2 --overwrite --subbuf-size 16384 --num-subbuf 2 --switch-timer 200 --read-timer 100 -C 0 -W 10
0
Kernel channel mychannel0 enabled for session mysession2
Kernel channel mychannel1 enabled for session mysession2
lttng --mi xml enable-channel mychannel0,mychannel1 -k -s mysession2 --overwrite --subbuf-size 16384 --num-subbuf 2 --switch-timer 200 --read-timer 100
0
enable-channel
mychannel0
false
OVERWRITE
16384
2
200
100
SPLICE
0
0
4294967295
true
mychannel1
false
OVERWRITE
16384
2
200
100
SPLICE
0
0
4294967295
true
true
lttng --mi xml enable-channel ustChannel -u -s mysession2 --overwrite --subbuf-size 32768 --num-subbuf 1 --switch-timer 100 --read-timer 200 -C 0 -W 20
0
UST channel channel0 enabled for session mysession2
lttng --mi xml enable-channel ustChannel -u -s mysession2 --overwrite --subbuf-size 32768 --num-subbuf 1 --switch-timer 100 --read-timer 200
0
enable-channel
ustChannel
false
OVERWRITE
32768
2
100
200
MMAP
0
0
4294967295
true
true
lttng --mi xml enable-channel ustChannel -u -s mysession2 --overwrite --subbuf-size 32768 --num-subbuf 1 --switch-timer 100 --read-timer 200 --buffers-uid -C 0 -W 20
0
UST channel channel0 enabled for session mysession2
lttng --mi xml enable-channel ustChannel -u -s mysession2 --overwrite --buffers-pid
0
enable-channel
ustChannel
false
OVERWRITE
4096
4
0
0
MMAP
0
0
4294967295
true
true
lttng --mi xml enable-channel ustChannel -u -s mysession2 --overwrite --subbuf-size 32768 --num-subbuf 2 --switch-timer 100 --read-timer 200 --buffers-uid
0
enable-channel
ustChannel
false
OVERWRITE
32768
2
100
200
MMAP
0
0
4294967295
true
true
lttng --mi xml enable-channel mychannel0,mychannel1 -k -s mysession2
0
enable-channel
mychannel0
false
DISCARD
262144
4
0
200000
SPLICE
0
0
4294967295
true
mychannel1
false
DISCARD
262144
4
0
200000
SPLICE
0
0
4294967295
true
true
lttng --mi xml enable-channel ustChannel -u -s mysession2
0
enable-channel
ustChannel
false
DISCARD
131072
4
0
0
MMAP
0
0
4294967295
true
true
lttng --mi xml disable-channel mychannel0,mychannel1 -k -s mysession2
0
disable-channel
mychannel0
false
true
mychannel1
false
true
true
lttng --mi xml disable-channel ustChannel -u -s mysession2
0
disable-channel
ustChannel
false
true
true
####################################################################
# Scenario: Test "lttng --mi xml enable-events ..." with different inputs
####################################################################
EventHandling
# Tracepoint test cases
lttng --mi xml enable-event block_rq_remap,block_bio_remap,softirq_entry -k -s mysession2 --tracepoint
0
enable-event
block_rq_remap
TRACEPOINT
true
TRACE_EMERG
ALL
true
block_bio_remap
TRACEPOINT
true
TRACE_EMERG
ALL
true
softirq_entry
TRACEPOINT
true
TRACE_EMERG
ALL
true
true
lttng --mi xml enable-event -a -k -s mysession2 -c mychannel --tracepoint
0
enable-event
*
TRACEPOINT
true
TRACE_EMERG
ALL
true
true
lttng --mi xml enable-event ust_tests_hello:tptest_sighandler -u -s mysession2 -c mychannel --tracepoint
0
enable-event
ust_tests_hello:tptest_sighandler
TRACEPOINT
true
true
true
lttng --mi xml enable-event ust_tests_hello:tptest_sighandler -u -s mysession2 -c mychannel --tracepoint --filter intfield==10
0
enable-event
ust_tests_hello:tptest_sighandler
TRACEPOINT
true
true
true
lttng --mi xml enable-event -a -u -s mysession2 -c mychannel --tracepoint
0
enable-event
*
TRACEPOINT
true
true
true
# Syscall test cases
lttng --mi xml enable-event -a -k -s mysession2 --syscall
0
enable-event
*
SYSCALL
true
true
true
lttng --mi xml enable-event -a -k -s mysession2 -c mychannel --syscall
0
enable-event
*
SYSCALL
true
true
true
# dynamic probe/function probe test cases
lttng --mi xml enable-event myevent0 -k -s mysession2 --function 0xc0101340
0
enable-event
myevent0
FUNCTION
false
true
true
lttng --mi xml enable-event myevent1 -k -s mysession2 -c mychannel --probe init_post
0
enable-event
myevent1
PROBE
false
0
init_post
true
true
# log level test cases
lttng --mi xml enable-event myevent4 -u -s mysession2 --loglevel-only TRACE_DEBUG
0
enable-event
myevent4
TRACEPOINT
true
TRACE_DEBUG
SINGLE
true
true
lttng --mi xml enable-event myevent5 -u -s mysession2 -c mychannel --loglevel TRACE_DEBUG_FUNCTION
0
enable-event
myevent5
TRACEPOINT
true
TRACE_DEBUG_FUNCTION
RANGE
true
true
####################################################################
# Scenario: Test "lttng add-context -h" and lttng --mi xml add-context ..." with different inputs
####################################################################
ContextHandling
lttng --mi xml add-context -h
0
usage: lttng add-context -t TYPE [-k|-u] [OPTIONS]
If no channel is given (-c), the context is added to
all channels.
Otherwise the context is added only to the channel (-c).
Exactly one domain (-k or -u) must be specified.
Options:
-h, --help Show this help
--list-options Simple listing of options
-s, --session NAME Apply to session name
-c, --channel NAME Apply to channel
-k, --kernel Apply to the kernel tracer
-u, --userspace Apply to the user-space tracer
Context:
-t, --type TYPE Context type. You can repeat that option on
the command line to specify multiple contexts at once.
(--kernel preempts --userspace)
TYPE can be one of the strings below:
pid, procname, prio, nice, vpid, tid, pthread_id,
vtid, ppid, vppid, perf:cpu:cpu-cycles, perf:cpu:cycles
Note that the vpid, vppid and vtid context types represent the virtual process id,
virtual parent process id and virtual thread id as seen from the current execution context
as opposed to the pid, ppid and tid which are kernel internal data structures.
Example:
This command will add the context information 'prio' and two per-cpu
perf counters (hardware branch misses and cache misses), to all channels
in the trace data output:
# lttng add-context -k -t prio -t perf:cpu:branch-misses -t perf:cpu:cache-misses
lttng --mi xml add-context -s mysession2 -c mychannel -e ust_tests_hello:tptest_sighandler -u -t prio -t pid
0
UST context prio added to event ust_tests_hello:tptest_sighandle channel mychannel
UST context pid added to event sched_kthread_stop_ret channel mychannel
####################################################################
# Scenario: Test "lttng --mi xml add-context --list"
####################################################################
ListContext28
lttng --mi xml add-context --list
0
pid
procname
prio
nice
vpid
tid
pthread_id
vtid
ppid
vppid
perf:cpu:cpu-cycles
perf:cpu:cycles
ContextErrorHandling
lttng --mi xml add-context -h
1
usage: lttng add-context -t TYPE
If no channel and no event is given (-c/-e), the context
will be added to all events and all channels.
Otherwise the context will be added only to the channel (-c)
and/or event (-e) indicated.
Exactly one domain (-k/--kernel or -u/--userspace) must be specified.
Options:
-h, --help Show this help
--list-options Simple listing of options
-s, --session NAME Apply to session name
-c, --channel NAME Apply to channel
-e, --event NAME Apply to event
-k, --kernel Apply to the kernel tracer
-u, --userspace Apply to the user-space tracer
-t, --type TYPE Context type. You can repeat that option on
the command line to specify multiple contexts at once.
(--kernel preempts --userspace)
TYPE can be one of the strings below:
pid, procname, prio, nice, vpid, tid, pthread_id,
vtid, ppid, vppid, perf:cpu-cycles, perf:cycles
Example:
This command will add the context information 'prio' and two perf
counters (hardware branch misses and cache misses), to all events
in the trace data output:
# lttng add-context -k -t prio -t perf:branch-misses -t perf:cache-misses
lttng --mi xml add-context -s mysession2 -c mychannel -e ust_tests_hello:tptest_sighandler -u -t prio -t pid
1
UST context prio added to event ust_tests_hello:tptest_sighandle channel mychannel
UST context pid added to event sched_kthread_stop_ret channel mychannel
####################################################################
# Scenario: Test "lttng create with LTTng 2.1 options
####################################################################
CreateSessionLttng2.1
lttng --mi xml create mysession -U net://172.0.0.1
0
create
mysession
tcp4://172.0.0.1:5342/mysession-20140813-095804 [data: 5343]
false
0
0
true
lttng --mi xml create mysession -U file:///tmp
0
create
mysession
/tmp
false
0
0
true
lttng --mi xml create mysession -C tcp://172.0.0.1 -D tcp://172.0.0.1:5343
0
create
mysession
tcp4://172.0.0.1:5342/ [data: 5343]
false
0
0
true
lttng --mi xml create mysession -U 172.0.0.1:1234:2345
0
create
mysession
tcp4://172.0.0.1:1234/mysession-20140813-102225 [data: 2345]
false
0
0
true
lttng --mi xml destroy mysession
0
destroy
mysession
/home/user/lttng-traces/mysession-20140818-100114
false
0
0
true
lttng --mi xml -vvv create mysession -U net://172.0.0.1
0
DEBUG3: URI string: net://172.0.0.1 [in uri_parse() at uri.c:253]
DEBUG2: IP address resolved to 172.0.0.1 [in set_ip_address() at uri.c:132]
DEBUG3: URI dtype: 1, proto: 1, host: 172.0.0.1, subdir: , ctrl: 0, data: 0 [in uri_parse() at uri.c:467]
DEBUG1: LSM cmd type : 8 [in send_session_msg() at lttng-ctl.c:261]
Session mysession created.
Traces will be written in net://172.0.0.1
DEBUG1: Init config session in /home/bernd [in config_init() at conf.c:294]
####################################################################
# Scenario: Test "lttng create --snapshot (LTTng 2.3)
####################################################################
CreateSessionSnapshot
lttng --mi xml create mysession --snapshot
0
create
mysession
false
1
4294967295
true
#------------------------------------------------------------------------------
lttng --mi xml snapshot list-output -s mysession
0
snapshot
list-output
mysession
1
snapshot-1
/home/user/lttng-traces/mysession-20130913-141651
0
true
#------------------------------------------------------------------------------
lttng --mi xml list
0
list
mysession
false
1
4294967295
#------------------------------------------------------------------------------
lttng --mi xml snapshot record -s mysession
0
Snapshot recorded successfully for session mysession
#------------------------------------------------------------------------------
lttng --mi xml destroy mysession
0
destroy
mysession
/home/user/lttng-traces/mysession-20140818-100114
false
0
0
true
####################################################################
# Scenario: Test "lttng create --snapshot -U (LTTng 2.3)
####################################################################
CreateSessionStreamedSnapshot
lttng --mi xml create mysession --snapshot -U net://172.0.0.1
0
Session mysession created.
Default snapshot output set to: net://172.0.0.1
Snapshot mode set. Every channel enabled for that session will be set in overwrite mode and mmap output.
#------------------------------------------------------------------------------
lttng --mi xml snapshot list-output -s mysession
0
Snapshot output list for session mysession
[2] snapshot-2: net4://172.0.0.1:5342/
#------------------------------------------------------------------------------
lttng --mi xml list
0
1) mysession () [inactive snapshot]
#------------------------------------------------------------------------------
lttng --mi xml snapshot record -s mysession
0
Snapshot recorded successfully for session mysession
#------------------------------------------------------------------------------
lttng --mi xml destroy mysession
0
destroy
mysession
/home/user/lttng-traces/mysession-20140818-100114
false
0
0
true
####################################################################
# Scenario: Test "lttng create --snapshot (LTTng 2.3)
####################################################################
CreateSessionSnapshotErrors
lttng --mi xml snapshot list-output -s blabla
1
snapshot
list-output
false
#------------------------------------------------------------------------------
#next is not an error case but good to be tested
lttng --mi xml list
0
list
mysession
true
1
4294967295
#------------------------------------------------------------------------------
lttng --mi xml snapshot record -s blabla
1
Error: Session name not found
snapshot
record
false
#------------------------------------------------------------------------------
lttng --mi xml snapshot record -s mysession
1
Error: Session needs to be started once
snapshot
record
false
####################################################################
# Scenario: Test "lttng create --live [USEC] (LTTng 2.4)
####################################################################
CreateSessionLive
lttng --mi xml create mysession --live -U net://127.0.0.1
0
create
mysession
tcp4://127.0.0.1:5342/ [data: 5343]
false
0
1000000
true
#------------------------------------------------------------------------------
lttng --mi xml list
0
list
mysession
tcp4://127.0.0.1:5342/ [data: 5343]
false
0
1000000
#------------------------------------------------------------------------------
lttng --mi xml destroy mysession
0
destroy
mysession
/home/user/lttng-traces/mysession-20140818-100114
false
0
0
true
####################################################################
# Scenario: Test errors for "lttng create --live [USEC] (LTTng 2.4)
####################################################################
CreateSessionLiveErrors
lttng --mi xml create mysession --live --snapshot
1
Error: Snapshot and live modes are mutually exclusive.
Error: Command error
#------------------------------------------------------------------------------
lttng --mi xml create mysession --live -U blah
1
Error: URI parse unknown protocol blah
Error: Unable to parse the URL blah
Error: Invalid parameter
#------------------------------------------------------------------------------
lttng --mi xml create mysession --live -C net://127.0.0.1
1
Error: You need both control and data URL.
Error: Command error
####################################################################
# Scenario: Test "lttng list (version 2.6.0, syscalls)
####################################################################
GetSessionWithSyscalls
lttng --mi xml list mysession
0
list
mysession
/home/user/lttng-traces/mysession-20120129-084256
false0
0
KERNEL
PER_PID
channel0
true
DISCARD
262144
4
0
200
SPLICE
0
0
0
read
SYSCALL
true
write
SYSCALL
true
ListSession2.7Compat
lttng --mi xml list mysession
0
list
mysession
/home/user/lttng-traces/mysession-20151020-085614
false
0
0
KERNEL
GLOBAL
channel0
true
DISCARD
262144
4
0
200000
SPLICE
0
0
0
*
SYSCALL
true
*
TRACEPOINT
true
TRACE_EMERG
ALL
UST
PER_PID
channel0
true
DISCARD
4096
4
0
0
MMAP
0
0
0
*
TRACEPOINT
true
####################################################################
# Scenario: Test "lttng load [OPTIONS] [SESSION]"
# "lttng save [OPTIONS] [SESSION]"
# (LTTng 2.5)
####################################################################
SessionProfile
lttng --mi xml load -i /home/user/.lttng/sessions/mysession.lttng
0
load*.lttng/sessions/seqSession2.lttngtrue
SessionProfile
lttng --mi xml load -i /home/user/.lttng/sessions/mysession.lttng -f
0
load*.lttng/sessions/seqSession2.lttngtrue
lttng --mi xml save
0
save*true
lttng --mi xml save mysession
0
saveseqSession2true
lttng --mi xml save -f mysession
0
saveseqSession2true
lttng --mi xml save -o /tmp/test -f mysession
0
saveseqSession2true