####################################################################
# Copyright (c) 2013 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: Initialize
####################################################################
<SCENARIO>
Initialize
<COMMAND_INPUT>
lttng version
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
lttng version 2.2.0 - Cuda
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>
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_WARNING (4)) (type: tracepoint)
    ust_tests_hello:tptest (loglevel: TRACE_DEBUG_FUNCTION (12)) (type: tracepoint)

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

</COMMAND_OUTPUT>
</SCENARIO>

####################################################################
# Scenario: Session and channel with per-UID UST buffers
####################################################################
<SCENARIO>
ScenPerUidTest
<COMMAND_INPUT>
lttng create mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession created.
Traces will be written in /home/user/lttng-traces/mysession-20130812-113358
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng list mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Tracing session mysession: [inactive]
    Trace path: /home/user/lttng-traces/mysession-20130812-113358

</COMMAND_OUTPUT>

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

<COMMAND_INPUT>
lttng enable-channel mychannel -u -s mysession --buffers-uid
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST channel mychannel enabled for session mysession
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng list mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Tracing session mysession: [inactive]
    Trace path: /home/user/lttng-traces/mysession-20130812-113358

=== Domain: UST global ===

Buffer type: per UID

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

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

    Events:
      None

</COMMAND_OUTPUT>

</SCENARIO>

####################################################################
# Scenario: Session and channel with per-PID UST buffers
####################################################################
<SCENARIO>
ScenPerPidTest
<COMMAND_INPUT>
lttng create mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession created.
Traces will be written in /home/user/lttng-traces/mysession-20130812-113358
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng list mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Tracing session mysession: [inactive]
    Trace path: /home/user/lttng-traces/mysession-20130812-113358

</COMMAND_OUTPUT>

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

<COMMAND_INPUT>
lttng enable-channel mychannel -u -s mysession --buffers-pid
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
UST channel mychannel enabled for session mysession
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng list mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Tracing session mysession: [inactive]
    Trace path: /home/user/lttng-traces/mysession-20130812-113358

=== Domain: UST global ===

Buffer type: per PID

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

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

    Events:
      None

</COMMAND_OUTPUT>

</SCENARIO>

####################################################################
# Scenario: Session and channel with per-PID UST buffers with option -C -W
####################################################################
<SCENARIO>
ScenBufSizeTest
<COMMAND_INPUT>
lttng create mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Session mysession created.
Traces will be written in /home/user/lttng-traces/mysession-20130812-113358
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng list mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Tracing session mysession: [inactive]
    Trace path: /home/user/lttng-traces/mysession-20130812-113358

</COMMAND_OUTPUT>

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

<COMMAND_INPUT>
lttng enable-channel mychannel -u -s mysession -C 1024 -W 10
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
<COMMAND_ERROR_OUTPUT>
Warning: Tracefile size rounded up from (1024) to subbuffer size (8388608)
</COMMAND_ERROR_OUTPUT>
UST channel mychannel enabled for session mysession
</COMMAND_OUTPUT>

<COMMAND_INPUT>
lttng list mysession
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
Tracing session mysession: [inactive]
    Trace path: /home/user/lttng-traces/mysession-20130812-113358

=== Domain: UST global ===

Buffer type: per PID

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

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

    Events:
      None

</COMMAND_OUTPUT>

</SCENARIO>



