commit 48ecf06d9b6962941507a55715380cb34996a94b
Author: Kornel Benko <[email protected]>
Date: Sun May 7 13:49:10 2017 +0200
Cmake keytests: Don't care for lyx still not finished.
The called script keytest.py already takes care of that.
---
development/autotests/single-test.cmake | 43 ++++++++++++++++++-------------
1 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/development/autotests/single-test.cmake
b/development/autotests/single-test.cmake
index 300b6d7..0528666 100755
--- a/development/autotests/single-test.cmake
+++ b/development/autotests/single-test.cmake
@@ -28,25 +28,32 @@
set(KEYTEST "${AUTOTEST_ROOT}/keytest.py")
-execute_process(COMMAND pidof ${LYX} OUTPUT_VARIABLE LYX_PID RESULT_VARIABLE
pidstat OUTPUT_VARIABLE pidres)
-message(STATUS "pidres = ${pidres}")
-if (NOT pidstat)
- # lyx already running, remove trailing '\n' from pid
- string(REGEX REPLACE "\n" "" pidres ${pidres})
- execute_process(COMMAND wmctrl -l -p OUTPUT_VARIABLE _wmco)
- string(REGEX REPLACE "[\n]+" ";" _wmc ${_wmco})
- foreach(_w ${_wmc})
- string(REGEX MATCH "${pidres}" _wr ${_w})
- if (${_wr} MATCHES ${pidres})
- # this entry contains the pid, go search for X11-window-id
- string(REGEX REPLACE " .*" "" _wr ${_w})
- set(LYX_WINDOW_NAME ${_wr})
- message(STATUS "Set LYX_WINDOW_NAME to ${_wr}")
+if(0)
+ # This thread works, but the sollution in keytest.py is faster
+ #-------------------------------------------------------------
+ # Try to wait some seconds until the previous lyx stopped
+ # but not more than 30 seconds
+ message(STATUS "Wait for maximal 30 seconds until the previous lyx finishes")
+ set(lcount 0)
+ set(pidstat 1)
+ while (NOT lcount GREATER 30)
+ MATH(EXPR lcount "${lcount} + 1")
+ execute_process(COMMAND pidof ${LYX} OUTPUT_VARIABLE LYX_PID
RESULT_VARIABLE pidstat OUTPUT_VARIABLE pidres)
+ if (pidstat)
+ break()
endif()
- endforeach()
-else()
- set(pidres "")
- set(LYX_WINDOW_NAME "")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1)
+ endwhile()
+
+ if (lcount GREATER 1)
+ # We had to wait for some seconds
+ message(STATUS "There was still some lyx in way(${lcount})")
+ endif()
+ if (NOT pidstat)
+ # lyx still running, remove trailing '\n' from pid
+ string(REGEX REPLACE "\n" "" pidres ${pidres})
+ message(FATAL_ERROR "Old lyx with pid ${pidres} still running")
+ endif()
endif()
#check for plausible DISPLAY environment (needed bei keytests)