#!/usr/bin/env bash
t=${0##*/}; TEST_NAME=${t:5}   # basename $0 with 'test-' stripped off
# Test restart command

[ -z "$builddir" ] && export builddir=$PWD
. ${builddir}/check-common.sh

debugged_script="${top_srcdir}/test/example/${TEST_NAME}.sh"
[[ ! -r $debugged_script ]] && \
    debugged_script="${top_builddir}/test/example/${TEST_NAME}.sh"


(cd $srcdir && run_debugger $debugged_script 2>&1 >$TEST_FILE </dev/null)

cat ${TEST_FILE} | sed -e "s|restart -B --no-highlight --no-init -q -L.*restart.sh|restart -B --no-highlight --no-init -q -L ... restart.sh|" | sed -e "s|Restarting with.*restart.sh|Restarting with ... restart.sh|" >${TEST_FILTERED_FILE}

check_output $TEST_FILTERED_FILE $RIGHT_FILE
exit $?
