do_clear_session $SESSION_NAME $tracing_active $clear_twice 0 0
stop_lttng_tracing_ok $SESSION_NAME
- validate_directory_empty $local_path
+ if [[ "$buffer_type" == "uid" ]]; then
+ validate_trace_empty $local_path
+ else # pid
+ validate_directory_empty $local_path
+ fi
destroy_lttng_session_ok $SESSION_NAME
}
if [[ "$buffer_type" == "uid" ]]; then
validate_trace_empty $TRACE_PATH
else # pid
- validate_directory_empty $TRACE_PATH
+
+ # The sessiond always created a `ust/ directory
+ # whenever the UST domain is active
+ validate_directory_empty $TRACE_PATH/ust/
fi
fi
add_context_lttng 1 -k "$@"
}
-function validate_directory_empty ()
-{
- local trace_path=$1
-
- ls -A $local_path > /dev/null 2>&1
- if [ $? -eq 0 ]; then
- pass "Directory empty"
- else
- fail "Directory empty"
- fi
-}
-
function wait_live_trace_ready ()
{
local url=$1
return $ret
}
-function validate_folder_is_empty()
+function validate_directory_empty ()
{
- local folder=$1
+ local trace_path="$1"
+
+ files="$(ls -A "$trace_path")"
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ fail "Failed to list content of directory \"$trace_path\""
+ return $ret
+ fi
- test -z "$(ls -A "$folder")"
- ok $? "Folder ${folder} is empty"
+ nb_files="$(echo -n "$files" | wc -l)"
+ ok $nb_files "Directory \"$trace_path\" is empty"
}
function validate_trace_session_ust_empty()
{
- validate_folder_is_empty "$1"/ust
+ validate_directory_empty "$1"/ust
}
function validate_trace_session_kernel_empty()