The branch, master, has been updated. - Log -----------------------------------------------------------------
commit b436a03b3468dd15b27ee1c35e09d79b49192996 Author: Kornel Benko <[email protected]> Date: Wed Dec 12 14:54:38 2012 +0100 Cmake build: autotests Adapt to use local .gmo files diff --git a/development/autotests/CMakeLists.txt b/development/autotests/CMakeLists.txt index cf7bd9d..3a85964 100644 --- a/development/autotests/CMakeLists.txt +++ b/development/autotests/CMakeLists.txt @@ -27,10 +27,13 @@ if(UNIX) WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}" COMMAND ${CMAKE_COMMAND} -DAUTOTEST_ROOT=${TOP_SRC_DIR}/development/autotests + -DPO_BUILD_DIR=${TOP_BINARY_DIR}/po -DKEYTEST_INFILE=${_tf} -DBINDIR=${TOP_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR} -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME} -DKEYTEST_OUTFILE=${_t}-out.txt + -DPACKAGE=${PACKAGE} + -DLOCALE_DIR=${LOCALE_DIR} -P ${TOP_SRC_DIR}/development/autotests/single-test.cmake) endforeach() add_test(NAME lyx_export diff --git a/development/autotests/keytest.py b/development/autotests/keytest.py index dffff5a..82f316c 100755 --- a/development/autotests/keytest.py +++ b/development/autotests/keytest.py @@ -250,6 +250,14 @@ max_loops = os.environ.get('MAX_LOOPS') if max_loops is None: max_loops = 3 +PACKAGE = os.environ.get('PACKAGE') +if not PACKAGE is None: + print "PACKAGE = " + PACKAGE + "\n" + +PO_BUILD_DIR = os.environ.get('PO_BUILD_DIR') +if not PO_BUILD_DIR is None: + print "PO_BUILD_DIR = " + PO_BUILD_DIR + "\n" + lyx_exe = os.environ.get('LYX_EXE') if lyx_exe is None: lyx_exe = "lyx" @@ -415,17 +423,27 @@ while not failed: else: short_code = ccode lyx_dir = os.popen("dirname \"" + lyx_exe + "\"").read().rstrip() - # on cmake-build there is no Makefile in this directory - if os.path.exists(lyx_dir + "/Makefile"): - print "Executing: grep 'PACKAGE =' " + lyx_dir + "/Makefile | sed -e 's/PACKAGE = \(.*\)/\\1/'" - lyx_name = os.popen("grep 'PACKAGE =' " + lyx_dir + "/Makefile | sed -e 's/PACKAGE = \(.*\)/\\1/'").read().rstrip() - intr_system("mkdir -p " + locale_dir + "/" + ccode + "/LC_MESSAGES") - if lyx_dir[0:3] == "../": - rel_dir = "../../" + lyx_dir + if PACKAGE is None: + # on cmake-build there is no Makefile in this directory + # so PACKAGE has to be provided + if os.path.exists(lyx_dir + "/Makefile"): + print "Executing: grep 'PACKAGE =' " + lyx_dir + "/Makefile | sed -e 's/PACKAGE = \(.*\)/\\1/'" + lyx_name = os.popen("grep 'PACKAGE =' " + lyx_dir + "/Makefile | sed -e 's/PACKAGE = \(.*\)/\\1/'").read().rstrip() else: - rel_dir = lyx_dir - intr_system("rm -f " + locale_dir + "/" + ccode + "/LC_MESSAGES/" + lyx_name + ".mo") - intr_system("ln -s " + rel_dir + "/../po/" + short_code + ".gmo " + locale_dir + "/" + ccode + "/LC_MESSAGES/" + lyx_name + ".mo") + print 'Could not determine PACKAGE name needed for translations\n' + failed = True + else: + lyx_name = PACKAGE + intr_system("mkdir -p " + locale_dir + "/" + ccode + "/LC_MESSAGES") + intr_system("rm -f " + locale_dir + "/" + ccode + "/LC_MESSAGES/" + lyx_name + ".mo") + if PO_BUILD_DIR is None: + if lyx_dir[0:3] == "../": + rel_dir = "../../" + lyx_dir + else: + rel_dir = lyx_dir + intr_system("ln -s " + rel_dir + "/../po/" + short_code + ".gmo " + locale_dir + "/" + ccode + "/LC_MESSAGES/" + lyx_name + ".mo") + else: + intr_system("ln -s " + PO_BUILD_DIR + "/" + short_code + ".gmo " + locale_dir + "/" + ccode + "/LC_MESSAGES/" + lyx_name + ".mo") else: print "Unrecognised Command '" + c + "'\n" failed = True diff --git a/development/autotests/single-test.cmake b/development/autotests/single-test.cmake index 5da1c99..f9e9a28 100755 --- a/development/autotests/single-test.cmake +++ b/development/autotests/single-test.cmake @@ -6,18 +6,23 @@ # KEYTEST_OUTFILE = xxx-out.txt # BINDIR = ${BUILD_DIR}/bin # WORKDIR = ${BUILD_DIR}/autotests/out-home +# LOCALE_DIR = ${BUILD_DIR}/autotests/locale +# PO_BUILD_DIR = ${BUILD_DIR}/po +# PACKAGE = lyx2.1 # # Script should be called like: # cmake -DAUTOTEST_ROOT=xxxx \ # -DKEYTEST_INFILE=xxxx \ # -DKEYTEST_OUTFILE=xxx \ # -DBINDIR=xxx \ -# -WWORKDIR=xxx \ +# -DWORKDIR=xxx \ +# -DLOCALE_DIR=xxx \ +# -DPO_BUILD_DIR=xxx \ +# -DPACKAGE=xxx \ # -P ${AUTOTEST_ROOT}/single-test.cmake set(KEYTEST "${AUTOTEST_ROOT}/keytest.py") -set(MAX_DROP 0) execute_process(COMMAND pidof lyx OUTPUT_VARIABLE LYX_PID RESULT_VARIABLE pidstat OUTPUT_VARIABLE pidres) message(STATUS "pidres = ${pidres}") if (NOT pidstat) @@ -43,6 +48,9 @@ set(LYX_EXE "${BINDIR}/lyx") set(XVKBD_EXE "${BINDIR}/xvkbd") # Environments needed by keytest.py +set(ENV{PACKAGE} ${PACKAGE}) +set(ENV{LOCALE_DIR} ${LOCALE_DIR}) +set(ENV{LYX_LOCALEDIR} "${WORKDIR}/../locale") set(ENV{LYX_USERDIR} ${LYX_USERDIR}) set(ENV{LYX_PID} ${pidres}) set(ENV{LYX_WINDOW_NAME} ${LYX_WINDOW_NAME}) @@ -50,6 +58,7 @@ set(ENV{LYX_EXE} ${LYX_EXE}) set(ENV{XVKBD_EXE} ${XVKBD_EXE}) set(ENV{KEYTEST_INFILE} "${AUTOTEST_ROOT}/${KEYTEST_INFILE}") set(ENV{KEYTEST_OUTFILE} "${WORKDIR}/${KEYTEST_OUTFILE}") +set(ENV{PO_BUILD_DIR} "${PO_BUILD_DIR}") set(ENV{MAX_DROP} 1) file(GLOB _testfiles RELATIVE "${WORKDIR}" "test*.*" "#test*.*") if(_testfiles) ----------------------------------------------------------------------- Summary of changes: development/autotests/CMakeLists.txt | 3 ++ development/autotests/keytest.py | 38 ++++++++++++++++++++++-------- development/autotests/single-test.cmake | 13 +++++++++- 3 files changed, 42 insertions(+), 12 deletions(-) hooks/post-receive -- The LyX Source Repository
