]> git.lyx.org Git - features.git/commitdiff
autotests: clean up .emergency file of input .lyx
authorScott Kostyshak <skostysh@lyx.org>
Sun, 27 Jan 2013 11:21:18 +0000 (06:21 -0500)
committerScott Kostyshak <skostysh@lyx.org>
Tue, 29 Jan 2013 21:18:08 +0000 (16:18 -0500)
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
development/autotests/single-test.sh

index 89a6fdd5dee62894990193ce5a07f1dc3d1e6071..3f452cc5c7ed3c79deea36c7e220c72e0937c263 100755 (executable)
@@ -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()
index 72b8eeb036c299f5e8ee9011465e673c974c7e64..3cf509ae0104843bb8eeb5cbd05aba9c0d1cf0b0 100755 (executable)
@@ -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)