#!/bin/bash
#
-# Copyright (C) - 2014 Jonathan Rajotte <jonathan.r.julien@gmail.com>
+# Copyright (C) 2014 Jonathan Rajotte <jonathan.r.julien@gmail.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="Machine interface testing"
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../../../
-XSD_PATH=$TESTDIR/../src/common/mi-lttng-3.0.xsd
+XSD_PATH=$TESTDIR/../src/common/mi-lttng-4.0.xsd
#Test app for ust event
TESTAPP_PATH="$TESTDIR/utils/testapp"
XPATH_SNAPSHOT_ADD_SNAPSHOT="$XPATH_CMD_OUTPUT/lttng:snapshot_action[./lttng:name = 'add-output']/lttng:output"
XPATH_SNAPSHOT_LIST="$XPATH_CMD_OUTPUT/lttng:snapshot_action[./lttng:name = 'list-output']/lttng:output"
XPATH_SNAPSHOT_DEL="$XPATH_CMD_OUTPUT/lttng:snapshot_action[./lttng:name = 'del-output']/lttng:output"
-XPATH_TRACK_UNTRACK_PID="$XPATH_CMD_OUTPUT/lttng:targets/lttng:pid_target"
-XPATH_PID_TRACKER="$XPATH_CMD_OUTPUT/lttng:sessions/lttng:session/lttng:domains/lttng:domain/lttng:trackers/lttng:pid_tracker"
+XPATH_TRACK_UNTRACK_VPID="$XPATH_CMD_OUTPUT/lttng:process_attr_trackers/lttng:vpid_process_attr_tracker/lttng:process_attr_values/lttng:vpid/lttng:type"
+XPATH_VPID_TRACKER="$XPATH_CMD_OUTPUT/lttng:sessions/lttng:session/lttng:domains/lttng:domain/lttng:process_attr_trackers/lttng:vpid_process_attr_tracker"
DEVNULL=/dev/null 2>&1
ok $? "Mi test: track pid is a success"
#Verify that there is 3 process
- extract_xml $OUTPUT_DEST $XPATH_TRACK_UNTRACK_PID"/lttng:pid" result
+ extract_xml $OUTPUT_DEST $XPATH_TRACK_UNTRACK_VPID"/lttng:id" result
num=$(echo "$result" | wc -l)
test "$num" -eq "3"
ok $? "Mi test: track pid expecting 3 processes got $num"
ok $? "Mi test: session list with pid_tracker validate"
#Check the good count
- extract_xml $OUTPUT_DEST $XPATH_PID_TRACKER"/lttng:targets/lttng:pid_target/lttng:pid" result
+ extract_xml $OUTPUT_DEST $XPATH_VPID_TRACKER"/lttng:process_attr_values/lttng:vpid/lttng:type/lttng:id" result
num=$(echo "$result" | wc -l)
test "$num" -eq "3"
ok $? "Mi test: tracker pid listing expecting 3 target got $num"
ok $? "Mi test: untrack pid is a success"
#Verify that there is 2 untracked pids
- extract_xml $OUTPUT_DEST $XPATH_TRACK_UNTRACK_PID"/lttng:pid" result
+ extract_xml $OUTPUT_DEST $XPATH_TRACK_UNTRACK_VPID"/lttng:id" result
num=$(echo "$result" | wc -l)
test "$num" -eq "2"
ok $? "Mi test: untrack pid expecting 2 process got $num"
ok $? "Mi test: session list with pid_tracker validate"
#Check the good count
- extract_xml $OUTPUT_DEST $XPATH_PID_TRACKER"/lttng:targets/lttng:pid_target/lttng:pid" result
+ extract_xml $OUTPUT_DEST $XPATH_VPID_TRACKER"/lttng:targets/lttng:vpid_target/lttng:type/lttng:pid" result
num=$(echo "$result" | wc -l)
test "$num" -eq "1"
ok $? "Mi test: tracker pid listing expecting 1 process got $num"
ok $? "Mi test: untrack all pid is a success"
#Verify that there is 1 untracked pid
- extract_xml $OUTPUT_DEST $XPATH_TRACK_UNTRACK_PID"/lttng:pid" result
+ extract_xml $OUTPUT_DEST $XPATH_TRACK_UNTRACK_VPID"/lttng:all" result
num=$(echo "$result" | wc -l)
test "$num" -eq "1"
ok $? "Mi test: untrack pid expecting 1 process got $num"
- #Test if the id is * which represent the all argument
- test "$result" = "*"
- ok $? "Mi test: pid expected is * got $result"
+ #Test if type "all" is "true" which represent the all argument
+ test "$result" = "true"
+ ok $? "Mi test: pid expected is true got $result"
#Test if pid_tracker is enabled as definied by pid_tracker
#behavior. If all pid are untrack than the pid_tracker is still
ok $? "Mi test: session list with pid_tracker validate"
#Check the good count
- extract_xml $OUTPUT_DEST $XPATH_PID_TRACKER"/lttng:targets/lttng:pid_target/lttng:pid" result
+ extract_xml $OUTPUT_DEST $XPATH_VPID_TRACKER"/lttng:targets/lttng:vpid_target/lttng:type/lttng:pid" result
num=$(echo -n "$result" | wc -l)
test "$num" -eq "0"
ok $? "Mi test: tracker pid listing expecting 0 process got $num"
ok $? "Mi test: track all pid is a success"
#Verify that there is 1 tracked process
- extract_xml $OUTPUT_DEST $XPATH_TRACK_UNTRACK_PID"/lttng:pid" result
+ extract_xml $OUTPUT_DEST $XPATH_TRACK_UNTRACK_VPID"/lttng:all" result
num=$(echo "$result" | wc -l)
test "$num" -eq "1"
ok $? "Mi test: track pid expecting 1 process got $num"
- #Test if the id is * wich represent the all argument
- test "$result" = "*"
- ok $? "Mi test: pid expected is * got $result"
+ #Test if the id is true wich represent the all argument
+ test "$result" = "true"
+ ok $? "Mi test: pid expected is true got $result"
#Test if pid_tracker is enabled as definied by pid_tracker
#behavior. If all pid are untrack thant the pid_tracker is
$XML_VALIDATE $OUTPUT_DEST
ok $? "Mi test: session list with pid_tracker validate"
- node_check_xml $OUTPUT_DEST $XPATH_PID_TRACKER result
+ node_check_xml $OUTPUT_DEST $XPATH_VPID_TRACKER result
test "$result" = ""
- ok $? "Mi test: Pid_tracker node is absent as defined"
+ ok $? "Mi test: VPID_tracker node is absent as defined"
OUTPUT_DEST=$DEVNULL
destroy_lttng_sessions