####################################################################
# Copyright (c) 2012, 2015 Ericsson
#
# All rights reserved. This program and the accompanying materials are
# made available under the terms of the Eclipse Public License 2.0 which
# accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
#    Bernd Hufmann - Initial API and implementation
#	 Bruno Roy - Added new test cases
####################################################################
####################################################################
# Scenario: Test lttng not installed
####################################################################
<SCENARIO>
LttngNotInstalled
<COMMAND_INPUT>
lttng list
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<COMMAND_ERROR_OUTPUT>
Command not found
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test lttng version
####################################################################
<SCENARIO>
LttngVersion
<COMMAND_INPUT>
lttng version
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
lttng version 2.1.0 - Basse Messe
Web site: http://lttng.org/

lttng is free software and under the GPL license and part LGPL
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test lttng version
# output with prompt
####################################################################
<SCENARIO>
LttngVersionWithPrompt
<COMMAND_INPUT>
lttng version
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Prompt> lttng version 2.0.0 - Annedd'ale
Web site: http://lttng.org/

lttng is free software and under the GPL license and part LGPL
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test lttng version (unsupported version)
####################################################################
<SCENARIO>
LttngUnsupportedVersion
<COMMAND_INPUT>
lttng version
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
lttng version 200.0.0 - Annedd'ale
Web site: http://lttng.org/

lttng is free software and under the GPL license and part LGPL
</COMMAND_OUTPUT>
</SCENARIO>


####################################################################
# Scenario: Test lttng version (noversion)
####################################################################
<SCENARIO>
LttngNoVersion
<COMMAND_INPUT>
lttng version
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Web site: http://lttng.org/

lttng is free software and under the GPL license and part LGPL
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test lttng version (compiled from source)
####################################################################
<SCENARIO>
LttngVersionCompiled
<COMMAND_INPUT>
lttng version
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
lttng version heads/stable-2.5-0-g3910e60 - Fumisterie

The Fumisterie is a beer whose style is at the confluence of English and German ales. On the palate, it is full-bodied, malty and slightly caramelized. The organic hemp seeds incorporated during the brewing gives it a unique and original taste. The hop flavour comes through delicately in the after taste.

Web site: http://lttng.org

lttng is free software and under the GPL license and part LGPL
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test no sessions available
####################################################################
<SCENARIO>
NoSessionAvailable
<COMMAND_INPUT>
lttng list
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Currently no available tracing session
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test get sessions
####################################################################
<SCENARIO>
GetSessionNames1
<COMMAND_INPUT>
lttng list
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Available tracing sessions:
  1) mysession1 (/home/user/lttng-traces/mysession1-20120123-083928) [inactive]
  2) mysession (/home/user/lttng-traces/mysession-20120123-083318) [inactive]

 Use lttng list <session_name> for more details
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test get sessions with tracing group
####################################################################
<SCENARIO>
GetSessionWithTracingGroup
<COMMAND_INPUT>
lttng -g group list
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Available tracing sessions:
  1) mysession1 (/home/user/lttng-traces/mysession1-20120123-083928) [inactive]
  2) mysession (/home/user/lttng-traces/mysession-20120123-083318) [inactive]

 Use lttng list <session_name> for more details
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test lttng list <name> where session doesn't exist
####################################################################
<SCENARIO>
GetSessionNameNotExist
<COMMAND_INPUT>
lttng list test
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session test not found
<COMMAND_ERROR_OUTPUT>
Error: Session name not found
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test lttng -vvv list <name> where session doesn't exist
####################################################################
<SCENARIO>
GetSessionNameNotExistVerbose
<COMMAND_INPUT>
lttng -vvv list test
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
DEBUG2: Session name: test [in cmd_list() at commands/list.c:618]
DEBUG1: Session count 1 [in list_sessions() at commands/list.c:485]
<COMMAND_ERROR_OUTPUT>
Error: Session 'test' not found
Error: Command error
</COMMAND_ERROR_OUTPUT>
DEBUG1: Clean exit [in clean_exit() at lttng.c:165]
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test lttng list with garbage output
####################################################################
<SCENARIO>
GetSessionGarbageOut
<COMMAND_INPUT>
lttng list
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
asdfaereafsdcv 12333456434&*89**(())(^%$*
@#$%^&*()@#$%^&*()0834523094578kj;djkfs
a;sdf094v5u dsafj;sd9
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test lttng list <name> with sample outputs
####################################################################
<SCENARIO>
GetSession1
<COMMAND_INPUT>
lttng list mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Tracing session mysession: [active]
    Trace path: /home/user/lttng-traces/mysession-20120129-084256

=== Domain: Kernel ===

Channels:
-------------
- channel0: [enabled]

    Attributes:
      overwrite mode: 0
      subbufers size: 262144
      number of subbufers: 4
      switch timer interval: 0
      read timer interval: 200
      output: splice()

    Events:
      block_rq_remap (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
      block_bio_remap (loglevel: TRACE_EMERG (0)) (type: tracepoint) [disabled]

- channel1: [disabled]

    Attributes:
      overwrite mode: 1
      subbufers size: 524288
      number of subbufers: 4
      switch timer interval: 100
      read timer interval: 400
      output: splice()

    Events:
      None

=== Domain: UST global ===

Channels:
-------------
- mychannel1: [disabled]

    Attributes:
     overwrite mode: 1
     subbufers size: 8192
      number of subbufers: 8
      switch timer interval: 200
      read timer interval: 100
      output: mmap()

    Events:
      None

- channel0: [enabled]

    Attributes:
      overwrite mode: 0
      subbufers size: 4096
      number of subbufers: 4
      switch timer interval: 0
      read timer interval: 200
      output: mmap()

    Events:
      ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_LINE (13)) (type: tracepoint) [disabled]
      * (type: tracepoint) [enabled]

</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng list mysession1
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Tracing session mysession1: [inactive]
    Trace path: /home/user/lttng-traces/mysession1-20120203-133225

</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test lttng list <name> (with live time interval)
####################################################################
<SCENARIO>
GetSessionWithLiveInterval
<COMMAND_INPUT>
lttng list mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Tracing session mysession: [inactive snapshot]
    Trace path: 
    Live timer interval (usec): 4294967295

</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng snapshot list-output -s mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Snapshot output list for session mysession
    [1] snapshot-1: /home/user/lttng-traces/mysession-20120129-084256 (max-size: 0)
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng list mysession1
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Tracing session mysession1: [active]
    Trace path: /home/user/lttng-traces/mysession1-20120129-084256
    Live timer interval (usec): 0

</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng list mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Tracing session mysession2: [inactive]
    Trace path: tcp4://172.0.0.1:5342/ [data: 5343]
    Live timer interval (usec): 1000000

</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng list -k" with sample output
####################################################################
<SCENARIO>
GetKernelProvider1
<COMMAND_INPUT>
lttng list -k
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Kernel events
-------------
      sched_kthread_stop (loglevel: TRACE_EMERG (0)) (type: tracepoint)
      sched_kthread_stop_ret (loglevel: TRACE_EMERG (0)) (type: tracepoint)
      sched_wakeup_new (loglevel: TRACE_EMERG (0)) (type: tracepoint)

</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng list -k" with no kernel and no session daemon
####################################################################
<SCENARIO>
ListWithNoKernel1
<COMMAND_INPUT>
lttng list -k
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Spawning session daemon
<COMMAND_ERROR_OUTPUT>
Error: Unable to list kernel events
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng list -k" with no kernel and with session daemon
####################################################################
<SCENARIO>
ListWithNoKernel2
<COMMAND_INPUT>
lttng list -k
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<COMMAND_ERROR_OUTPUT>
Error: Unable to list kernel events
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng list -k" with no kernel, with session daemon and verbose
####################################################################
<SCENARIO>
ListWithNoKernelVerbose
<COMMAND_INPUT>
lttng -vvv list -k
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
DEBUG2: Session name: (null) [in cmd_list() at commands/list.c:618]
DEBUG1: Getting kernel tracing events [in list_kernel_events() at commands/list.c:309]
<COMMAND_ERROR_OUTPUT>
Error: Unable to list kernel events
</COMMAND_ERROR_OUTPUT>
DEBUG1: Clean exit [in clean_exit() at lttng.c:165]
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng list -u" with sample output
####################################################################
<SCENARIO>
GetUstProvider1
<COMMAND_INPUT>
lttng list -u
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST events:
-------------

PID: 9379 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
    ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_MODULE (10)) (type: tracepoint)
    ust_tests_hello:tptest (loglevel: TRACE_INFO (6)) (type: tracepoint)

PID: 4852 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
    ust_tests_hello:tptest_sighandler (loglevel: TRACE_WARNING (4)) (type: tracepoint)
    ust_tests_hello:tptest (loglevel: TRACE_DEBUG_FUNCTION (12)) (type: tracepoint)

</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng list -u" with no UST provider available
####################################################################
<SCENARIO>
GetUstProvider2
<COMMAND_INPUT>
lttng list -u
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST events:
-------------
None

</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng list -u" with no UST available (LTTng 2.0.x)
####################################################################
<SCENARIO>
ListWithNoUst1
<COMMAND_INPUT>
lttng list -u
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST events:
-------------
None
Segmentation Fault
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng list -u" with no UST available and no session daemon
####################################################################
<SCENARIO>
ListWithNoUst2
<COMMAND_INPUT>
lttng list -u -f
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Spawning a session daemon
<COMMAND_ERROR_OUTPUT>
Error: Unable to list UST events: Listing UST events failed
Error: Command Error
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng list -u" with no ust and with session daemon
####################################################################
<SCENARIO>
ListWithNoUst3
<COMMAND_INPUT>
lttng list -u -f
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<COMMAND_ERROR_OUTPUT>
Error: Unable to list UST events: Listing UST events failed
Error: Command Error
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng list -u" with no kernel, with session daemon and verbose
####################################################################
<SCENARIO>
ListWithNoUstVerbose
<COMMAND_INPUT>
lttng -vvv list -u -f
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
DEBUG2: Session name: (null) [in cmd_list() at commands/list.c:618]
DEBUG1: Getting kernel tracing events [in list_kernel_events() at commands/list.c:309]
Spawning a session daemon
<COMMAND_ERROR_OUTPUT>
Error: Unable to list UST events: Listing UST events failed
Error: Command Error
</COMMAND_ERROR_OUTPUT>
DEBUG1: Clean exit [in clean_exit() at lttng.c:165]
</COMMAND_OUTPUT>
</SCENARIO>


####################################################################
# Scenario: Test "lttng list -u -f" with sample output (version 2.1.0)
####################################################################
<SCENARIO>
GetUstProvider3
<COMMAND_INPUT>
lttng list -u -f
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST events:
-------------

PID: 9379 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
    ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_MODULE (10)) (type: tracepoint)
    ust_tests_hello:tptest (loglevel: TRACE_INFO (6)) (type: tracepoint)
        field: doublefield (float)
        field: floatfield (float)
        field: stringfield (string)

PID: 4852 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
    ust_tests_hello:tptest_sighandler (loglevel: TRACE_WARNING (4)) (type: tracepoint)
    ust_tests_hello:tptest (loglevel: TRACE_DEBUG_FUNCTION (12)) (type: tracepoint)
        field: doublefield (float)
        field: floatfield (float)
        field: stringfield (string)

</COMMAND_OUTPUT>
</SCENARIO>


####################################################################
# Scenario: Test "lttng create <session>
####################################################################
<SCENARIO>
CreateSession1
<COMMAND_INPUT>
lttng create mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession2 created.
Traces will be written in /home/user/lttng-traces/mysession2-20120209-095418
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng create <session>
####################################################################
<SCENARIO>
CreateSessionWithPrompt
<COMMAND_INPUT>
lttng create mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Prompt> Session mysession2 created.
Traces will be written in /home/user/lttng-traces/mysession2-20120209-095418
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng create <session> with different variants
# and errors
####################################################################
<SCENARIO>
CreateSessionVariants
<COMMAND_INPUT>
lttng create alreadyExist
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<COMMAND_ERROR_OUTPUT>
Error: Session name already exist
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng create session with spaces
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session session with spaces created.
Traces will be written in /home/user/lttng-traces/session with spaces-20120209-095418
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng create wrongName
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session auto created.
Traces will be written in /home/user/lttng-traces/auto-20120209-095418
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng create wrongPath -o /home/user/hallo
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session wrongPath created.
Traces will be written in /home/user/lttng-traces/wrongPath-20120209-095418
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng create pathWithSpaces -o /home/user/hallo user/here
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session pathWithSpaces created.
Traces will be written in /home/user/hallo user/here/pathWithSpaces-20120209-095418
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng destroy <session>
####################################################################

<SCENARIO>
DestroySession1
<COMMAND_INPUT>
lttng destroy mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession2 destroyed.
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng -vvv destroy <session>"
####################################################################

<SCENARIO>
DestroySessionVerbose
<COMMAND_INPUT>
lttng -vvv destroy mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
DEBUG2: Config file path found: /home/eedbhu [in get_session_name() at utils.c:98]
DEBUG1: Session name found: mysession2 [in get_session_name() at utils.c:99]
Session mysession2 destroyed at /home/eedbhu
</COMMAND_OUTPUT>
</SCENARIO>


####################################################################
# Scenario: Test "lttng enable-channel ..." with different inputs
####################################################################

<SCENARIO>
ChannelHandling
<COMMAND_INPUT>
lttng enable-channel mychannel0,mychannel1 -k -s mysession2 --overwrite --subbuf-size 16384 --num-subbuf 2 --switch-timer 200 --read-timer 100 -C 0 -W 10
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Kernel channel mychannel0 enabled for session mysession2
Kernel channel mychannel1 enabled for session mysession2
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-channel mychannel0,mychannel1 -k -s mysession2 --overwrite --subbuf-size 16384 --num-subbuf 2 --switch-timer 200 --read-timer 100
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Kernel channel mychannel0 enabled for session mysession2
Kernel channel mychannel1 enabled for session mysession2
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-channel ustChannel -u -s mysession2 --overwrite --subbuf-size 32768 --num-subbuf 1 --switch-timer 100 --read-timer 200 -C 0 -W 20
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST channel channel0 enabled for session mysession2
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-channel ustChannel -u -s mysession2 --overwrite --subbuf-size 32768 --num-subbuf 1 --switch-timer 100 --read-timer 200
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST channel channel0 enabled for session mysession2
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng 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
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST channel channel0 enabled for session mysession2
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-channel ustChannel -u -s mysession2 --overwrite --buffers-pid
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST channel ustChannel enabled for session mysession2
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-channel ustChannel -u -s mysession2 --overwrite --subbuf-size 32768 --num-subbuf 1 --switch-timer 100 --read-timer 200 --buffers-uid
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST channel channel0 enabled for session mysession2
</COMMAND_OUTPUT>


<COMMAND_INPUT>
lttng enable-channel mychannel0,mychannel1 -k -s mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Kernel channel mychannel0 enabled for session mysession2
Kernel channel mychannel1 enabled for session mysession2
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-channel ustChannel -u -s mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST channel mychannel0 enabled for session mysession2
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng disable-channel mychannel0,mychannel1 -k -s mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Kernel channel mychannel0 disabled for session mysession2
Kernel channel mychannel1 disabled for session mysession2
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng disable-channel ustChannel -u -s mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST channel mychannel0 enabled for session mysession2
</COMMAND_OUTPUT>
</SCENARIO>


####################################################################
# Scenario: Test "lttng enable-events ..." with different inputs
####################################################################
<SCENARIO>
EventHandling

# Tracepoint test cases

<COMMAND_INPUT>
lttng enable-event block_rq_remap,block_bio_remap,softirq_entry -k -s mysession2 --tracepoint
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
kernel event block_rq_remap created in channel channel0
kernel event block_bio_remap created in channel channel0
kernel event softirq_entry created in channel channel0
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-event -a -k -s mysession2 -c mychannel --tracepoint
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
All kernel tracepoints are enabled in channel channel0
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-event ust_tests_hello:tptest_sighandler -u -s mysession2 -c mychannel --tracepoint
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST event ust_tests_hello:tptest_sighandler created in channel mychannel
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-event ust_tests_hello:tptest_sighandler -u -s mysession2 -c mychannel --tracepoint --filter intfield==10
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST event ust_tests_hello:tptest_sighandler created in channel mychannel
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-event -a -u -s mysession2 -c mychannel --tracepoint
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
All UST tracepoints are enabled in channel mychannel
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-event -a -u -s mysession2 -c mychannel --tracepoint --exclude ust_tests_hello:tptest_sighandler
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
All UST events excluding ust_tests_hello:tptest_sighandler are enabled in channel mychannel
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-event -a -u -s mysession2 -c mychannel --tracepoint --exclude ust_tests_hello:tptest_sighandler,ust_tests_bye:tptest_sighandler
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
All UST events excluding ust_tests_hello:tptest_sighandler,ust_tests_bye:tptest_sighandler are enabled in channel mychannel
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-event ust* -u -s mysession2 -c mychannel --tracepoint --exclude ust_tests_hello:tptest_sighandler,ust_tests_bye:tptest_sighandler
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST event ust* excluding ust_tests_hello:tptest_sighandler,ust_tests_bye:tptest_sighandler created in channel mychannel
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-event ust* -u -s mysession2 -c mychannel --tracepoint --filter ust=="Challenger" --exclude ust_tests_hello:tptest_sighandler,ust_tests_bye:tptest_sighandler
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Event ust* excluding ust_tests_hello:tptest_sighandler,ust_tests_bye:tptest_sighandler: Filter 'ust==Challenger' successfully set
</COMMAND_OUTPUT>

# Syscall test cases

<COMMAND_INPUT>
lttng enable-event -a -k -s mysession2 --syscall
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
All kernel system calls are enabled in channel channel0
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-event -a -k -s mysession2 -c mychannel --syscall
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
All kernel system calls are enabled in channel mychannel
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-event close -k -s mysession2 -c mychannel --syscall
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Kernel event close created in channel mychannel
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-event close,read,write -k -s mysession2 -c mychannel --syscall
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Kernel event close created in channel mychannel
Kernel event read created in channel mychannel
Kernel event write created in channel mychannel
</COMMAND_OUTPUT>

# dynamic probe/function probe test cases

<COMMAND_INPUT>
lttng enable-event myevent0 -k -s mysession2 --function 0xc0101340
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
kernel event myevent0 created in channel mychannel
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-event myevent1 -k -s mysession2 -c mychannel --probe init_post
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
kernel event myevent1 created in channel mychannel
</COMMAND_OUTPUT>

# log level test cases

<COMMAND_INPUT>
lttng enable-event myevent4 -u -s mysession2 --loglevel-only TRACE_DEBUG
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST event myevent4 created in channel channel0
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-event myevent5 -u -s mysession2 -c mychannel --loglevel TRACE_DEBUG_FUNCTION
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST event myevent5 created in channel mychannel
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-event -a -k -s mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
All Kernel events are enabled in channel channel0
</COMMAND_OUTPUT>

</SCENARIO>

####################################################################
# Scenario: Test "lttng enable-events ..." with exclusion
####################################################################
<SCENARIO>
EventExcluded

<COMMAND_INPUT>
lttng enable-event ust* -u -s mysession2 -c mychannel --tracepoint --exclude ust_tests_hello:tptest_sighandler
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST event ust* excluding ust_tests_hello:tptest_sighandler created in channel mychannel
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng list mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Tracing session mysession2: [inactive]
    Trace path: /home/user/lttng-traces/mysession2-20160621-104942

=== Domain: UST global ===

Buffer type: per UID

Channels:
-------------
- mychannel: [enabled]

    Attributes:
      overwrite mode: 0
      subbufers size: 131072
      number of subbufers: 4
      switch timer interval: 0
      read timer interval: 0
      trace file count: 0
      trace file size (bytes): 0
      output: mmap()

    Events:
      ust* (type: tracepoint) [enabled] [has exclusions]

</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-event ust* -u -s mysession2 -c mychannel --tracepoint --exclude ust_tests_hello:tptest_sighandler,ust_tests_bye:tptest_sighandler
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST event ust* excluding ust_tests_hello:tptest_sighandler,ust_tests_bye:tptest_sighandler created in channel mychannel
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng list mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Tracing session mysession2: [inactive]
    Trace path: /home/user/lttng-traces/mysession2-20160621-104942

=== Domain: UST global ===

Buffer type: per UID

Channels:
-------------
- mychannel: [enabled]

    Attributes:
      overwrite mode: 0
      subbufers size: 131072
      number of subbufers: 4
      switch timer interval: 0
      read timer interval: 0
      trace file count: 0
      trace file size (bytes): 0
      output: mmap()

    Events:
      ust* (type: tracepoint) [enabled] [has exclusions]

</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng enable-event ust* -u -s mysession2 -c mychannel --tracepoint --filter ust=="Challenger" --exclude ust_tests_hello:tptest_sighandler,ust_tests_bye:tptest_sighandler
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Event ust* excluding ust_tests_hello:tptest_sighandler,ust_tests_bye:tptest_sighandler: Filter 'ust==Challenger' successfully set
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng list mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Tracing session mysession2: [inactive]
    Trace path: ${workspace}/lttng-traces/mysession2-20160630-135750

=== Domain: UST global ===

Buffer type: per UID

Channels:
-------------
- mychannel: [enabled]

    Attributes:
      overwrite mode: 0
      subbufers size: 131072
      number of subbufers: 4
      switch timer interval: 0
      read timer interval: 0
      trace file count: 0
      trace file size (bytes): 0
      output: mmap()

    Events:
      ust* (type: tracepoint) [enabled] [has exclusions] [with filter]

</COMMAND_OUTPUT>

</SCENARIO>

####################################################################
# Scenario: Test "lttng add-context -h" and lttng add-context ..." with different inputs
####################################################################

<SCENARIO>
ContextHandling

<COMMAND_INPUT>
lttng add-context -h
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
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

</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng add-context -s mysession2 -c mychannel -e ust_tests_hello:tptest_sighandler -u -t prio -t pid
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
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
</COMMAND_OUTPUT>
</SCENARIO>

<SCENARIO>
ContextErrorHandling

<COMMAND_INPUT>
lttng add-context -h
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
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

</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng add-context -s mysession2 -c mychannel -e ust_tests_hello:tptest_sighandler -u -t prio -t pid
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
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
</COMMAND_OUTPUT>

</SCENARIO>

####################################################################
# Scenario: Test "lttng create <session> with LTTng 2.1 options
####################################################################
<SCENARIO>
CreateSessionLttng2.1

<COMMAND_INPUT>
lttng create mysession -U net://172.0.0.1
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession created.
Traces will be written in net://172.0.0.1
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng create mysession -U file:///tmp
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession created.
Traces will be written in file:///tmp
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng create mysession -C tcp://172.0.0.1 -D tcp://172.0.0.1:5343
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession created.
Control URL tcp://172.0.0.1 set for session mysession
Data URL tcp://172.0.0.1:5343 set for session mysession
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng create mysession -U net://172.0.0.1:1234:2345
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession created.
Traces will be written in net://172.0.0.1:1234:2345
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng destroy mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession destroyed.
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng -vvv create mysession -U net://172.0.0.1
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
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]
</COMMAND_OUTPUT>

</SCENARIO>

####################################################################
# Scenario: Test "lttng -vvv create <session> with LTTng 2.1 options"
####################################################################
<SCENARIO>
CreateSessionLttngVerbose2.1
<COMMAND_INPUT>
lttng -vvv create mysession -U net://172.0.0.1
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
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]
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng -vvv destroy mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession destroyed.
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng create <session> --snapshot (LTTng 2.3)
####################################################################
<SCENARIO>
CreateSessionSnapshot
<COMMAND_INPUT>
lttng create mysession --snapshot
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession created.
Default snapshot output set to: /home/user/lttng-traces/mysession-20130913-141651
Snapshot mode set. Every channel enabled for that session will be set in overwrite mode and mmap output.
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng snapshot list-output -s mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Snapshot output list for session mysession
    [1] snapshot-1: /home/user/lttng-traces/mysession-20130913-141651
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng list
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
  1) mysession () [inactive snapshot]

</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng snapshot record -s mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
    Snapshot recorded successfully for session mysession
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng destroy mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession destroyed.
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng create <session> --snapshot -U <URL> (LTTng 2.3)
####################################################################
<SCENARIO>
CreateSessionStreamedSnapshot
<COMMAND_INPUT>
lttng create mysession --snapshot -U net://172.0.0.1
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
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.
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng snapshot list-output -s mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Snapshot output list for session mysession
    [2] snapshot-2: net4://172.0.0.1:5342/
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng list
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
  1) mysession () [inactive snapshot]

</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng snapshot record -s mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
    Snapshot recorded successfully for session mysession
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng destroy mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession destroyed.
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng create <session> --snapshot (LTTng 2.3)
####################################################################
<SCENARIO>
CreateSessionSnapshotErrors
<COMMAND_INPUT>
lttng snapshot list-output -s blabla
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<COMMAND_ERROR_OUTPUT>
Error: Session name not found
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
#next is not an error case but good to be tested
<COMMAND_INPUT>
lttng list
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
  1) mysession () [active snapshot]

</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng snapshot record -s blabla
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<COMMAND_ERROR_OUTPUT>
    Error: Session name not found
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng snapshot record -s mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<COMMAND_ERROR_OUTPUT>
    Error: Session needs to be started once
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>

</SCENARIO>

####################################################################
# Scenario: Test "lttng create <session> --live [USEC] (LTTng 2.4)
####################################################################
<SCENARIO>
CreateSessionLive
<COMMAND_INPUT>
lttng create mysession --live -U net://127.0.0.1
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession created.
Traces will be written in net://127.0.0.1
Live timer set to 1000000 usec
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng list
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Available tracing sessions:
  1) mysession (net4://127.0.0.1:5342/ [data: 5343]) [inactive]

Use lttng list <session_name> for more details
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng destroy mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession destroyed.
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test errors for  "lttng create <session> --live [USEC] (LTTng 2.4)
####################################################################
<SCENARIO>
CreateSessionLiveErrors
<COMMAND_INPUT>
lttng create mysession --live --snapshot
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<COMMAND_ERROR_OUTPUT>
Error: Snapshot and live modes are mutually exclusive.
Error: Command error
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng create mysession --live -U blah
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<COMMAND_ERROR_OUTPUT>
Error: URI parse unknown protocol blah
Error: Unable to parse the URL blah
Error: Invalid parameter
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng create mysession --live -C net://127.0.0.1
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<COMMAND_ERROR_OUTPUT>
Error: You need both control and data URL.
Error: Command error
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>
</SCENARIO>
####################################################################
# Scenario: Test "lttng create <session> --snapshot (LTTng 2.5)
####################################################################
<SCENARIO>
CreateSessionSnapshot2.5
<COMMAND_INPUT>
lttng create mysession --snapshot
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession created.
Default snapshot output set to: /home/user/lttng-traces/mysession-20130913-141651
Snapshot mode set. Every channel enabled for that session will be set in overwrite mode and mmap output.
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng snapshot list-output -s mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Snapshot output list for session mysession
    [1] snapshot-1: /home/user/lttng-traces/mysession-20130913-141651 (max-size: 0)
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng list
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
  1) mysession () [inactive snapshot]

</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng snapshot record -s mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
    Snapshot recorded successfully for session mysession
</COMMAND_OUTPUT>
#-----------------------------------------------------------------------------
<COMMAND_INPUT>
lttng destroy mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession destroyed.
</COMMAND_OUTPUT>

</SCENARIO>

####################################################################
# Scenario: Test "lttng load [OPTIONS] [SESSION]"
#                "lttng save [OPTIONS] [SESSION]"
# (LTTng 2.5)
####################################################################
<SCENARIO>
SessionProfile
<COMMAND_INPUT>
lttng load -i /home/user/.lttng/sessions/mysession.lttng
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
All sessions have been loaded successfully.
</COMMAND_OUTPUT>

<SCENARIO>
SessionProfile
<COMMAND_INPUT>
lttng load -i /home/user/.lttng/sessions/mysession.lttng -f
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
All sessions have been loaded successfully.
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng save
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
All sessions have been saved successfully.
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng save mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession saved successfully.
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng save -f mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession saved successfully.
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng save -o /tmp/test -f mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession saved successfully.
</COMMAND_OUTPUT>

</SCENARIO>

</SCENARIO>
