echo
}
+# Usage:
+# check_skip_kernel_test [NB_TESTS] [SKIP_MESSAGE]
+# Return 0 if LTTNG_TOOLS_DISABLE_KERNEL_TESTS was set or the current user is not a root user
+# If NB_TESTS is set, call skip() to skip number of tests.
+# If NB_TESTS is empty, just output a reason with diag.
+# An optional message can be added.
+
+function check_skip_kernel_test ()
+{
+ local num_tests="$1"
+ local skip_message="$2"
+
+ # Check for skip test kernel flag
+ if [ "$LTTNG_TOOLS_DISABLE_KERNEL_TESTS" == "1" ]; then
+ if ! test -z "$num_tests"; then
+ skip 0 "LTTNG_TOOLS_DISABLE_KERNEL_TESTS was set.${skip_message+ }${skip_message}" "$num_tests"
+ else
+ diag "LTTNG_TOOLS_DISABLE_KERNEL_TESTS was set.${skip_message+ }${skip_message}"
+ fi
+ return 0
+ fi
+
+ # Check if we are running as root
+ if [ "$(id -u)" != "0" ]; then
+ if ! test -z "$num_tests"; then
+ skip 0 "Root access is needed for kernel testing.${skip_message+ }${skip_message}" "$num_tests"
+ else
+ diag "Root access is needed for kernel testing.${skip_message+ }${skip_message}"
+ fi
+ return 0
+ fi
+
+ return 1
+}
+
# Check if base lttng-modules are present.
# Bail out on failure
function validate_lttng_modules_present ()
# Multiply time by 2 to simplify integer arithmetic
+ # Multiply time by 5 to adjust for sleeping every 0.1s
if [ -n "$timeout_s" ]; then
- dtimeleft_s=$((timeout_s * 2))
+ dtimeleft_s=$((timeout_s * 2 * 5))
fi
fi
dtimeleft_s=$((dtimeleft_s - 1))
fi
- sleep 0.5
+ sleep 0.1
done
if [ "$withtap" -eq "1" ]; then
if [ "$retval" -eq "0" ]; then
fi
# Multiply time by 2 to simplify integer arithmetic
+ # Multiply time by 5 to adjust for sleeping every 0.1s
if [ -n "$timeout_s" ]; then
- dtimeleft_s=$((timeout_s * 2))
+ dtimeleft_s=$((timeout_s * 2 * 5))
fi
if [ -n "$TEST_NO_SESSIOND" ] && [ "$TEST_NO_SESSIOND" == "1" ]; then
fi
dtimeleft_s=$((dtimeleft_s - 1))
fi
- sleep 0.5
+ sleep 0.1
done
out=1
while [ -n "$out" ]; do
fi
dtimeleft_s=$((dtimeleft_s - 1))
fi
- sleep 0.5
+ sleep 0.1
done
if [ "$withtap" -eq "1" ]; then
fi
# Multiply time by 2 to simplify integer arithmetic
+ # Multiply time by 5 to adjust for sleeping every 0.1s
if [ -n "$timeout_s" ]; then
- dtimeleft_s=$((timeout_s * 2))
+ dtimeleft_s=$((timeout_s * 2 * 5))
fi
pids="$(lttng_pgrep "$CONSUMERD_MATCH")"
fi
dtimeleft_s=$((dtimeleft_s - 1))
fi
- sleep 0.5
+ sleep 0.1
done
if [ "$withtap" -eq "1" ]; then
if [ "$retval" -eq "0" ]; then
local withtap=$1
local expected_to_fail=$2
local sess_name=$3
+ shift 3
_run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
- destroy $sess_name
+ destroy $sess_name $@
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
test "$ret" -ne "0"