From fa182fe058682b855a353931e5ef1994325c3da3 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Mon, 7 Jun 2021 17:56:37 -0400 Subject: [PATCH] Tests: utils: regroup xml utils to utils.sh MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: Idfa0f05d1bde75f4b02c903699281a86494b435f --- tests/regression/tools/mi/test_mi | 91 +++++++++---------- .../regression/tools/relayd-grouping/test_ust | 8 +- .../tools/rotation/test_save_load_mi | 13 +-- tests/regression/tools/save-load/test_load | 7 +- .../tools/trigger/test_add_trigger_cli | 4 +- .../tools/trigger/test_remove_trigger_cli | 4 +- tests/utils/utils.sh | 15 ++- 7 files changed, 64 insertions(+), 78 deletions(-) diff --git a/tests/regression/tools/mi/test_mi b/tests/regression/tools/mi/test_mi index b3b637865..72b96aac1 100755 --- a/tests/regression/tools/mi/test_mi +++ b/tests/regression/tools/mi/test_mi @@ -8,7 +8,6 @@ TEST_DESC="Machine interface testing" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../../../ -XSD_PATH=$TESTDIR/../src/common/mi-lttng-4.0.xsd #Test app for ust event TESTAPP_PATH="$TESTDIR/utils/testapp" @@ -22,12 +21,6 @@ OUTPUT_DIR=$(mktemp --tmpdir -d tmp.test_mi_output_dir.XXXXXX) SESSIOND_LOAD_DIR=$(mktemp --tmpdir -d tmp.test_mi_sessiond_load_dir.XXXXXX) OUTPUT_FILE="default.xml" -#Path to custom xml utilities -XML_UTILS_PATH="$TESTDIR/utils/xml-utils" -XML_VALIDATE="$XML_UTILS_PATH/validate_xml $XSD_PATH" -XML_EXTRACT="$XML_UTILS_PATH/extract_xml" -XML_NODE_CHECK="$XML_UTILS_PATH/extract_xml -e" - XPATH_CMD_OUTPUT="//lttng:command/lttng:output" XPATH_COMMAND_SUCCESS="/lttng:command/lttng:success/text()" XPATH_SESSION="$XPATH_CMD_OUTPUT/lttng:sessions/lttng:session" @@ -133,7 +126,7 @@ function test_version () OUTPUT_FILE="version.xml" OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE mi_print_version $OUTPUT_DEST - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "MI test: Version xsd validation" } @@ -144,12 +137,12 @@ function test_create_session () OUTPUT_FILE="create_session.xml" OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE create_lttng_session_ok $session_name $OUTPUT_DIR - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "MI test: create session xsd validation" #try to recreate a session. Expecting it to fail create_lttng_session_fail $session_name $OUTPUT_DIR - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "MI test: expecting fail create session xsd validation" is_command_success $OUTPUT_DEST true @@ -174,7 +167,7 @@ function test_destroy_session () OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE destroy_lttng_session_ok ${session_name[0]} - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "MI test: destroy session ${session_name[0]} xsd validation" #Verify that we destroyed the good session @@ -184,7 +177,7 @@ function test_destroy_session () #Destroy all and count:should be 2 destroy_lttng_sessions - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "MI test: destroy all session xsd validation" #Verify that we destroyed 2 sessions @@ -195,7 +188,7 @@ function test_destroy_session () #Verify that if no session is present command fail and mi report it. destroy_lttng_session_fail ${session_name[0]} - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "MI test: failing destroy session ${session_name[0]} xsd validation" extract_xml $OUTPUT_DEST $XPATH_COMMAND_SUCCESS result test "$result" = "false" @@ -220,7 +213,7 @@ function test_list_sessions () OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE list_lttng_with_opts - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: list sessions xsd validation" #We should have 3 session @@ -249,7 +242,7 @@ function test_list_session_long_path () OUTPUT_DEST=${output_basedir}/$OUTPUT_FILE list_lttng_with_opts - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: list session with long path xsd validation" #Teardown @@ -272,13 +265,13 @@ function test_ust_channel () #Test the enable_channel command OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE enable_ust_lttng_channel_ok $session_name ${channel_name[0]} - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: enable ust channel xsd validation" is_command_success $OUTPUT_DEST false #Expect the command to fail enable_ust_lttng_channel_fail $session_name ${channel_name[0]} - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: fail enable ust channel xsd validation" is_command_success $OUTPUT_DEST true @@ -289,7 +282,7 @@ function test_ust_channel () #Test the disable_channel command disable_ust_lttng_channel $session_name ${channel_name[0]} - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: disable ust channel xsd validation" is_command_success $OUTPUT_DEST false #Check that we delete the good channel @@ -299,7 +292,7 @@ function test_ust_channel () #Test multiple disable_channel; disable_ust_lttng_channel $session_name ${channel_name[1]},${channel_name[2]} - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: multiple disable ust channel xsd validation" is_command_success $OUTPUT_DEST false @@ -331,13 +324,13 @@ function test_ust_lttng_event () OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE #Test the enable event for ust domain enable_ust_lttng_event_ok $session_name ${event[0]} $channel_name - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: Enable_event for ust domain xsd validation" is_command_success $OUTPUT_DEST false #Try to reenable an enabled event. Should fail enable_ust_lttng_event_fail $session_name ${event[0]} $channel_name - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: Fail enable_event for ust domain xsd validation" is_command_success $OUTPUT_DEST true @@ -350,7 +343,7 @@ function test_ust_lttng_event () concat_event=$( IFS=$','; echo "${event[*]}" ) enable_ust_lttng_event_fail $session_name $concat_event $channel_name - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: Multiple enable ust event with inside fail xsd validation" #Check for 2 success = true and 1 success = false @@ -366,13 +359,13 @@ function test_ust_lttng_event () #Disable the event disable_ust_lttng_event $session_name ${event[0]} $channel_name - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: Disable ust event xsd validation" is_command_success $OUTPUT_DEST false #Disable the 3 event combined. Should pass disable_ust_lttng_event $session_name $concat_event $channel_name - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: Disable multiple ust event xsd validation" is_command_success $OUTPUT_DEST false @@ -407,7 +400,7 @@ function test_list_channel () #Begin testing OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE list_lttng_with_opts "$session_name -c $channel_name" - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: list channel xsd validation" #Expect 1 domain: UST @@ -455,7 +448,7 @@ function test_list_domain () #Begin testing OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE list_lttng_with_opts "$session_name -d" - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: list domain xsd validation" #Expect 2 domain: Jul and UST @@ -503,7 +496,7 @@ function test_list_session () #Begin testing OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE list_lttng_with_opts $session_name - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: list session xsd validation" #Expect 2 domain: Jul and UST @@ -546,7 +539,7 @@ function test_list_ust_event () touch ${file_sync_before_last} - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: list ust event xsd validation" #Extract events @@ -587,7 +580,7 @@ function test_start_stop () { #No channel enable start command should return element success false OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE start_lttng_tracing_fail $session_name - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: failed start xsd validation" #Expect a false element @@ -602,7 +595,7 @@ function test_start_stop () { #Start tracing OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE start_lttng_tracing_ok $session_name - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: start xsd validation" #Expect a true element @@ -622,12 +615,12 @@ function test_start_stop () { #Test metadata regenerate command regenerate_metadata_ok $session_name - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: regenerate metadata" #Test stop command stop_lttng_tracing_ok $session_name - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: stop xsd validation" #Extract session name from xml @@ -642,7 +635,7 @@ function test_start_stop () { #Test failing stop command stop_lttng_tracing_fail $session_name - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: failed stop xsd validation" #Expect a false element @@ -669,7 +662,7 @@ function test_snapshot () { #No channel enable start command should return element success false OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE lttng_snapshot_add_output_ok $session_name file://$snapshot_path - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: snapshot xsd validation" #Expect a true element @@ -688,7 +681,7 @@ function test_snapshot () { #Test list output lttng_snapshot_list $session_name - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: snapshot list xsd validation" #Expect a true element @@ -702,7 +695,7 @@ function test_snapshot () { #Test del output lttng_snapshot_del_output_ok $session_name $snapshot_id - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: snapshot delete xsd validation" #Success ? @@ -721,7 +714,7 @@ function test_snapshot () { #Test fail on delete command lttng_snapshot_del_output_fail $session_name $snapshot_id - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: snapshot delete xsd validation" #Success ? @@ -747,7 +740,7 @@ function test_track_untrack () OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE lttng_track_ok "-p $pid -u" - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: track pid xsd validation" #Expect a true element @@ -763,7 +756,7 @@ function test_track_untrack () #Test the pid_tracker listing list_lttng_with_opts $session_name - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: session list with pid_tracker validate" #Check the good count @@ -774,7 +767,7 @@ function test_track_untrack () #Untrack pid 2,3 lttng_untrack_ok "-p 2,3 -u" - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: untrack pid xsd validation" #Expect a true element @@ -790,7 +783,7 @@ function test_track_untrack () #Check pid_tracker listing list_lttng_with_opts $session_name - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: session list with pid_tracker validate" #Check the good count @@ -801,7 +794,7 @@ function test_track_untrack () #Untrack all lttng_untrack_ok "-p -u -a" - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: untrack pid xsd validation" #Expect a true element @@ -823,7 +816,7 @@ function test_track_untrack () #behavior. If all pid are untrack than the pid_tracker is still #enabled (pid_tracker node is present). list_lttng_with_opts $session_name - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: session list with pid_tracker validate" #Check the good count @@ -834,7 +827,7 @@ function test_track_untrack () #Test track all lttng_track_ok "-p -u -a" - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: track pid xsd validation" #Expect a true element @@ -856,7 +849,7 @@ function test_track_untrack () #behavior. If all pid are untrack thant the pid_tracker is #disabled (node pid_tracker do not exist) list_lttng_with_opts $session_name - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: session list with pid_tracker validate" node_check_xml $OUTPUT_DEST $XPATH_VPID_TRACKER result @@ -875,7 +868,7 @@ function test_add_context_list() OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE lttng_add_context_list - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "Mi test: context listing validation" } @@ -898,7 +891,7 @@ function test_clear_session () OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE lttng_clear_session_ok ${session_name[0]} - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "MI test: clear session ${session_name[0]} xsd validation" #Verify that we cleared the good session @@ -908,7 +901,7 @@ function test_clear_session () #Destroy all and count:should be 3 lttng_clear_all - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "MI test: clear all session xsd validation" #Verify that we cleared 3 sessions @@ -921,7 +914,7 @@ function test_clear_session () #Verify that if no session is present command fail and mi report it. lttng_clear_session_fail ${session_name[0]} - $XML_VALIDATE $OUTPUT_DEST + $MI_VALIDATE $OUTPUT_DEST ok $? "MI test: failing clear session ${session_name[0]} xsd validation" extract_xml $OUTPUT_DEST $XPATH_COMMAND_SUCCESS result test "$result" = "false" diff --git a/tests/regression/tools/relayd-grouping/test_ust b/tests/regression/tools/relayd-grouping/test_ust index 64fb90e34..579881492 100755 --- a/tests/regression/tools/relayd-grouping/test_ust +++ b/tests/regression/tools/relayd-grouping/test_ust @@ -16,15 +16,9 @@ TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" EVENT_NAME="tp:tptest" CHANNEL_NAME="my_channel" -XSD_PATH=$TESTDIR/../src/common/mi-lttng-4.0.xsd - -XML_VALIDATE="$TESTDIR/utils/xml-utils/validate_xml $XSD_PATH" -XML_EXTRACT="$TESTDIR/utils/xml-utils/extract_xml" - XPATH_CMD_OUTPUT="//lttng:command/lttng:output" XPATH_SESSION="$XPATH_CMD_OUTPUT/lttng:sessions/lttng:session" - NUM_TESTS=688 source "$TESTDIR/utils/utils.sh" @@ -43,7 +37,7 @@ function get_auto_session_name () OUTPUT_DEST=$(mktemp --tmpdir "tmp.${FUNCNAME[0]}_output.XXXXXX") list_lttng_with_opts - $XML_VALIDATE "$OUTPUT_DEST" + $MI_VALIDATE "$OUTPUT_DEST" ok $? "Valid lttng list XML" value=$($XML_EXTRACT "$OUTPUT_DEST" ${XPATH_SESSION}/lttng:name/text\(\)) diff --git a/tests/regression/tools/rotation/test_save_load_mi b/tests/regression/tools/rotation/test_save_load_mi index cb2050841..a4dce0951 100755 --- a/tests/regression/tools/rotation/test_save_load_mi +++ b/tests/regression/tools/rotation/test_save_load_mi @@ -18,11 +18,6 @@ source $CURDIR/rotate_utils.sh # Overwrite the lttng_bin to get mi output LTTNG_BIN="lttng --mi xml" -XSD_PATH=$TESTDIR/../src/common/mi-lttng-4.0.xsd - -XML_VALIDATE="$TESTDIR/utils/xml-utils/validate_xml $XSD_PATH" -XML_EXTRACT="$TESTDIR/utils/xml-utils/extract_xml" - XPATH_CMD_OUTPUT="//lttng:command/lttng:output" XPATH_SESSION="$XPATH_CMD_OUTPUT/lttng:sessions/lttng:session" XPATH_ENABLE_ROTATE_TIMER="$XPATH_CMD_OUTPUT/lttng:rotation_schedule_results/lttng:rotation_schedule_result/lttng:rotation_schedule/lttng:periodic/lttng:time_us" @@ -45,7 +40,7 @@ function test_save_load_mi () OUTPUT_DEST=${tmp_xml_output} lttng_enable_rotation_timer_ok $SESSION_NAME 500ms - $XML_VALIDATE ${tmp_xml_output} + $MI_VALIDATE ${tmp_xml_output} ok $? "Valid lttng enable-rotation timer XML" value=$($XML_EXTRACT ${tmp_xml_output} ${XPATH_ENABLE_ROTATE_TIMER}) @@ -54,7 +49,7 @@ function test_save_load_mi () # Enable a rotation size and check the MI output of the command lttng_enable_rotation_size_ok $SESSION_NAME 500k - $XML_VALIDATE ${tmp_xml_output} + $MI_VALIDATE ${tmp_xml_output} ok $? "Valid lttng enable-rotation size XML" value=$($XML_EXTRACT ${tmp_xml_output} ${XPATH_ENABLE_ROTATE_SIZE}) @@ -63,7 +58,7 @@ function test_save_load_mi () # Check the output of lttng list with the 2 rotation parameters list_lttng_with_opts $SESSION_NAME - $XML_VALIDATE ${tmp_xml_output} + $MI_VALIDATE ${tmp_xml_output} ok $? "Valid lttng list XML" value=$($XML_EXTRACT ${tmp_xml_output} ${XPATH_LIST_ROTATE_TIMER}) @@ -83,7 +78,7 @@ function test_save_load_mi () OUTPUT_DEST=${tmp_xml_output} # Check the output of lttng list with the 2 rotation parameters after the load list_lttng_with_opts $SESSION_NAME - $XML_VALIDATE ${tmp_xml_output} + $MI_VALIDATE ${tmp_xml_output} ok $? "Valid lttng list XML after load" value=$($XML_EXTRACT ${tmp_xml_output} ${XPATH_LIST_ROTATE_TIMER}) diff --git a/tests/regression/tools/save-load/test_load b/tests/regression/tools/save-load/test_load index 15901f4f0..7899cc09b 100755 --- a/tests/regression/tools/save-load/test_load +++ b/tests/regression/tools/save-load/test_load @@ -19,7 +19,6 @@ DIR=$(readlink -f $TESTDIR) NUM_TESTS=75 source $TESTDIR/utils/utils.sh -XML_EXTRACT="$TESTDIR/utils/xml-utils/extract_xml" # MUST set TESTDIR before calling those functions plan_tests $NUM_TESTS @@ -133,21 +132,21 @@ function test_trackers() break; fi $TESTDIR/../src/bin/lttng/$LTTNG_BIN --mi XML list "$SESSION_NAME-trackers" > $mi_output_file - mi_result=$("$XML_EXTRACT" -e $mi_output_file "//lttng:command/lttng:output/lttng:sessions/lttng:session/lttng:domains/lttng:domain/lttng:process_attr_trackers/lttng:vpid_process_attr_tracker/lttng:process_attr_values/lttng:vpid") + mi_result=$($XML_NODE_CHECK $mi_output_file "//lttng:command/lttng:output/lttng:sessions/lttng:session/lttng:domains/lttng:domain/lttng:process_attr_trackers/lttng:vpid_process_attr_tracker/lttng:process_attr_values/lttng:vpid") if [[ $mi_result = "true" ]]; then ok 0 "VPID target is present" else fail "VPID target missing" fi - mi_result=$("$XML_EXTRACT" -e $mi_output_file "//lttng:command/lttng:output/lttng:sessions/lttng:session/lttng:domains/lttng:domain/lttng:process_attr_trackers/lttng:vuid_process_attr_tracker/lttng:process_attr_values/lttng:vuid") + mi_result=$($XML_NODE_CHECK $mi_output_file "//lttng:command/lttng:output/lttng:sessions/lttng:session/lttng:domains/lttng:domain/lttng:process_attr_trackers/lttng:vuid_process_attr_tracker/lttng:process_attr_values/lttng:vuid") if [[ $mi_result = "true" ]]; then ok 0 "VUID target is present" else fail "VUID target missing" fi - mi_result=$("$XML_EXTRACT" -e $mi_output_file "//lttng:command/lttng:output/lttng:sessions/lttng:session/lttng:domains/lttng:domain/lttng:process_attr_trackers/lttng:vgid_process_attr_tracker/lttng:process_attr_values/lttng:vgid") + mi_result=$($XML_NODE_CHECK $mi_output_file "//lttng:command/lttng:output/lttng:sessions/lttng:session/lttng:domains/lttng:domain/lttng:process_attr_trackers/lttng:vgid_process_attr_tracker/lttng:process_attr_values/lttng:vgid") if [[ $mi_result = "true" ]]; then ok 0 "VGID target is present" else diff --git a/tests/regression/tools/trigger/test_add_trigger_cli b/tests/regression/tools/trigger/test_add_trigger_cli index cc873bef3..278c5c781 100755 --- a/tests/regression/tools/trigger/test_add_trigger_cli +++ b/tests/regression/tools/trigger/test_add_trigger_cli @@ -134,9 +134,9 @@ function test_mi () ok $? "add-trigger mi: exit code is 0" # Pretty-fy xml before further test. - $XML_PRETTY_BIN < "${tmp_stdout_raw}" > "${tmp_stdout}" + $XML_PRETTY < "${tmp_stdout_raw}" > "${tmp_stdout}" - $XML_VALIDATE_BIN "${MI_XSD_PATH}" "${tmp_stdout}" + $MI_VALIDATE "${tmp_stdout}" ok $? "add-trigger mi is valid" diff -u "${tmp_expected_stdout}" "${tmp_stdout}" diff --git a/tests/regression/tools/trigger/test_remove_trigger_cli b/tests/regression/tools/trigger/test_remove_trigger_cli index f306f114f..3f1577ead 100755 --- a/tests/regression/tools/trigger/test_remove_trigger_cli +++ b/tests/regression/tools/trigger/test_remove_trigger_cli @@ -124,9 +124,9 @@ function test_mi () ok $? "remove-trigger mi: exit code is 0" # Pretty-fy xml before further test. - $XML_PRETTY_BIN < "${tmp_stdout_raw}" > "${tmp_stdout}" + $XML_PRETTY < "${tmp_stdout_raw}" > "${tmp_stdout}" - $XML_VALIDATE_BIN "${MI_XSD_PATH}" "${tmp_stdout}" + $MI_VALIDATE "${tmp_stdout}" ok $? "remove-trigger mi is valid" diff -u "${tmp_expected_stdout}" "${tmp_stdout}" diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 6a25aec47..517b96a5a 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -15,9 +15,14 @@ LTTNG_BIN="lttng" BABELTRACE_BIN="babeltrace" OUTPUT_DEST=/dev/null ERROR_OUTPUT_DEST=/dev/null -MI_XSD_PATH=$TESTDIR/../src/common/mi-lttng-4.0.xsd -XML_PRETTY_BIN="$TESTDIR/utils/xml-utils/pretty_xml" -XML_VALIDATE_BIN="$TESTDIR/utils/xml-utils/validate_xml" +MI_XSD_MAJOR_VERSION=4 +MI_XSD_MINOR_VERSION=0 +MI_XSD_PATH="$TESTDIR/../src/common/mi-lttng-${MI_XSD_MAJOR_VERSION}.${MI_XSD_MINOR_VERSION}.xsd" +MI_VALIDATE="$TESTDIR/utils/xml-utils/validate_xml ${MI_XSD_PATH}" + +XML_PRETTY="$TESTDIR/utils/xml-utils/pretty_xml" +XML_EXTRACT="$TESTDIR/utils/xml-utils/extract_xml" +XML_NODE_CHECK="${XML_EXTRACT} -e" # To match 20201127-175802 date_time_pattern="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9]" @@ -2292,9 +2297,9 @@ function list_triggers_matches_mi_ok () ok $? "${test_name}: exit code is 0" # Pretty-fy xml before further test. - $XML_PRETTY_BIN < "${tmp_stdout_raw}" > "${tmp_stdout}" + $XML_PRETTY < "${tmp_stdout_raw}" > "${tmp_stdout}" - $XML_VALIDATE_BIN "${MI_XSD_PATH}" "${tmp_stdout}" + $MI_VALIDATE "${tmp_stdout}" ok $? "list-trigger mi is valid" diff -u "${expected_stdout_file}" "${tmp_stdout}" -- 2.34.1