X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=tests%2Futils%2Futils.sh;h=18b673b11452491bc3946abda5aa0225d53be587;hb=56f80787af0aa6c608c3927309c4cf3b595e17d2;hp=8a710fe303b10c7aa69950a9e2da6cae85823079;hpb=4ae042345b4094e98611744d9ba6c92265058fdb;p=lttng-tools.git diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 8a710fe30..18b673b11 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -1294,39 +1294,80 @@ function enable_jul_lttng_event_loglevel() function enable_log4j_lttng_event() { - sess_name=$1 - event_name="$2" - channel_name=$3 + local sess_name=$1 + local event_name=$2 + local channel_name=$3 - if [ -z $channel_name ]; then - # default channel if none specified - chan="" - else - chan="-c $channel_name" + local chan_opt=() + + # default channel if none specified + if [ -n "$channel_name" ]; then + chan_opt=("-c" "$channel_name") fi _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \ - enable-event "$event_name" $chan -s $sess_name -l - ok $? "Enable LOG4J event $event_name for session $sess_name" + enable-event "$event_name" "${chan_opt[@]}" -s "$sess_name" --log4j + ok $? "Enable LOG4J event '$event_name' for session '$sess_name'" +} + +function enable_log4j_lttng_event_filter() +{ + local sess_name=$1 + local event_name=$2 + local filter=$3 + + _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \ + enable-event "$event_name" -s "$sess_name" --log4j --filter "$filter" + ok $? "Enable LOG4J event '$event_name' with filter '$filter' for session '$sess_name'" +} + +function enable_log4j_lttng_event_filter_loglevel_only() +{ + local sess_name=$1 + local event_name=$2 + local filter=$3 + local loglevel=$4 + + _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \ + enable-event --loglevel-only "$loglevel" "$event_name" -s "$sess_name" -l --filter "$filter" + ok $? "Enable LOG4J event '$event_name' with filter '$filter' and loglevel-only '$loglevel' for session '$sess_name'" } function enable_log4j_lttng_event_loglevel() { local sess_name=$1 - local event_name="$2" + local event_name=$2 local loglevel=$3 local channel_name=$4 - if [ -z $channel_name ]; then - # default channel if none specified - chan="" - else - chan="-c $channel_name" + + # default channel if none specified + if [ -n "$channel_name" ]; then + chan_opt=("-c" "$channel_name") + fi + + _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \ + enable-event --loglevel "$loglevel" "$event_name" "${chan_opt[@]}" -s "$sess_name" --log4j + ok $? "Enable LOG4J event '$event_name' for session '$sess_name' with loglevel '$loglevel'" +} + +function enable_log4j_lttng_event_loglevel_only() +{ + local sess_name=$1 + local event_name=$2 + local loglevel=$3 + local channel_name=$4 + + local chan_opt=() + + # default channel if none specified + if [ -n "$channel_name" ]; then + chan_opt=("-c" "$channel_name") fi _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \ - enable-event --loglevel $loglevel "$event_name" $chan -s $sess_name -l - ok $? "Enable LOG4J event $event_name for session $sess_name with loglevel $loglevel" + enable-event --loglevel-only "$loglevel" "$event_name" "${chan_opt[@]}" -s "$sess_name" --log4j + ok $? "Enable LOG4J event '$event_name' for session '$sess_name' with loglevel-only '$loglevel'" } function enable_python_lttng_event() @@ -1439,8 +1480,9 @@ function disable_log4j_lttng_event () local sess_name="$1" local event_name="$2" - $TESTDIR/../src/bin/lttng/$LTTNG_BIN disable-event "$event_name" -s $sess_name -l >/dev/null 2>&1 - ok $? "Disable LOG4J event $event_name for session $sess_name" + _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \ + disable-event "$event_name" -s "$sess_name" --log4j + ok $? "Disable LOG4J event '$event_name' for session '$sess_name'" } function disable_python_lttng_event () @@ -1879,10 +1921,10 @@ function validate_metadata_event () local count=$($BABELTRACE_BIN --output-format=ctf-metadata $metadata_path | grep $event_name | wc -l) if [ "$count" -ne "$nr_event_id" ]; then - fail "Metadata match with the metadata of $count event(s) named $event_name" - diag "$count matching event id found in metadata" + fail "Metadata match with the metadata of $nr_event_id event(s) named $event_name" + diag "$count matching event names found in metadata" else - pass "Metadata match with the metadata of $count event(s) named $event_name" + pass "Metadata match with the metadata of $nr_event_id event(s) named $event_name" fi } @@ -2223,9 +2265,9 @@ function lttng_enable_rotation_size () ret=$? if [[ $expected_to_fail -eq "1" ]]; then test "$ret" -ne "0" - ok $? "Expected fail on rotate session $sess_name" + ok $? "Expected to fail to set a periodic rotation of session $sess_name" "every " $size " bytes" else - ok $ret "Rotate session $sess_name" + ok $ret "Set a scheduled rotation of session $sess_name" "every " $size " bytes" fi }