mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Cmake build: autotests
Adapt to use local .gmo files
This commit is contained in:
parent
1954458817
commit
b436a03b34
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user