####################################################################
# Copyright (c) 2014, 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:
#    Jonathan Rajotte - Initial API and implementation
#    Bernd Hufmann - Added new test cases
#	 Bruno Roy - Added new test cases
####################################################################
####################################################################
# Scenario: Test lttng not installed
####################################################################
<SCENARIO>
LttngNotInstalled
<COMMAND_INPUT>
lttng --mi xml 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 --mi xml version
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>version</name>
  <output>
    <version>
      <string>2.5.0-rc2</string>
      <major>2</major>
      <minor>5</minor>
      <commit>v2.5.0-rc2-99-g234170a</commit>
      <patchLevel>0</patchLevel>
      <name>Fumisterie</name>
      <description>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.</description>
      <url>http://lttng.org</url>
      <license>lttng is free software and under the GPL license and part LGPL</license>
    </version>
  </output>
</command>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test no sessions available
####################################################################
<SCENARIO>
NoSessionAvailable
<COMMAND_INPUT>
lttng --mi xml list
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command><name>list</name><output><sessions/></output></command>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test get sessions
####################################################################
<SCENARIO>
GetSessionNames1
<COMMAND_INPUT>
lttng --mi xml list
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <sessions>
      <session>
        <name>mysession1</name>
        <path>home/user/lttng-traces/mysession1-20120123-083928</path>
        <enabled>false</enabled>
        <snapshot_mode>0</snapshot_mode>
        <live_timer_interval>0</live_timer_interval>
      </session>
      <session>
        <name>mysession</name>
        <path>home/user/lttng-traces/mysession-20120123-083318</path>
        <enabled>false</enabled>
        <snapshot_mode>0</snapshot_mode>
        <live_timer_interval>0</live_timer_interval>
      </session>
    </sessions>
  </output>
</command>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test get sessions with tracing group
####################################################################
<SCENARIO>
GetSessionWithTracingGroup
<COMMAND_INPUT>
lttng -g group --mi xml list
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <sessions>
      <session>
        <name>mysession1</name>
        <path>home/user/lttng-traces/mysession1-20120123-083928</path>
        <enabled>false</enabled>
        <snapshot_mode>0</snapshot_mode>
        <live_timer_interval>0</live_timer_interval>
      </session>
      <session>
        <name>mysession</name>
        <path>home/user/lttng-traces/mysession-20120123-083318</path>
        <enabled>false</enabled>
        <snapshot_mode>0</snapshot_mode>
        <live_timer_interval>0</live_timer_interval>
      </session>
    </sessions>
  </output>
</command>
</COMMAND_OUTPUT>
</SCENARIO>


####################################################################
# Scenario: Test lttng list <name> where session doesn't exist
####################################################################
<SCENARIO>
GetSessionNameNotExist
<COMMAND_INPUT>
lttng --mi xml list test
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command><name>list</name><output><sessions/></output></command>
<COMMAND_ERROR_OUTPUT>
Error: Session 'test' not found
Error: Command error
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test lttng -vvv list <name> where session doesn't exist
####################################################################
<SCENARIO>
GetSessionNameNotExistVerbose
<COMMAND_INPUT>
lttng --mi xml -vvv list test
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command><name>list</name><output><sessions/></output></command>
<COMMAND_ERROR_OUTPUT>
Error: Session 'test' not found
Error: Command error
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test lttng list with garbage output
####################################################################
<SCENARIO>
GetSessionGarbageOut
<COMMAND_INPUT>
lttng --mi xml 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 --mi xml list mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <sessions>
      <session>
        <name>mysession</name>
        <path>/home/user/lttng-traces/mysession-20120129-084256</path>
        <enabled>true</enabled>
        <snapshot_mode>0</snapshot_mode>
        <live_timer_interval>0</live_timer_interval>
        <domains>
          <domain>
            <type>KERNEL</type>
            <buffer_type>PER_PID</buffer_type>
            <channels>
              <channel>
                <name>channel0</name>
                <enabled>true</enabled>
                <attributes>
                  <overwrite_mode>DISCARD</overwrite_mode>
                  <subbuffer_size>262144</subbuffer_size>
                  <subbuffer_count>4</subbuffer_count>
                  <switch_timer_interval>0</switch_timer_interval>
                  <read_timer_interval>200</read_timer_interval>
                  <output_type>SPLICE</output_type>
                  <tracefile_size>0</tracefile_size>
                  <tracefile_count>0</tracefile_count>
                  <live_timer_interval>0</live_timer_interval>
                </attributes>
                <events>
                  <event>
                    <name>block_rq_remap</name>
                    <type>TRACEPOINT</type>
                    <enabled>true</enabled>
                    <filter>false</filter>
                    <loglevel>TRACE_EMERG</loglevel>
                    <loglevel_type>ALL</loglevel_type>
                    <exclusion>false</exclusion>
                  </event>
                  <event>
                    <name>block_bio_remap</name>
                    <type>TRACEPOINT</type>
                    <enabled>false</enabled>
                    <filter>false</filter>
                    <loglevel>TRACE_EMERG</loglevel>
                    <loglevel_type>ALL</loglevel_type>
                    <exclusion>false</exclusion>
                  </event>
                </events>
              </channel>
              <channel>
                <name>channel1</name>
                <enabled>false</enabled>
                <attributes>
                  <overwrite_mode>OVERWRITE</overwrite_mode>
                  <subbuffer_size>524288</subbuffer_size>
                  <subbuffer_count>4</subbuffer_count>
                  <switch_timer_interval>100</switch_timer_interval>
                  <read_timer_interval>400</read_timer_interval>
                  <output_type>SPLICE</output_type>
                  <tracefile_size>0</tracefile_size>
                  <tracefile_count>0</tracefile_count>
                  <live_timer_interval>4294967295</live_timer_interval>
                </attributes>
                <events/>
              </channel>
            </channels>
          </domain>
          <domain>
            <type>UST</type>
            <buffer_type>PER_UID</buffer_type>
            <channels>
              <channel>
                <name>mychannel1</name>
                <enabled>false</enabled>
                <attributes>
                  <overwrite_mode>OVERWRITE</overwrite_mode>
                  <subbuffer_size>8192</subbuffer_size>
                  <subbuffer_count>8</subbuffer_count>
                  <switch_timer_interval>200</switch_timer_interval>
                  <read_timer_interval>100</read_timer_interval>
                  <output_type>MMAP</output_type>
                  <tracefile_size>0</tracefile_size>
                  <tracefile_count>0</tracefile_count>
                  <live_timer_interval>0</live_timer_interval>
                </attributes>
                <events/>
              </channel>
              <channel>
                <name>channel0</name>
                <enabled>true</enabled>
                <attributes>
                  <overwrite_mode>DISCARD</overwrite_mode>
                  <subbuffer_size>4096</subbuffer_size>
                  <subbuffer_count>4</subbuffer_count>
                  <switch_timer_interval>0</switch_timer_interval>
                  <read_timer_interval>200</read_timer_interval>
                  <output_type>MMAP</output_type>
                  <tracefile_size>0</tracefile_size>
                  <tracefile_count>0</tracefile_count>
                  <live_timer_interval>0</live_timer_interval>
                </attributes>
                <events>
                  <event>
                    <name>ust_tests_hello:tptest_sighandler</name>
                    <type>TRACEPOINT</type>
                    <enabled>false</enabled>
                    <filter>false</filter>
                    <loglevel>TRACE_DEBUG_LINE</loglevel>
                    <loglevel_type>ALL</loglevel_type>
                    <exclusion>false</exclusion>
                  </event>
                  <event>
                    <name>*</name>
                    <type>TRACEPOINT</type>
                    <enabled>true</enabled>
                    <filter>false</filter>
                    <exclusion>false</exclusion>
                  </event>
                </events>
              </channel>
            </channels>
          </domain>
        </domains>
      </session>
    </sessions>
  </output>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml list mysession1
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <sessions>
      <session>
        <name>mysession1</name>
        <path>/home/user/lttng-traces/mysession1-20120203-133225</path>
        <enabled>false</enabled>
        <snapshot_mode>0</snapshot_mode>
        <live_timer_interval>0</live_timer_interval>
        <domains/>
      </session>
    </sessions>
  </output>
</command>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test lttng list <name> (with live time interval)
####################################################################
<SCENARIO>
GetSessionWithLiveInterval
<COMMAND_INPUT>
lttng --mi xml list mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <sessions>
      <session>
        <name>mysession</name>
        <path>/home/user/lttng-traces/mysession-20120129-084256</path>
        <enabled>false</enabled>
        <snapshot_mode>1</snapshot_mode>
        <live_timer_interval>4294967295</live_timer_interval>
        <domains>
        </domains>
      </session>
    </sessions>
  </output>
</command>
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng --mi xml snapshot list-output -s mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>snapshot</name>
  <output>
    <snapshot_action>
      <name>list-output</name>
      <output>
        <session>
          <name>mysession</name>
          <snapshots>
            <snapshot>
              <id>1</id>
              <name>snapshot-1</name>
              <ctrl_url>/home/user/lttng-traces/mysession-20120129-084256</ctrl_url>
              <data_url/>
              <max_size>0</max_size>
            </snapshot>
          </snapshots>
        </session>
      </output>
    </snapshot_action>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng --mi xml list mysession1
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <sessions>
      <session>
        <name>mysession1</name>
        <path>/home/user/lttng-traces/mysession1-20120129-084256</path>
        <enabled>true</enabled>
        <snapshot_mode>0</snapshot_mode>
        <live_timer_interval>0</live_timer_interval>
        <domains/>
      </session>
    </sessions>
  </output>
</command>
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng --mi xml list mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <sessions>
      <session>
        <name>mysession2</name>
        <path>tcp4://172.0.0.1:5342/ [data: 5343]</path>
        <enabled>false</enabled>
        <snapshot_mode>0</snapshot_mode>
        <live_timer_interval>1000000</live_timer_interval>
        <domains/>
      </session>
    </sessions>
  </output>
</command>
</COMMAND_OUTPUT>

</SCENARIO>


####################################################################
# Scenario: Test "lttng list -k" with sample output
####################################################################
<SCENARIO>
GetKernelProvider1
<COMMAND_INPUT>
lttng --mi xml list -k
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <domains>
      <domain>
        <type>KERNEL</type>
        <buffer_type>PER_PID</buffer_type>
        <events>
          <event>
            <name>sched_kthread_stop</name>
            <type>TRACEPOINT</type>
            <enabled>true</enabled>
            <filter>false</filter>
            <loglevel>TRACE_EMERG</loglevel>
            <loglevel_type>ALL</loglevel_type>
            <exclusion>false</exclusion>
          </event>
          <event>
            <name>sched_kthread_stop_ret</name>
            <type>TRACEPOINT</type>
            <enabled>true</enabled>
            <filter>false</filter>
            <loglevel>TRACE_EMERG</loglevel>
            <loglevel_type>ALL</loglevel_type>
            <exclusion>false</exclusion>
          </event>
          <event>
            <name>sched_wakeup_new</name>
            <type>TRACEPOINT</type>
            <enabled>true</enabled>
            <filter>false</filter>
            <loglevel>TRACE_EMERG</loglevel>
            <loglevel_type>ALL</loglevel_type>
            <exclusion>false</exclusion>
          </event>
	</events>
      </domain>
    </domains>
  </output>
</command>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng list -k" with no kernel and no session daemon
####################################################################
<SCENARIO>
ListWithNoKernel1
<COMMAND_INPUT>
lttng --mi xml 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 --mi xml 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 -u" with sample output
####################################################################
<SCENARIO>
GetUstProvider1
<COMMAND_INPUT>
lttng --mi xml list -u -f
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <domains>
      <domain>
        <type>UST</type>
        <buffer_type>PER_PID</buffer_type>
        <pids>
          <pid>
            <id>9379</id>
            <name>/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello</name>
            <events>
              <event>
                <name>ust_tests_hello:tptest_sighandler</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>TRACE_DEBUG_MODULE</loglevel>
                <loglevel_type>ALL</loglevel_type>
                <exclusion>false</exclusion>
                <event_fields/>
              </event>
              <event>
                <name>ust_tests_hello:tptest</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>TRACE_INFO</loglevel>
                <loglevel_type>ALL</loglevel_type>
                <exclusion>false</exclusion>
                <event_fields>
                  <event_field>
                    <name>doublefield</name>
                    <type>FLOAT</type>
                    <nowrite>0</nowrite>
                  </event_field>
                  <event_field>
                    <name>floatfield</name>
                    <type>FLOAT</type>
                    <nowrite>0</nowrite>
                  </event_field>
                  <event_field>
                    <name>stringfield</name>
                    <type>STRING</type>
                    <nowrite>0</nowrite>
                  </event_field>
                </event_fields>
              </event>
            </events>
          </pid>
          <pid>
            <id>4852</id>
            <name>/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello</name>
            <events>
              <event>
                <name>ust_tests_hello:tptest_sighandler</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>TRACE_WARNING</loglevel>
                <loglevel_type>ALL</loglevel_type>
                <exclusion>false</exclusion>
                <event_fields/>
              </event>
              <event>
                <name>ust_tests_hello:tptest</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>TRACE_DEBUG_FUNCTION</loglevel>
                <loglevel_type>ALL</loglevel_type>
                <exclusion>false</exclusion>
                <event_fields>
                  <event_field>
                    <name>doublefield</name>
                    <type>FLOAT</type>
                    <nowrite>0</nowrite>
                  </event_field>
                  <event_field>
                    <name>floatfield</name>
                    <type>FLOAT</type>
                    <nowrite>0</nowrite>
                  </event_field>
                  <event_field>
                    <name>stringfield</name>
                    <type>STRING</type>
                    <nowrite>0</nowrite>
                  </event_field>
                </event_fields>
              </event>
            </events>
          </pid>
        </pids>
      </domain>
    </domains>
  </output>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml list -j
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
    <name>list</name>
    <output>
        <domains>
            <domain>
                <type>JUL</type>
                <buffer_type>PER_PID</buffer_type>
                <pids/>
            </domain>
        </domains>
    </output>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml list -l
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
    <name>list</name>
    <output>
        <domains>
            <domain>
                <type>LOG4J</type>
                <buffer_type>PER_PID</buffer_type>
                <pids>
                    <pid>
                        <id>18332</id>
                        <name>java</name>
                        <events>
                            <event>
                                <name>Test</name>
                                <type>TRACEPOINT</type>
                                <enabled>true</enabled>
                                <filter>false</filter>
                                <loglevel>UNKNOWN</loglevel>
                                <loglevel_type>ALL</loglevel_type>
                                <exclusion>false</exclusion>
                            </event>
                        </events>
                    </pid>
                </pids>
            </domain>
        </domains>
    </output>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml list -p
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <domains>
      <domain>
        <type>PYTHON</type>
        <buffer_type>PER_PID</buffer_type>
        <pids>
          <pid>
            <id>4940</id>
            <name>python3</name>
            <events>
              <event>
                <name>my-logger</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>PYTHON_NOTSET</loglevel>
                <loglevel_type>ALL</loglevel_type>
                <exclusion>false</exclusion>
              </event>
            </events>
          </pid>
        </pids>
      </domain>
    </domains>
  </output>
</command>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng list -u" with no UST provider available
####################################################################
<SCENARIO>
GetUstProvider2
<COMMAND_INPUT>
lttng --mi xml list -u -f
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <domains>
      <domain>
        <type>UST</type>
        <buffer_type>PER_PID</buffer_type>
        <pids/>
      </domain>
    </domains>
  </output>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml list -j
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
    <name>list</name>
    <output>
        <domains>
            <domain>
                <type>JUL</type>
                <buffer_type>PER_PID</buffer_type>
                <pids/>
            </domain>
        </domains>
    </output>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml list -l
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
    <name>list</name>
    <output>
        <domains>
            <domain>
                <type>LOG4J</type>
                <buffer_type>PER_PID</buffer_type>
                <pids>
                    <pid>
                        <id>18332</id>
                        <name>java</name>
                        <events>
                            <event>
                                <name>Test</name>
                                <type>TRACEPOINT</type>
                                <enabled>true</enabled>
                                <filter>false</filter>
                                <loglevel>UNKNOWN</loglevel>
                                <loglevel_type>ALL</loglevel_type>
                                <exclusion>false</exclusion>
                            </event>
                        </events>
                    </pid>
                </pids>
            </domain>
        </domains>
    </output>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml list -p
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <domains>
      <domain>
        <type>PYTHON</type>
        <buffer_type>PER_PID</buffer_type>
        <pids>
          <pid>
            <id>4940</id>
            <name>python3</name>
            <events>
              <event>
                <name>my-logger</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>PYTHON_NOTSET</loglevel>
                <loglevel_type>ALL</loglevel_type>
                <exclusion>false</exclusion>
              </event>
            </events>
          </pid>
        </pids>
      </domain>
    </domains>
  </output>
</command>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng list -u" with no UST available (LTTng 2.0.x)
####################################################################
<SCENARIO>
ListWithNoUst1
<COMMAND_INPUT>
lttng --mi xml list -u -f
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command><name>list</name><output/></command>
<COMMAND_ERROR_OUTPUT>
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
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>
</SCENARIO>
####################################################################
# Scenario: Test "lttng list -u" with no UST available and no session daemon
####################################################################
<SCENARIO>
ListWithNoUst2
<COMMAND_INPUT>
lttng --mi xml list -u -f
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command><name>list</name><output/></command>
<COMMAND_ERROR_OUTPUT>
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
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>
</SCENARIO>
####################################################################
# Scenario: Test "lttng list -" with no kernel and with session daemon
####################################################################
<SCENARIO>
ListWithNoUst3
<COMMAND_INPUT>
lttng --mi xml list -u -f
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command><name>list</name><output/></command>
<COMMAND_ERROR_OUTPUT>
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
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng list -u -f" with sample output (version 2.6.0)
####################################################################
<SCENARIO>
GetUstProvider3
<COMMAND_INPUT>
lttng --mi xml list -u -f
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <domains>
      <domain>
        <type>UST</type>
        <buffer_type>PER_PID</buffer_type>
        <pids>
          <pid>
            <id>9379</id>
            <name>/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello</name>
            <events>
              <event>
                <name>ust_tests_hello:tptest_sighandler</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>TRACE_DEBUG_MODULE</loglevel>
                <loglevel_type>ALL</loglevel_type>
                <exclusion>false</exclusion>
                <event_fields/>
              </event>
              <event>
                <name>ust_tests_hello:tptest</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>TRACE_INFO</loglevel>
                <loglevel_type>ALL</loglevel_type>
                <exclusion>false</exclusion>
                <event_fields>
                  <event_field>
                    <name>doublefield</name>
                    <type>FLOAT</type>
                    <nowrite>0</nowrite>
                  </event_field>
                  <event_field>
                    <name>floatfield</name>
                    <type>FLOAT</type>
                    <nowrite>0</nowrite>
                  </event_field>
                  <event_field>
                    <name>stringfield</name>
                    <type>STRING</type>
                    <nowrite>0</nowrite>
                  </event_field>
                </event_fields>
              </event>
            </events>
          </pid>
          <pid>
            <id>4852</id>
            <name>/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello</name>
            <events>
              <event>
                <name>ust_tests_hello:tptest_sighandler</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>TRACE_WARNING</loglevel>
                <loglevel_type>ALL</loglevel_type>
                <exclusion>false</exclusion>
                <event_fields/>
              </event>
              <event>
                <name>ust_tests_hello:tptest</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>TRACE_DEBUG_FUNCTION</loglevel>
                <loglevel_type>ALL</loglevel_type>
                <exclusion>false</exclusion>
                <event_fields>
                  <event_field>
                    <name>doublefield</name>
                    <type>FLOAT</type>
                    <nowrite>0</nowrite>
                  </event_field>
                  <event_field>
                    <name>floatfield</name>
                    <type>FLOAT</type>
                    <nowrite>0</nowrite>
                  </event_field>
                  <event_field>
                    <name>stringfield</name>
                    <type>STRING</type>
                    <nowrite>0</nowrite>
                  </event_field>
                </event_fields>
              </event>
            </events>
          </pid>
        </pids>
      </domain>
    </domains>
  </output>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml list -j
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
    <name>list</name>
    <output>
        <domains>
            <domain>
                <type>JUL</type>
                <buffer_type>PER_PID</buffer_type>
                <pids/>
            </domain>
        </domains>
    </output>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml list -l
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
    <name>list</name>
    <output>
        <domains>
            <domain>
                <type>LOG4J</type>
                <buffer_type>PER_PID</buffer_type>
                <pids>
                    <pid>
                        <id>18332</id>
                        <name>java</name>
                        <events>
                            <event>
                                <name>Test</name>
                                <type>TRACEPOINT</type>
                                <enabled>true</enabled>
                                <filter>false</filter>
                                <loglevel>UNKNOWN</loglevel>
                                <loglevel_type>ALL</loglevel_type>
                                <exclusion>false</exclusion>
                            </event>
                        </events>
                    </pid>
                </pids>
            </domain>
        </domains>
    </output>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml list -p
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <domains>
      <domain>
        <type>PYTHON</type>
        <buffer_type>PER_PID</buffer_type>
        <pids>
          <pid>
            <id>4940</id>
            <name>python3</name>
            <events>
              <event>
                <name>my-logger</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>PYTHON_NOTSET</loglevel>
                <loglevel_type>ALL</loglevel_type>
                <exclusion>false</exclusion>
              </event>
            </events>
          </pid>
        </pids>
      </domain>
    </domains>
  </output>
</command>
</COMMAND_OUTPUT>
</SCENARIO>
####################################################################
# Scenario: Test "lttng create <session>
####################################################################
<SCENARIO>
CreateSession1
<COMMAND_INPUT>
lttng --mi xml create mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>create</name>
  <output>
    <session>
      <name>mysession2</name>
      <path>/home/user/lttng-traces/mysession2-20120209-095418</path>
      <enabled>false</enabled>
      <snapshot_mode>0</snapshot_mode>
      <live_timer_interval>0</live_timer_interval>
    </session>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng create <session>
####################################################################
<SCENARIO>
CreateSessionWithPrompt
<COMMAND_INPUT>
lttng --mi xml 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 --mi xml create alreadyExist
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>create</name>
  <output/>
  <success>false</success>
</command>
<COMMAND_ERROR_OUTPUT>
Warning: Session mysession2 already exists
Error: Session name already exists
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml create session with spaces
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>create</name>
  <output>
    <session>
      <name>session with spaces</name>
      <path>/home/user/lttng-traces/session with spaces-20120209-095418</path>
      <enabled>false</enabled>
      <snapshot_mode>0</snapshot_mode>
      <live_timer_interval>0</live_timer_interval>
    </session>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml create wrongName
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>create</name>
  <output>
    <session>
      <name>auto</name>
      <path>/home/user/lttng-traces/auto-20120209-095418</path>
      <enabled>false</enabled>
      <snapshot_mode>0</snapshot_mode>
      <live_timer_interval>0</live_timer_interval>
    </session>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml create wrongPath -o /home/user/hallo
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>create</name>
  <output>
    <session>
      <name>wrongPath</name>
      <path>/home/user/lttng-traces/wrongPath-20120209-095418</path>
      <enabled>false</enabled>
      <snapshot_mode>0</snapshot_mode>
      <live_timer_interval>0</live_timer_interval>
    </session>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml create pathWithSpaces -o /home/user/hallo user/here
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>create</name>
  <output>
    <session>
      <name>pathWithSpaces</name>
      <path>/home/user/hallo user/here/pathWithSpaces-20120209-095418</path>
      <enabled>false</enabled>
      <snapshot_mode>0</snapshot_mode>
      <live_timer_interval>0</live_timer_interval>
    </session>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
</SCENARIO>

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

<SCENARIO>
DestroySession1
<COMMAND_INPUT>
lttng --mi xml destroy mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>destroy</name>
  <output>
    <sessions>
      <session>
        <name>mysession2</name>
        <path>/home/user/lttng-traces/mysession2-20140812-160632</path>
        <enabled>false</enabled>
        <snapshot_mode>0</snapshot_mode>
        <live_timer_interval>0</live_timer_interval>
      </session>
    </sessions>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
</SCENARIO>

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

<SCENARIO>
ChannelHandling
<COMMAND_INPUT>
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
</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 --mi xml 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>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-channel</name>
  <output>
    <channels>
      <channel>
        <name>mychannel0</name>
        <enabled>false</enabled>
        <attributes>
          <overwrite_mode>OVERWRITE</overwrite_mode>
          <subbuffer_size>16384</subbuffer_size>
          <subbuffer_count>2</subbuffer_count>
          <switch_timer_interval>200</switch_timer_interval>
          <read_timer_interval>100</read_timer_interval>
          <output_type>SPLICE</output_type>
          <tracefile_size>0</tracefile_size>
          <tracefile_count>0</tracefile_count>
          <live_timer_interval>4294967295</live_timer_interval>
        </attributes>
        <success>true</success>
      </channel>
      <channel>
        <name>mychannel1</name>
        <enabled>false</enabled>
        <attributes>
          <overwrite_mode>OVERWRITE</overwrite_mode>
          <subbuffer_size>16384</subbuffer_size>
          <subbuffer_count>2</subbuffer_count>
          <switch_timer_interval>200</switch_timer_interval>
          <read_timer_interval>100</read_timer_interval>
          <output_type>SPLICE</output_type>
          <tracefile_size>0</tracefile_size>
          <tracefile_count>0</tracefile_count>
          <live_timer_interval>4294967295</live_timer_interval>
        </attributes>
        <success>true</success>
      </channel>
    </channels>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

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

<COMMAND_INPUT>
lttng --mi xml 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>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-channel</name>
  <output>
    <channels>
      <channel>
        <name>ustChannel</name>
        <enabled>false</enabled>
        <attributes>
          <overwrite_mode>OVERWRITE</overwrite_mode>
          <subbuffer_size>32768</subbuffer_size>
          <subbuffer_count>2</subbuffer_count>
          <switch_timer_interval>100</switch_timer_interval>
          <read_timer_interval>200</read_timer_interval>
          <output_type>MMAP</output_type>
          <tracefile_size>0</tracefile_size>
          <tracefile_count>0</tracefile_count>
          <live_timer_interval>4294967295</live_timer_interval>
        </attributes>
        <success>true</success>
      </channel>
    </channels>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

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

<COMMAND_INPUT>
lttng --mi xml enable-channel ustChannel -u -s mysession2 --overwrite --buffers-pid
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-channel</name>
  <output>
    <channels>
      <channel>
        <name>ustChannel</name>
        <enabled>false</enabled>
        <attributes>
          <overwrite_mode>OVERWRITE</overwrite_mode>
          <subbuffer_size>4096</subbuffer_size>
          <subbuffer_count>4</subbuffer_count>
          <switch_timer_interval>0</switch_timer_interval>
          <read_timer_interval>0</read_timer_interval>
          <output_type>MMAP</output_type>
          <tracefile_size>0</tracefile_size>
          <tracefile_count>0</tracefile_count>
          <live_timer_interval>4294967295</live_timer_interval>
        </attributes>
        <success>true</success>
      </channel>
    </channels>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml enable-channel ustChannel -u -s mysession2 --overwrite --subbuf-size 32768 --num-subbuf 2 --switch-timer 100 --read-timer 200 --buffers-uid
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-channel</name>
  <output>
    <channels>
      <channel>
        <name>ustChannel</name>
        <enabled>false</enabled>
        <attributes>
          <overwrite_mode>OVERWRITE</overwrite_mode>
          <subbuffer_size>32768</subbuffer_size>
          <subbuffer_count>2</subbuffer_count>
          <switch_timer_interval>100</switch_timer_interval>
          <read_timer_interval>200</read_timer_interval>
          <output_type>MMAP</output_type>
          <tracefile_size>0</tracefile_size>
          <tracefile_count>0</tracefile_count>
          <live_timer_interval>4294967295</live_timer_interval>
        </attributes>
        <success>true</success>
      </channel>
    </channels>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>


<COMMAND_INPUT>
lttng --mi xml enable-channel mychannel0,mychannel1 -k -s mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-channel</name>
  <output>
    <channels>
      <channel>
        <name>mychannel0</name>
        <enabled>false</enabled>
        <attributes>
          <overwrite_mode>DISCARD</overwrite_mode>
          <subbuffer_size>262144</subbuffer_size>
          <subbuffer_count>4</subbuffer_count>
          <switch_timer_interval>0</switch_timer_interval>
          <read_timer_interval>200000</read_timer_interval>
          <output_type>SPLICE</output_type>
          <tracefile_size>0</tracefile_size>
          <tracefile_count>0</tracefile_count>
          <live_timer_interval>4294967295</live_timer_interval>
        </attributes>
        <success>true</success>
      </channel>
      <channel>
        <name>mychannel1</name>
        <enabled>false</enabled>
        <attributes>
          <overwrite_mode>DISCARD</overwrite_mode>
          <subbuffer_size>262144</subbuffer_size>
          <subbuffer_count>4</subbuffer_count>
          <switch_timer_interval>0</switch_timer_interval>
          <read_timer_interval>200000</read_timer_interval>
          <output_type>SPLICE</output_type>
          <tracefile_size>0</tracefile_size>
          <tracefile_count>0</tracefile_count>
          <live_timer_interval>4294967295</live_timer_interval>
        </attributes>
        <success>true</success>
      </channel>
    </channels>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml enable-channel ustChannel -u -s mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-channel</name>
  <output>
    <channels>
      <channel>
        <name>ustChannel</name>
        <enabled>false</enabled>
        <attributes>
          <overwrite_mode>DISCARD</overwrite_mode>
          <subbuffer_size>131072</subbuffer_size>
          <subbuffer_count>4</subbuffer_count>
          <switch_timer_interval>0</switch_timer_interval>
          <read_timer_interval>0</read_timer_interval>
          <output_type>MMAP</output_type>
          <tracefile_size>0</tracefile_size>
          <tracefile_count>0</tracefile_count>
          <live_timer_interval>4294967295</live_timer_interval>
        </attributes>
        <success>true</success>
      </channel>
    </channels>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml disable-channel mychannel0,mychannel1 -k -s mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>disable-channel</name>
  <output>
    <channels>
      <channel>
        <name>mychannel0</name>
        <enabled>false</enabled>
        <success>true</success>
      </channel>
      <channel>
        <name>mychannel1</name>
        <enabled>false</enabled>
        <success>true</success>
      </channel>
    </channels>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml disable-channel ustChannel -u -s mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>disable-channel</name>
  <output>
    <channels>
      <channel>
        <name>ustChannel</name>
        <enabled>false</enabled>
        <success>true</success>
      </channel>
    </channels>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
</SCENARIO>


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

# Tracepoint test cases

<COMMAND_INPUT>
lttng --mi xml enable-event block_rq_remap,block_bio_remap,softirq_entry -k -s mysession2 --tracepoint
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>block_rq_remap</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>TRACE_EMERG</loglevel>
        <loglevel_type>ALL</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
      <event>
        <name>block_bio_remap</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>TRACE_EMERG</loglevel>
        <loglevel_type>ALL</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
      <event>
        <name>softirq_entry</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>TRACE_EMERG</loglevel>
        <loglevel_type>ALL</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml enable-event -a -k -s mysession2 -c mychannel --tracepoint
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>*</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>TRACE_EMERG</loglevel>
        <loglevel_type>ALL</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml enable-event ust_tests_hello:tptest_sighandler -u -s mysession2 -c mychannel --tracepoint
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>ust_tests_hello:tptest_sighandler</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml 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>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>ust_tests_hello:tptest_sighandler</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>true</filter>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml enable-event -a -u -s mysession2 -c mychannel --tracepoint
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>*</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml enable-event -a -u -s mysession2 -c mychannel --tracepoint --exclude ust_tests_hello:tptest_sighandler
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
    <name>enable-event</name>
    <output>
        <events>
            <event>
                <name>*</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <exclusion>true</exclusion>
                <success>true</success>
            </event>
        </events>
    </output>
    <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml 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>
<?xml version="1.0" encoding="UTF-8"?>
<command>
    <name>enable-event</name>
    <output>
        <events>
            <event>
                <name>*</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <exclusion>true</exclusion>
                <success>true</success>
            </event>
        </events>
    </output>
    <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml 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>
<?xml version="1.0" encoding="UTF-8"?>
<command>
    <name>enable-event</name>
    <output>
        <events>
            <event>
                <name>ust*</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <exclusion>true</exclusion>
                <success>true</success>
            </event>
        </events>
    </output>
    <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml 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>
<?xml version="1.0" encoding="UTF-8"?>
<command>
    <name>enable-event</name>
    <output>
        <events>
            <event>
                <name>ust*</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>true</filter>
                <exclusion>true</exclusion>
                <success>true</success>
            </event>
        </events>
    </output>
    <success>true</success>
</command>
</COMMAND_OUTPUT>

# Syscall test cases

<COMMAND_INPUT>
lttng --mi xml enable-event -a -k -s mysession2 --syscall
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>*</name>
        <type>SYSCALL</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml enable-event -a -k -s mysession2 -c mychannel --syscall
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>*</name>
        <type>SYSCALL</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml enable-event close -k -s mysession2 -c mychannel --syscall
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>close</name>
        <type>SYSCALL</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml enable-event close,read,write -k -s mysession2 -c mychannel --syscall
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>close</name>
        <type>SYSCALL</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <success>true</success>
      </event>
      <event>
        <name>read</name>
        <type>SYSCALL</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <success>true</success>
      </event>
      <event>
        <name>write</name>
        <type>SYSCALL</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

# dynamic probe/function probe test cases

<COMMAND_INPUT>
lttng --mi xml enable-event myevent0 -k -s mysession2 --function 0xc0101340
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>myevent0</name>
        <type>FUNCTION</type>
        <enabled>false</enabled>
        <filter>false</filter>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml enable-event myevent1 -k -s mysession2 -c mychannel --probe init_post
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>myevent1</name>
        <type>PROBE</type>
        <enabled>false</enabled>
        <filter>false</filter>
        <offset>0</offset>
        <symbol_name>init_post</symbol_name>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>

</COMMAND_OUTPUT>

# log level test cases

<COMMAND_INPUT>
lttng --mi xml enable-event myevent4 -u -s mysession2 --loglevel-only TRACE_DEBUG
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>myevent4</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>TRACE_DEBUG</loglevel>
        <loglevel_type>SINGLE</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml enable-event myevent5 -u -s mysession2 -c mychannel --loglevel TRACE_DEBUG_FUNCTION
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>myevent5</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>TRACE_DEBUG_FUNCTION</loglevel>
        <loglevel_type>RANGE</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml enable-event -a -k -s mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>*</name>
        <type>ALL</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

</SCENARIO>

####################################################################
# Scenario: Test "lttng enable-events ..." with JUL loggers
####################################################################
<SCENARIO>
EnableJulLoggers

<COMMAND_INPUT>
lttng --mi xml enable-event -a -j -s mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>*</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>JUL_ALL</loglevel>
        <loglevel_type>ALL</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml enable-event logger -j -s mysession --tracepoint
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>logger</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>JUL_ALL</loglevel>
        <loglevel_type>ALL</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml enable-event logger,anotherLogger -j -s mysession --loglevel-only Warning
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>logger</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>JUL_WARNING</loglevel>
        <loglevel_type>SINGLE</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
      <event>
        <name>anotherLogger</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>JUL_WARNING</loglevel>
        <loglevel_type>SINGLE</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml list mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <sessions>
      <session>
        <name>mysession</name>
        <path>/home/user/lttng-traces/mysession-20160801-150625</path>
        <enabled>false</enabled>
        <snapshot_mode>0</snapshot_mode>
        <live_timer_interval>0</live_timer_interval>
        <domains>
          <domain>
            <type>UST</type>
            <buffer_type>PER_UID</buffer_type>
            <trackers />
            <channels>
              <channel>
                <name>lttng_jul_channel</name>
                <enabled>true</enabled>
                <attributes>
                  <overwrite_mode>DISCARD</overwrite_mode>
                  <subbuffer_size>131072</subbuffer_size>
                  <subbuffer_count>4</subbuffer_count>
                  <switch_timer_interval>0</switch_timer_interval>
                  <read_timer_interval>0</read_timer_interval>
                  <output_type>MMAP</output_type>
                  <tracefile_size>0</tracefile_size>
                  <tracefile_count>0</tracefile_count>
                  <live_timer_interval>0</live_timer_interval>
                </attributes>
                <events />
              </channel>
            </channels>
          </domain>
          <domain>
            <type>JUL</type>
            <buffer_type>PER_UID</buffer_type>
            <events>
              <event>
                <name>logger</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>JUL_WARNING</loglevel>
                <loglevel_type>SINGLE</loglevel_type>
                <exclusion>false</exclusion>
              </event>
              <event>
                <name>logger</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>JUL_ALL</loglevel>
                <loglevel_type>ALL</loglevel_type>
                <exclusion>false</exclusion>
              </event>
              <event>
                <name>*</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>JUL_ALL</loglevel>
                <loglevel_type>ALL</loglevel_type>
                <exclusion>false</exclusion>
              </event>
              <event>
                <name>anotherLogger</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>JUL_WARNING</loglevel>
                <loglevel_type>SINGLE</loglevel_type>
                <exclusion>false</exclusion>
              </event>
            </events>
          </domain>
        </domains>
      </session>
    </sessions>
  </output>
</command>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng enable-events ..." with LOG4J loggers
####################################################################
<SCENARIO>
EnableLog4jLoggers

<COMMAND_INPUT>
lttng --mi xml enable-event -a -l -s mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>*</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>LOG4J_ALL</loglevel>
        <loglevel_type>ALL</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml enable-event logger -l -s mysession --tracepoint
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>logger</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>LOG4J_ALL</loglevel>
        <loglevel_type>ALL</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml enable-event logger,anotherLogger -l -s mysession --loglevel-only Fatal
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>logger</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>LOG4J_FATAL</loglevel>
        <loglevel_type>SINGLE</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
      <event>
        <name>anotherLogger</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>LOG4J_FATAL</loglevel>
        <loglevel_type>SINGLE</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml list mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <sessions>
      <session>
        <name>mysession</name>
        <path>/home/user/lttng-traces/mysession-20160808-130831</path>
        <enabled>false</enabled>
        <snapshot_mode>0</snapshot_mode>
        <live_timer_interval>0</live_timer_interval>
        <domains>
          <domain>
            <type>UST</type>
            <buffer_type>PER_UID</buffer_type>
            <trackers />
            <channels>
              <channel>
                <name>lttng_log4j_channel</name>
                <enabled>true</enabled>
                <attributes>
                  <overwrite_mode>DISCARD</overwrite_mode>
                  <subbuffer_size>131072</subbuffer_size>
                  <subbuffer_count>4</subbuffer_count>
                  <switch_timer_interval>0</switch_timer_interval>
                  <read_timer_interval>0</read_timer_interval>
                  <output_type>MMAP</output_type>
                  <tracefile_size>0</tracefile_size>
                  <tracefile_count>0</tracefile_count>
                  <live_timer_interval>0</live_timer_interval>
                </attributes>
                <events />
              </channel>
              <channel>
                <name>lttng_jul_channel</name>
                <enabled>true</enabled>
                <attributes>
                  <overwrite_mode>DISCARD</overwrite_mode>
                  <subbuffer_size>131072</subbuffer_size>
                  <subbuffer_count>4</subbuffer_count>
                  <switch_timer_interval>0</switch_timer_interval>
                  <read_timer_interval>0</read_timer_interval>
                  <output_type>MMAP</output_type>
                  <tracefile_size>0</tracefile_size>
                  <tracefile_count>0</tracefile_count>
                  <live_timer_interval>0</live_timer_interval>
                </attributes>
                <events />
              </channel>
            </channels>
          </domain>
          <domain>
            <type>LOG4J</type>
            <buffer_type>PER_UID</buffer_type>
            <events>
              <event>
                <name>*</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>LOG4J_ALL</loglevel>
                <loglevel_type>ALL</loglevel_type>
                <exclusion>false</exclusion>
              </event>
              <event>
                <name>logger</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>LOG4J_FATAL</loglevel>
                <loglevel_type>SINGLE</loglevel_type>
                <exclusion>false</exclusion>
              </event>
              <event>
                <name>logger</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>LOG4J_ALL</loglevel>
                <loglevel_type>ALL</loglevel_type>
                <exclusion>false</exclusion>
              </event>
              <event>
                <name>anotherLogger</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>LOG4J_FATAL</loglevel>
                <loglevel_type>SINGLE</loglevel_type>
                <exclusion>false</exclusion>
              </event>
            </events>
          </domain>
        </domains>
      </session>
    </sessions>
  </output>
</command>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng enable-events ..." with Python loggers
####################################################################
<SCENARIO>
EnablePythonLoggers

<COMMAND_INPUT>
lttng --mi xml enable-event -a -p -s mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>*</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>PYTHON_DEBUG</loglevel>
        <loglevel_type>ALL</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml enable-event logger -p -s mysession --tracepoint
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>logger</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>PYTHON_DEBUG</loglevel>
        <loglevel_type>ALL</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml enable-event logger,anotherLogger -p -s mysession --loglevel-only Critical
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>enable-event</name>
  <output>
    <events>
      <event>
        <name>logger</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>PYTHON_CRITICAL</loglevel>
        <loglevel_type>SINGLE</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
      <event>
        <name>anotherLogger</name>
        <type>TRACEPOINT</type>
        <enabled>true</enabled>
        <filter>false</filter>
        <loglevel>PYTHON_CRITICAL</loglevel>
        <loglevel_type>SINGLE</loglevel_type>
        <exclusion>false</exclusion>
        <success>true</success>
      </event>
    </events>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
<COMMAND_INPUT>
lttng --mi xml list mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <sessions>
      <session>
        <name>mysession</name>
        <path>/home/user/lttng-traces/mysession-20160811-113341</path>
        <enabled>false</enabled>
        <snapshot_mode>0</snapshot_mode>
        <live_timer_interval>0</live_timer_interval>
        <domains>
          <domain>
            <type>UST</type>
            <buffer_type>PER_UID</buffer_type>
            <trackers />
            <channels>
              <channel>
                <name>lttng_python_channel</name>
                <enabled>true</enabled>
                <attributes>
                  <overwrite_mode>DISCARD</overwrite_mode>
                  <subbuffer_size>131072</subbuffer_size>
                  <subbuffer_count>4</subbuffer_count>
                  <switch_timer_interval>0</switch_timer_interval>
                  <read_timer_interval>0</read_timer_interval>
                  <output_type>MMAP</output_type>
                  <tracefile_size>0</tracefile_size>
                  <tracefile_count>0</tracefile_count>
                  <live_timer_interval>0</live_timer_interval>
                </attributes>
                <events />
              </channel>
            </channels>
          </domain>
          <domain>
            <type>PYTHON</type>
            <buffer_type>PER_UID</buffer_type>
            <events>
              <event>
                <name>anotherLogger</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>PYTHON_CRITICAL</loglevel>
                <loglevel_type>SINGLE</loglevel_type>
                <exclusion>false</exclusion>
              </event>
              <event>
                <name>*</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>PYTHON_DEBUG</loglevel>
                <loglevel_type>ALL</loglevel_type>
                <exclusion>false</exclusion>
              </event>
              <event>
                <name>logger</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>PYTHON_CRITICAL</loglevel>
                <loglevel_type>SINGLE</loglevel_type>
                <exclusion>false</exclusion>
              </event>
              <event>
                <name>logger</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <loglevel>PYTHON_DEBUG</loglevel>
                <loglevel_type>ALL</loglevel_type>
                <exclusion>false</exclusion>
              </event>
            </events>
          </domain>
        </domains>
      </session>
    </sessions>
  </output>
</command>
</COMMAND_OUTPUT>
</SCENARIO>

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

<COMMAND_INPUT>
lttng --mi xml enable-event ust* -u -s mysession2 -c mychannel --tracepoint --exclude ust_tests_hello:tptest_sighandler
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
    <name>enable-event</name>
    <output>
        <events>
            <event>
                <name>ust*</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <exclusion>true</exclusion>
                <success>true</success>
            </event>
        </events>
    </output>
    <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml list mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
    <name>list</name>
    <output>
        <sessions>
            <session>
                <name>mysession2</name>
                <path>/home/user/lttng-traces/mysession2-20160621-125643</path>
                <enabled>false</enabled>
                <snapshot_mode>0</snapshot_mode>
                <live_timer_interval>0</live_timer_interval>
                <domains>
                    <domain>
                        <type>UST</type>
                        <buffer_type>PER_UID</buffer_type>
                        <trackers/>
                        <channels>
                            <channel>
                                <name>mychannel</name>
                                <enabled>true</enabled>
                                <attributes>
                                    <overwrite_mode>DISCARD</overwrite_mode>
                                    <subbuffer_size>131072</subbuffer_size>
                                    <subbuffer_count>4</subbuffer_count>
                                    <switch_timer_interval>0</switch_timer_interval>
                                    <read_timer_interval>0</read_timer_interval>
                                    <output_type>MMAP</output_type>
                                    <tracefile_size>0</tracefile_size>
                                    <tracefile_count>0</tracefile_count>
                                    <live_timer_interval>0</live_timer_interval>
                                </attributes>
                                <events>
                                    <event>
                                        <name>ust*</name>
                                        <type>TRACEPOINT</type>
                                        <enabled>true</enabled>
                                        <filter>false</filter>
                                        <exclusion>true</exclusion>
                                    </event>
                                </events>
                            </channel>
                        </channels>
                    </domain>
                </domains>
            </session>
        </sessions>
    </output>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml 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>
<?xml version="1.0" encoding="UTF-8"?>
<command>
    <name>enable-event</name>
    <output>
        <events>
            <event>
                <name>ust*</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>false</filter>
                <exclusion>true</exclusion>
                <success>true</success>
            </event>
        </events>
    </output>
    <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml list mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
    <name>list</name>
    <output>
        <sessions>
            <session>
                <name>mysession2</name>
                <path>/home/user/lttng-traces/mysession2-20160621-125933</path>
                <enabled>false</enabled>
                <snapshot_mode>0</snapshot_mode>
                <live_timer_interval>0</live_timer_interval>
                <domains>
                    <domain>
                        <type>UST</type>
                        <buffer_type>PER_UID</buffer_type>
                        <trackers/>
                        <channels>
                            <channel>
                                <name>mychannel</name>
                                <enabled>true</enabled>
                                <attributes>
                                    <overwrite_mode>DISCARD</overwrite_mode>
                                    <subbuffer_size>131072</subbuffer_size>
                                    <subbuffer_count>4</subbuffer_count>
                                    <switch_timer_interval>0</switch_timer_interval>
                                    <read_timer_interval>0</read_timer_interval>
                                    <output_type>MMAP</output_type>
                                    <tracefile_size>0</tracefile_size>
                                    <tracefile_count>0</tracefile_count>
                                    <live_timer_interval>0</live_timer_interval>
                                </attributes>
                                <events>
                                    <event>
                                        <name>ust*</name>
                                        <type>TRACEPOINT</type>
                                        <enabled>true</enabled>
                                        <filter>false</filter>
                                        <exclusion>true</exclusion>
                                    </event>
                                </events>
                            </channel>
                        </channels>
                    </domain>
                </domains>
            </session>
        </sessions>
    </output>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml 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>
<?xml version="1.0" encoding="UTF-8"?>
<command>
    <name>enable-event</name>
    <output>
        <events>
            <event>
                <name>ust*</name>
                <type>TRACEPOINT</type>
                <enabled>true</enabled>
                <filter>true</filter>
                <exclusion>true</exclusion>
                <success>true</success>
            </event>
        </events>
    </output>
    <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml list mysession2
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
    <name>list</name>
    <output>
        <sessions>
            <session>
                <name>mysession2</name>
                <path>/home/user/lttng-traces/mysession2-20160630-171241</path>
                <enabled>false</enabled>
                <snapshot_mode>0</snapshot_mode>
                <live_timer_interval>0</live_timer_interval>
                <domains>
                    <domain>
                        <type>UST</type>
                        <buffer_type>PER_UID</buffer_type>
                        <trackers/>
                        <channels>
                            <channel>
                                <name>mychannel</name>
                                <enabled>true</enabled>
                                <attributes>
                                    <overwrite_mode>DISCARD</overwrite_mode>
                                    <subbuffer_size>131072</subbuffer_size>
                                    <subbuffer_count>4</subbuffer_count>
                                    <switch_timer_interval>0</switch_timer_interval>
                                    <read_timer_interval>0</read_timer_interval>
                                    <output_type>MMAP</output_type>
                                    <tracefile_size>0</tracefile_size>
                                    <tracefile_count>0</tracefile_count>
                                    <live_timer_interval>0</live_timer_interval>
                                </attributes>
                                <events>
                                    <event>
                                        <name>ust*</name>
                                        <type>TRACEPOINT</type>
                                        <enabled>true</enabled>
                                        <filter>true</filter>
                                        <exclusion>true</exclusion>
                                    </event>
                                </events>
                            </channel>
                        </channels>
                    </domain>
                </domains>
            </session>
        </sessions>
    </output>
</command>
</COMMAND_OUTPUT>

</SCENARIO>

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

<SCENARIO>
ContextHandling

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

<COMMAND_INPUT>
lttng --mi xml 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 --mi xml 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 --mi xml 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 --mi xml create mysession -U net://172.0.0.1
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>create</name>
  <output>
    <session>
      <name>mysession</name>
      <path>tcp4://172.0.0.1:5342/mysession-20140813-095804 [data: 5343]</path>
      <enabled>false</enabled>
      <snapshot_mode>0</snapshot_mode>
      <live_timer_interval>0</live_timer_interval>
    </session>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml create mysession -U file:///tmp
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>create</name>
  <output>
    <session>
      <name>mysession</name>
      <path>/tmp</path>
      <enabled>false</enabled>
      <snapshot_mode>0</snapshot_mode>
      <live_timer_interval>0</live_timer_interval>
    </session>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml create mysession -C tcp://172.0.0.1 -D tcp://172.0.0.1:5343
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>create</name>
  <output>
    <session>
      <name>mysession</name>
      <path>tcp4://172.0.0.1:5342/ [data: 5343]</path>
      <enabled>false</enabled>
      <snapshot_mode>0</snapshot_mode>
      <live_timer_interval>0</live_timer_interval>
    </session>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml create mysession -U 172.0.0.1:1234:2345
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>create</name>
  <output>
    <session>
      <name>mysession</name>
      <path>tcp4://172.0.0.1:1234/mysession-20140813-102225 [data: 2345]</path>
      <enabled>false</enabled>
      <snapshot_mode>0</snapshot_mode>
      <live_timer_interval>0</live_timer_interval>
    </session>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml destroy mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>destroy</name>
  <output>
    <sessions>
      <session>
        <name>mysession</name>
        <path>/home/user/lttng-traces/mysession-20140818-100114</path>
        <enabled>false</enabled>
        <snapshot_mode>0</snapshot_mode>
        <live_timer_interval>0</live_timer_interval>
      </session>
    </sessions>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml -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 create <session> --snapshot (LTTng 2.3)
####################################################################
<SCENARIO>
CreateSessionSnapshot
<COMMAND_INPUT>
lttng --mi xml create mysession --snapshot
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>create</name>
  <output>
    <session>
      <name>mysession</name>
      <path/>
      <enabled>false</enabled>
      <snapshot_mode>1</snapshot_mode>
      <live_timer_interval>4294967295</live_timer_interval>
    </session>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng --mi xml snapshot list-output -s mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>snapshot</name>
  <output>
    <snapshot_action>
      <name>list-output</name>
      <output>
        <session>
          <name>mysession</name>
          <snapshots>
            <snapshot>
              <id>1</id>
              <name>snapshot-1</name>
              <ctrl_url>/home/user/lttng-traces/mysession-20130913-141651</ctrl_url>
              <data_url/>
              <max_size>0</max_size>
            </snapshot>
          </snapshots>
        </session>
      </output>
    </snapshot_action>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng --mi xml list
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <sessions>
      <session>
        <name>mysession</name>
        <path/>
        <enabled>false</enabled>
        <snapshot_mode>1</snapshot_mode>
        <live_timer_interval>4294967295</live_timer_interval>
      </session>
    </sessions>
  </output>
</command>
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng --mi xml snapshot record -s mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
    Snapshot recorded successfully for session mysession
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng --mi xml destroy mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>destroy</name>
  <output>
    <sessions>
      <session>
        <name>mysession</name>
        <path>/home/user/lttng-traces/mysession-20140818-100114</path>
        <enabled>false</enabled>
        <snapshot_mode>0</snapshot_mode>
        <live_timer_interval>0</live_timer_interval>
      </session>
    </sessions>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng create <session> --snapshot -U <URL> (LTTng 2.3)
####################################################################
<SCENARIO>
CreateSessionStreamedSnapshot
<COMMAND_INPUT>
lttng --mi xml 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 --mi xml 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 --mi xml list
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
  1) mysession () [inactive snapshot]

</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng --mi xml snapshot record -s mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
    Snapshot recorded successfully for session mysession
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng --mi xml destroy mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>destroy</name>
  <output>
    <sessions>
      <session>
        <name>mysession</name>
        <path>/home/user/lttng-traces/mysession-20140818-100114</path>
        <enabled>false</enabled>
        <snapshot_mode>0</snapshot_mode>
        <live_timer_interval>0</live_timer_interval>
      </session>
    </sessions>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test "lttng create <session> --snapshot (LTTng 2.3)
####################################################################
<SCENARIO>
CreateSessionSnapshotErrors
<COMMAND_INPUT>
lttng --mi xml snapshot list-output -s blabla
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<COMMAND_ERROR_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>snapshot</name>
  <output>
    <snapshot_action>
      <name>list-output</name>
      <output/>
    </snapshot_action>
  </output>
  <success>false</success>
</command>
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
#next is not an error case but good to be tested
<COMMAND_INPUT>
lttng --mi xml list
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <sessions>
      <session>
        <name>mysession</name>
        <path/>
        <enabled>true</enabled>
        <snapshot_mode>1</snapshot_mode>
        <live_timer_interval>4294967295</live_timer_interval>
      </session>
    </sessions>
  </output>
</command>
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng --mi xml snapshot record -s blabla
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<COMMAND_ERROR_OUTPUT>
    Error: Session name not found
</COMMAND_ERROR_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>snapshot</name>
  <output>
    <snapshot_action>
      <name>record</name>
      <output/>
    </snapshot_action>
  </output>
  <success>false</success>
</command>
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng --mi xml 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>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>snapshot</name>
  <output>
    <snapshot_action>
      <name>record</name>
      <output/>
    </snapshot_action>
  </output>
  <success>false</success>
</command>
</COMMAND_OUTPUT>

</SCENARIO>

####################################################################
# Scenario: Test "lttng create <session> --live [USEC] (LTTng 2.4)
####################################################################
<SCENARIO>
CreateSessionLive
<COMMAND_INPUT>
lttng --mi xml create mysession --live -U net://127.0.0.1
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>create</name>
  <output>
    <session>
      <name>mysession</name>
      <path>tcp4://127.0.0.1:5342/ [data: 5343]</path>
      <enabled>false</enabled>
      <snapshot_mode>0</snapshot_mode>
      <live_timer_interval>1000000</live_timer_interval>
    </session>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng --mi xml list
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <sessions>
      <session>
        <name>mysession</name>
        <path>tcp4://127.0.0.1:5342/ [data: 5343]</path>
        <enabled>false</enabled>
        <snapshot_mode>0</snapshot_mode>
        <live_timer_interval>1000000</live_timer_interval>
      </session>
    </sessions>
  </output>
</command>
</COMMAND_OUTPUT>
#------------------------------------------------------------------------------
<COMMAND_INPUT>
lttng --mi xml destroy mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>destroy</name>
  <output>
    <sessions>
      <session>
        <name>mysession</name>
        <path>/home/user/lttng-traces/mysession-20140818-100114</path>
        <enabled>false</enabled>
        <snapshot_mode>0</snapshot_mode>
        <live_timer_interval>0</live_timer_interval>
      </session>
    </sessions>
  </output>
  <success>true</success>
</command>
</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Test errors for  "lttng create <session> --live [USEC] (LTTng 2.4)
####################################################################
<SCENARIO>
CreateSessionLiveErrors
<COMMAND_INPUT>
lttng --mi xml 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 --mi xml 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 --mi xml 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 list <session> (version 2.6.0, syscalls)
####################################################################
<SCENARIO>
GetSessionWithSyscalls
<COMMAND_INPUT>
lttng --mi xml list mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
  <name>list</name>
  <output>
    <sessions>
      <session>
        <name>mysession</name>
        <path>/home/user/lttng-traces/mysession-20120129-084256</path>
        <enabled>false</enabled><snapshot_mode>0</snapshot_mode>
        <live_timer_interval>0</live_timer_interval>
        <domains>
          <domain>
            <type>KERNEL</type>
            <buffer_type>PER_PID</buffer_type>
            <channels>
              <channel>
                <name>channel0</name>
                <enabled>true</enabled>
                <attributes>
                  <overwrite_mode>DISCARD</overwrite_mode>
                  <subbuffer_size>262144</subbuffer_size>
                  <subbuffer_count>4</subbuffer_count>
                  <switch_timer_interval>0</switch_timer_interval>
                  <read_timer_interval>200</read_timer_interval>
                  <output_type>SPLICE</output_type>
                  <tracefile_size>0</tracefile_size>
                  <tracefile_count>0</tracefile_count>
                  <live_timer_interval>0</live_timer_interval>
                </attributes><events>
                <event>
                  <name>read</name>
                  <type>SYSCALL</type>
                  <enabled>true</enabled>
                  <filter>false</filter>
                </event>
                <event>
                  <name>write</name>
                  <type>SYSCALL</type>
                  <enabled>true</enabled>
                  <filter>false</filter>
                </event>
              </events>
            </channel>
          </channels>
        </domain></domains>
      </session>
    </sessions>
  </output>
</command>
</COMMAND_OUTPUT>
</SCENARIO>
<SCENARIO>
ListSession2.7Compat
<COMMAND_INPUT>
lttng --mi xml list mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<?xml version="1.0" encoding="UTF-8"?>
<command>
    <name>list</name>
    <output>
        <sessions>
            <session>
                <name>mysession</name>
                <path>/home/user/lttng-traces/mysession-20151020-085614</path>
                <enabled>false</enabled>
                <snapshot_mode>0</snapshot_mode>
                <live_timer_interval>0</live_timer_interval>
                <domains>
                    <domain>
                        <type>KERNEL</type>
                        <buffer_type>GLOBAL</buffer_type>
                        <trackers/>
                        <channels>
                            <channel>
                                <name>channel0</name>
                                <enabled>true</enabled>
                                <attributes>
                                    <overwrite_mode>DISCARD</overwrite_mode>
                                    <subbuffer_size>262144</subbuffer_size>
                                    <subbuffer_count>4</subbuffer_count>
                                    <switch_timer_interval>0</switch_timer_interval>
                                    <read_timer_interval>200000</read_timer_interval>
                                    <output_type>SPLICE</output_type>
                                    <tracefile_size>0</tracefile_size>
                                    <tracefile_count>0</tracefile_count>
                                    <live_timer_interval>0</live_timer_interval>
                                </attributes>
                                <events>
                                    <event><name>*</name>
                                    <type>SYSCALL</type>
                                    <enabled>true</enabled>
                                    <filter>false</filter>
                                </event>
                                <event>
                                    <name>*</name>
                                    <type>TRACEPOINT</type>
                                    <enabled>true</enabled>
                                    <filter>false</filter>
                                    <loglevel>TRACE_EMERG</loglevel>
                                    <loglevel_type>ALL</loglevel_type>
                                    <exclusion>false</exclusion>
                                </event>
                            </events>
                        </channel>
                    </channels>
                </domain>
                    <domain>
                        <type>UST</type>
                        <buffer_type>PER_PID</buffer_type>
                        <trackers/>
                        <channels>
                            <channel>
                                <name>channel0</name>
                                <enabled>true</enabled>
                                 <attributes>
                                    <overwrite_mode>DISCARD</overwrite_mode>
                                    <subbuffer_size>4096</subbuffer_size>
                                    <subbuffer_count>4</subbuffer_count>
                                    <switch_timer_interval>0</switch_timer_interval>
                                    <read_timer_interval>0</read_timer_interval>
                                    <output_type>MMAP</output_type>
                                    <tracefile_size>0</tracefile_size>
                                    <tracefile_count>0</tracefile_count>
                                    <live_timer_interval>0</live_timer_interval>
                                </attributes>
                                <events>
                                    <event><name>*</name>
                                    <type>TRACEPOINT</type>
                                    <enabled>true</enabled>
                                    <filter>false</filter>
                                    <exclusion>false</exclusion>
                                </event></events>
                            </channel>
                        </channels>
                    </domain>
                </domains>
            </session>
        </sessions>
    </output>
</command>
</COMMAND_OUTPUT>
</SCENARIO>
####################################################################
# Scenario: Test "lttng load [OPTIONS] [SESSION]"
#                "lttng save [OPTIONS] [SESSION]"
# (LTTng 2.5)
####################################################################
<SCENARIO>
SessionProfile
<COMMAND_INPUT>
lttng --mi xml load -i /home/user/.lttng/sessions/mysession.lttng
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<command><name>load</name><output><load><session><name>*</name></session><path>.lttng/sessions/seqSession2.lttng</path></load></output><success>true</success></command>
</COMMAND_OUTPUT>

<SCENARIO>
SessionProfile
<COMMAND_INPUT>
lttng --mi xml load -i /home/user/.lttng/sessions/mysession.lttng -f
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<command><name>load</name><output><load><session><name>*</name></session><path>.lttng/sessions/seqSession2.lttng</path></load></output><success>true</success></command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml save
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<command><name>save</name><output><save><session><name>*</name></session></save></output><success>true</success></command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml save mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<command><name>save</name><output><save><session><name>seqSession2</name></session></save></output><success>true</success></command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml save -f mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<command><name>save</name><output><save><session><name>seqSession2</name></session></save></output><success>true</success></command>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng --mi xml save -o /tmp/test -f mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<command><name>save</name><output><save><session><name>seqSession2</name></session></save></output><success>true</success></command>
</COMMAND_OUTPUT>

</SCENARIO>
