####################################################################
# Copyright (c) 2012, 2015 Ericsson
#
# All rights reserved. This program and the accompanying materials are
# made available under the terms of the Eclipse Public License 2.0 which
# accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
#    Bernd Hufmann - Initial API and implementation
####################################################################
####################################################################
# Scenario: Test lttng list <name> with sample outputs
####################################################################
<SCENARIO>
ListInfoTest

<COMMAND_INPUT>
lttng version
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
lttng version 2.5.0 - 20120129-084256
Web site: http://lttng.org/

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

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

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

<COMMAND_INPUT>
lttng list mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Tracing session mysession: [active]
    Trace path: /home/user/lttng-traces/mysession-20120129-084256

=== Domain: Kernel ===

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

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

    Events:
      block_rq_remap (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
      block_bio_remap (loglevel: TRACE_EMERG (0)) (type: tracepoint) [disabled]
      myevent2 (type: probe) [enabled]
        addr: 0xc0101340
      myevent0 (type: probe) [enabled]
        offset: 0x0
        symbol: init_post
      syscalls (type: syscall) [enabled]

- channel1: [disabled]

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

    Events:
      None

=== Domain: UST global ===

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

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

    Events:
      None

- channel0: [enabled]

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

    Events:
      ust_tests_hello:tptest_sighandler (loglevel == TRACE_DEBUG_LINE (13)) (type: tracepoint) [disabled] [with filter]
      ust_tests_hello:tptest_sighandler1 (loglevel <= TRACE_INFO (7)) (type: tracepoint) [disabled] [with filter]
      ust_tests_hello:tptest_sighandler2 (loglevel: TRACE_DEBUG_SYSTEM (8)) (type: tracepoint) [disabled] [with filter]
      * (type: tracepoint) [enabled]

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

</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng list -k
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Kernel events
-------------
      sched_kthread_stop (loglevel: TRACE_EMERG (0)) (type: tracepoint)
      sched_kthread_stop_ret (loglevel: TRACE_EMERG (0)) (type: tracepoint)
      sched_wakeup_new (loglevel: TRACE_EMERG (0)) (type: tracepoint)

</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng list -u -f
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST events:
-------------

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

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

</COMMAND_OUTPUT>

</SCENARIO>


####################################################################
# Scenario: Test "lttng list -k" with no kernel and no session daemon
####################################################################
<SCENARIO>
ListInfoTestNoKernel

<COMMAND_INPUT>
lttng version
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
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>

<COMMAND_INPUT>
lttng list
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Currently no available tracing session
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng list -k
</COMMAND_INPUT>
<COMMAND_RESULT>
1
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<COMMAND_ERROR_OUTPUT>
Error: Unable to list kernel events
</COMMAND_ERROR_OUTPUT>
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng list -u
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST events:
-------------

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

</COMMAND_OUTPUT>

</SCENARIO>

