This patch allows for autotests to modify preferences (or we could think of where we would want to run the same test with several different preferences files). We might as well also clean up the bind file, even though I don't have a specific use case in mind, but if a test changes it, it could lead to trouble for the other tests (e.g. \unbind "M-x" "command-execute" would invalidate all the tests I think).
Any thoughts? Scott
From e48e1f78363f31d28f6734f46f42a717a5883f6b Mon Sep 17 00:00:00 2001 From: Scott Kostyshak <skost...@lyx.org> Date: Thu, 14 Mar 2013 17:48:41 -0400 Subject: [PATCH] Autotests with CMake: improve test clean-up - Organize the clean-up into one place. - Add the bind and preferences files to the clean-up list. A test could have modified these, causing spillover to other tests. --- development/autotests/single-test.cmake | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/development/autotests/single-test.cmake b/development/autotests/single-test.cmake index 3f452cc..541df6e 100755 --- a/development/autotests/single-test.cmake +++ b/development/autotests/single-test.cmake @@ -49,9 +49,6 @@ set(LYX_EXE "${BINDIR}/${LYX}") set(XVKBD_EXE "${BINDIR}/xvkbd") set(ENV{XVKBD_HACKED} "1") -if(EXISTS "${WORKDIR}/.lyx/session") - execute_process(COMMAND ${CMAKE_COMMAND} -E remove -f "${WORKDIR}/.lyx/session") -endif() # Environments needed by keytest.py set(ENV{PACKAGE} ${PACKAGE}) set(ENV{LOCALE_DIR} ${LOCALE_DIR}) @@ -68,19 +65,23 @@ 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() + +# remove some leftover files from previous test +foreach(_f ".lyx/session" ".lyx/bind/user.bind" ".lyx/preferences" "../${_jj}.lyx.emergency") + if(EXISTS "${WORKDIR}/${_f}") + execute_process(COMMAND ${CMAKE_COMMAND} -E remove -f "${WORKDIR}/${_f}") + endif() +endforeach() 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() + if(EXISTS "${AUTOTEST_ROOT}/${_jj}.lyx") configure_file("${AUTOTEST_ROOT}/${_jj}.lyx" "${WORKDIR}/../${_jj}.lyx" COPYONLY) endif() + execute_process( COMMAND python ${KEYTEST} RESULT_VARIABLE KEYTEST_RES) -- 1.7.9.5