Skip to content

Commit

Permalink
Refactor: test: wrapper for lttng_snapshot_del_output
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Rajotte <[email protected]>
  • Loading branch information
PSRCode committed Apr 24, 2015
1 parent 8c9cc63 commit d3b4dc2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tests/regression/tools/mi/test_mi
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ function test_snapshot () {
ok $? "Mi test: snapshot list extracted snapshot: $result expected: $snapshot_name"
#Test del output
lttng_snapshot_del_output $session_name $snapshot_id
lttng_snapshot_del_output_ok $session_name $snapshot_id
$XML_VALIDATE $OUTPUT_DEST
ok $? "Mi test: snapshot delete xsd validation"
Expand All @@ -669,7 +669,7 @@ function test_snapshot () {
ok $? "Mi test: snapshot del extracted snapshot id: $result expected: $session_name"
#Test fail on delete command
lttng_snapshot_del_output $session_name $snapshot_id 1
lttng_snapshot_del_output_fail $session_name $snapshot_id
$XML_VALIDATE $OUTPUT_DEST
ok $? "Mi test: snapshot delete xsd validation"
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/tools/snapshots/test_kernel_streaming
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function test_kernel_default_name_with_del()
return $?
fi

lttng_snapshot_del_output $SESSION_NAME 1
lttng_snapshot_del_output_ok $SESSION_NAME 1
snapshot_add_output $SESSION_NAME "net://localhost"
lttng_snapshot_record $SESSION_NAME

Expand Down
2 changes: 1 addition & 1 deletion tests/regression/tools/snapshots/test_ust_streaming
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function test_ust_default_name_with_del()
return $?
fi

lttng_snapshot_del_output $SESSION_NAME 1
lttng_snapshot_del_output_ok $SESSION_NAME 1
snapshot_add_output $SESSION_NAME "net://localhost"
lttng_snapshot_record $SESSION_NAME

Expand Down
18 changes: 14 additions & 4 deletions tests/utils/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -765,20 +765,30 @@ function lttng_snapshot_add_output_fail ()

function lttng_snapshot_del_output ()
{
local sess_name=$1
local id=$2
local expected_to_fail=$3
local expected_to_fail=$1
local sess_name=$2
local id=$3

$TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot del-output -s $sess_name $id >$OUTPUT_DEST
ret=$?
if [[ $expected_to_fail ]]; then
if [[ $expected_to_fail -eq "1" ]]; then
test "$ret" -ne "0"
ok $? "Expect fail on deletion of snapshot output id $id"
else
ok $ret "Deleted snapshot output id $id"
fi
}

function lttng_snapshot_del_output_ok ()
{
lttng_snapshot_del_output 0 "$@"
}

function lttng_snapshot_del_output_fail ()
{
lttng_snapshot_del_output 1 "$@"
}

function lttng_snapshot_record ()
{
local sess_name=$1
Expand Down

0 comments on commit d3b4dc2

Please sign in to comment.