]> git.lyx.org Git - lyx.git/blob - development/checkurls/CMakeLists.txt
Update status
[lyx.git] / development / checkurls / CMakeLists.txt
1 # This file is part of LyX, the document processor.
2 # Licence details can be found in the file COPYING.
3 #
4 # Copyright (c) 2013 Kornel Benko <kornel@lyx.org>
5 #           (c) 2013 Scott Kostyshak <skotysh@lyx.org>
6 #
7 # Needed, because of perl scripts here
8 find_package(Perl REQUIRED)
9
10 # create file the lyx-files-list
11 set(TOP_SEARCH_PATH "${TOP_SRC_DIR}")
12 set(LYXFILES_FILE "${CMAKE_CURRENT_BINARY_DIR}/filesToScan")
13 file(WRITE "${LYXFILES_FILE}")
14 file(GLOB_RECURSE lyx_files RELATIVE "${TOP_SEARCH_PATH}" "${TOP_SEARCH_PATH}/*.lyx")
15
16 foreach(_f ${lyx_files})
17   file(APPEND "${LYXFILES_FILE}" "${_f}\n")
18 endforeach()
19
20 # Define the perl-script running the actual test
21 set(SEARCH_URL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/search_url.pl")
22 set(GET_TRANSLATORS_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/getTranslators.pl")
23
24 # Test used and as accessible expected urls
25 add_test(NAME "check_accessible_urls"
26   WORKING_DIRECTORY "${TOP_SEARCH_PATH}"
27   COMMAND ${PERL_EXECUTABLE} "${SEARCH_URL_SCRIPT}"
28     "filesToScan=${LYXFILES_FILE}"
29     "ignoredURLS=${CMAKE_CURRENT_SOURCE_DIR}/inaccessibleURLS"
30     "ignoredURLS=${CMAKE_CURRENT_SOURCE_DIR}/knownInvalidURLS"
31     "knownToRegisterURLS=${CMAKE_CURRENT_SOURCE_DIR}/knownToRegisterURLS"
32     "summaryFile=${TOP_BINARY_DIR}/Testing/Temporary/LastFailedAccessibleURLS.log")
33
34 # Test inaccessible, but revert the error marker (failed <=> passed)
35 # if this fails, then some url is accessible and does not belong
36 # to file inaccessibleURLS
37 add_test(NAME "check_inaccessible_urls"
38   WORKING_DIRECTORY "${TOP_SEARCH_PATH}"
39   COMMAND ${PERL_EXECUTABLE} "${SEARCH_URL_SCRIPT}"
40     "filesToScan=${LYXFILES_FILE}"
41     "selectedURLS=${CMAKE_CURRENT_SOURCE_DIR}/inaccessibleURLS"
42     "revertedURLS=${CMAKE_CURRENT_SOURCE_DIR}/inaccessibleURLS"
43     "knownToRegisterURLS=${CMAKE_CURRENT_SOURCE_DIR}/knownToRegisterURLS"
44     "summaryFile=${TOP_BINARY_DIR}/Testing/Temporary/LastFailedInaccessibleURLS.log")
45
46 #
47 # Test our own bad urls
48 # and urls used in examples which should not match valid urls
49 # if this test fails, then our testtool contains errors
50 add_test(NAME "check_invalid_urls"
51   WORKING_DIRECTORY "${TOP_SEARCH_PATH}"
52   COMMAND ${PERL_EXECUTABLE} "${SEARCH_URL_SCRIPT}"
53     "extraURLS=${CMAKE_CURRENT_SOURCE_DIR}/knownInvalidURLS"
54     "revertedURLS=${CMAKE_CURRENT_SOURCE_DIR}/knownInvalidURLS"
55     "knownToRegisterURLS=${CMAKE_CURRENT_SOURCE_DIR}/knownToRegisterURLS"
56     "summaryFile=${TOP_BINARY_DIR}/Testing/Temporary/LastFailedKnownInvalidURLS.log")
57
58 set(URL_TEST_NAMES "check_accessible_urls" "check_inaccessible_urls" "check_invalid_urls")
59 set_tests_properties(${URL_TEST_NAMES}
60         PROPERTIES RESOURCE_LOCK "url.lock" LABELS "url")
61
62 find_file(PHANTOMJS_EXE NAME phantomjs PATHS ENV PATH)
63 message(STATUS "PHANTOMJS_EXE = ${PHANTOMJS_EXE}")
64 if (PHANTOMJS_EXE)
65   add_test(NAME "check_translators"
66     WORKING_DIRECTORY "${TOP_BINARY_DIR}"
67     COMMAND ${PERL_EXECUTABLE} "${GET_TRANSLATORS_SCRIPT}")
68
69   set_tests_properties("check_translators"
70           PROPERTIES RESOURCE_LOCK "url.lock")
71
72 else()
73   message(STATUS "Cannot check translators, missing required program phantomjs")
74 endif()
75
76 settestlabel("check_inaccessible_urls" "inverted")
77 settestlabel("check_invalid_urls" "inverted")