From 12a4b3aee99fde9243c6aa8f96b20cc5a585cc31 Mon Sep 17 00:00:00 2001 From: Scott Kostyshak Date: Sun, 27 Jan 2013 06:21:18 -0500 Subject: [PATCH] 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. --- development/autotests/single-test.cmake | 6 +++++- development/autotests/single-test.sh | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/development/autotests/single-test.cmake b/development/autotests/single-test.cmake index 89a6fdd5de..3f452cc5c7 100755 --- a/development/autotests/single-test.cmake +++ b/development/autotests/single-test.cmake @@ -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() diff --git a/development/autotests/single-test.sh b/development/autotests/single-test.sh index 72b8eeb036..3cf509ae01 100755 --- a/development/autotests/single-test.sh +++ b/development/autotests/single-test.sh @@ -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)