#!/bin/bash
#
-# Copyright (C) - 2017 Julien Desfossez <jdesfossez@efficios.com>
+# Copyright (C) 2017 Julien Desfossez <jdesfossez@efficios.com>
#
-# This library is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation; version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+# SPDX-License-Identifier: LGPL-2.1-only
TEST_DESC="Rotation - Save/Load/List/MI"
# Overwrite the lttng_bin to get mi output
LTTNG_BIN="lttng --mi xml"
-XSD_PATH=$TESTDIR/../src/common/mi-lttng-3.0.xsd
+XSD_PATH=$TESTDIR/../src/common/mi-lttng-4.0.xsd
XML_VALIDATE="$TESTDIR/regression/tools/mi/validate_xml $XSD_PATH"
XML_EXTRACT="$TESTDIR/regression/tools/mi/extract_xml"
XPATH_CMD_OUTPUT="//lttng:command/lttng:output"
XPATH_SESSION="$XPATH_CMD_OUTPUT/lttng:sessions/lttng:session"
-XPATH_ROTATE_SETUP="$XPATH_CMD_OUTPUT/lttng:rotation_schedule"
+XPATH_ENABLE_ROTATE_TIMER="$XPATH_CMD_OUTPUT/lttng:rotation_schedule_results/lttng:rotation_schedule_result/lttng:rotation_schedule/lttng:periodic/lttng:time_us"
+XPATH_ENABLE_ROTATE_SIZE="$XPATH_CMD_OUTPUT/lttng:rotation_schedule_results/lttng:rotation_schedule_result/lttng:rotation_schedule/lttng:size_threshold/lttng:bytes"
+
+XPATH_LIST_ROTATE_TIMER="$XPATH_SESSION/lttng:rotation_schedules/lttng:periodic/lttng:time_us"
+XPATH_LIST_ROTATE_SIZE="$XPATH_SESSION/lttng:rotation_schedules/lttng:size_threshold/lttng:bytes"
function test_save_load_mi ()
{
$XML_VALIDATE ${tmp_xml_output}
ok $? "Valid lttng enable-rotation timer XML"
- value=$($XML_EXTRACT ${tmp_xml_output} ${XPATH_ROTATE_SETUP}/lttng:rotation_schedule_timer_period)
+ value=$($XML_EXTRACT ${tmp_xml_output} ${XPATH_ENABLE_ROTATE_TIMER})
test $value = 500000
ok $? "Found the right rotation timer value in XML"
$XML_VALIDATE ${tmp_xml_output}
ok $? "Valid lttng enable-rotation size XML"
- value=$($XML_EXTRACT ${tmp_xml_output} ${XPATH_ROTATE_SETUP}/lttng:rotation_schedule_size)
+ value=$($XML_EXTRACT ${tmp_xml_output} ${XPATH_ENABLE_ROTATE_SIZE})
test $value = 512000
ok $? "Found the right rotation size value in XML"
$XML_VALIDATE ${tmp_xml_output}
ok $? "Valid lttng list XML"
- value=$($XML_EXTRACT ${tmp_xml_output} ${XPATH_SESSION}/lttng:rotation_schedule_timer_period)
+ value=$($XML_EXTRACT ${tmp_xml_output} ${XPATH_LIST_ROTATE_TIMER})
test $value = 500000
ok $? "Found the right rotation timer value in list XML"
- value=$($XML_EXTRACT ${tmp_xml_output} ${XPATH_SESSION}/lttng:rotation_schedule_size)
+ value=$($XML_EXTRACT ${tmp_xml_output} ${XPATH_LIST_ROTATE_SIZE})
test $value = 512000
ok $? "Found the right rotation size value in list XML"
$XML_VALIDATE ${tmp_xml_output}
ok $? "Valid lttng list XML after load"
- value=$($XML_EXTRACT ${tmp_xml_output} ${XPATH_SESSION}/lttng:rotation_schedule_timer_period)
+ value=$($XML_EXTRACT ${tmp_xml_output} ${XPATH_LIST_ROTATE_TIMER})
test $value = 500000
ok $? "Found the right rotation timer value in list XML after load"
- value=$($XML_EXTRACT ${tmp_xml_output} ${XPATH_SESSION}/lttng:rotation_schedule_size)
+ value=$($XML_EXTRACT ${tmp_xml_output} ${XPATH_LIST_ROTATE_SIZE})
test $value = 512000
ok $? "Found the right rotation size value in list XML after load"