+
+function metadata_regenerate ()
+{
+ local expected_to_fail=$1
+ local sess_name=$2
+
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN metadata regenerate -s $sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+ ret=$?
+ if [[ $expected_to_fail -eq "1" ]]; then
+ test "$ret" -ne "0"
+ ok $? "Expected fail on regenerate $sess_name"
+ else
+ ok $ret "Metadata regenerate $sess_name"
+ fi
+}
+
+function metadata_regenerate_ok ()
+{
+ metadata_regenerate 0 "$@"
+}
+
+function metadata_regenerate_fail ()
+{
+ metadata_regenerate 1 "$@"
+}
+
+function destructive_tests_enabled ()
+{
+ if [ ${LTTNG_ENABLE_DESTRUCTIVE_TESTS} = "will-break-my-system" ]; then
+ return 0
+ else
+ return 1
+ fi
+}