autotests: clean up .emergency file of input .lyx

If the test opens an existing .lyx file and crashes, it will leave
around a .emergency file. If a test with that same name is run again,
LyX will try to recover the .emergency file, which could throw
off the test.

This is implemented for both CMake and autotools.
This commit is contained in:
Scott Kostyshak 2013-01-27 06:21:18 -05:00
parent c229163a3b
commit 12a4b3aee9
2 changed files with 11 additions and 1 deletions

View File

@ -67,13 +67,17 @@ set(ENV{KEYTEST_OUTFILE} "${WORKDIR}/${KEYTEST_OUTFILE}")
set(ENV{PO_BUILD_DIR} "${PO_BUILD_DIR}")
set(ENV{MAX_DROP} 0)
set(ENV{MAX_LOOPS} 1)
string(REGEX REPLACE "-in\\.(txt|sh)$" "" _jj ${KEYTEST_INFILE})
if(EXISTS "${WORKDIR}/../${_jj}.lyx.emergency")
execute_process(
COMMAND ${CMAKE_COMMAND} -E remove -f "${WORKDIR}/../${_jj}.lyx.emergency" )
endif()
file(GLOB _testfiles RELATIVE "${WORKDIR}" "test*.*" "#test*.*")
if(_testfiles)
# remove some leftover files from previous test
execute_process(
COMMAND ${CMAKE_COMMAND} -E remove -f ${_testfiles} )
endif()
string(REGEX REPLACE "-in\\.(txt|sh)$" "" _jj ${KEYTEST_INFILE})
if(EXISTS "${AUTOTEST_ROOT}/${_jj}.lyx")
configure_file("${AUTOTEST_ROOT}/${_jj}.lyx" "${WORKDIR}/../${_jj}.lyx" COPYONLY)
endif()

View File

@ -15,6 +15,12 @@ if [ "$1" != "" ]; then
KEYTEST_INFILE="$1";
fi
BASE=$( echo $KEYTEST_INFILE | sed 's/-in\.\(txt\|sh\)$//')
if [ -e $BASE.lyx.emergency ]; then
echo "removing $BASE.lyx.emergency"
rm $BASE.lyx.emergency
fi
export MAX_DROP=0
if [ "$(pidof lyx)" != "" ]; then
export LYX_PID=$(pidof lyx)