2013-08-28 10:17:40 +00:00
|
|
|
# This file is part of LyX, the document processor.
|
|
|
|
# Licence details can be found in the file COPYING.
|
|
|
|
#
|
|
|
|
# Copyright (c) 2013 Kornel Benko <kornel@lyx.org>
|
|
|
|
# (c) 2013 Scott Kostyshak <skotysh@lyx.org>
|
|
|
|
#
|
|
|
|
|
|
|
|
set(TOP_SEARCH_PATH "${TOP_SRC_DIR}")
|
|
|
|
set(LYXFILES_FILE "${CMAKE_CURRENT_BINARY_DIR}/filesToScan")
|
|
|
|
file(WRITE "${LYXFILES_FILE}")
|
|
|
|
file(GLOB_RECURSE lyx_files RELATIVE "${TOP_SEARCH_PATH}" "${TOP_SEARCH_PATH}/*.lyx")
|
|
|
|
|
2019-03-30 23:15:52 +00:00
|
|
|
set(NO_SEARCH_PATHS "/attic/" "src/tex2lyx/test" "/autotests/" "development/" "/Obsolete/")
|
2013-08-28 10:17:40 +00:00
|
|
|
foreach(_f ${lyx_files})
|
2019-03-30 23:15:52 +00:00
|
|
|
set(found OFF)
|
|
|
|
foreach(_p ${NO_SEARCH_PATHS})
|
|
|
|
if (_f MATCHES "${_p}")
|
|
|
|
set(found ON)
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
if (NOT found)
|
|
|
|
file(APPEND "${LYXFILES_FILE}" "${_f}\n")
|
|
|
|
endif()
|
2013-08-28 10:17:40 +00:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
# Define the perl-script running the actual test
|
|
|
|
set(SEARCH_URL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/search_url.pl")
|
2015-11-26 13:31:15 +00:00
|
|
|
set(GET_TRANSLATORS_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/getTranslators.pl")
|
2013-08-28 10:17:40 +00:00
|
|
|
|
2013-08-28 14:50:23 +00:00
|
|
|
# Test used and as accessible expected urls
|
2013-08-28 10:17:40 +00:00
|
|
|
add_test(NAME "check_accessible_urls"
|
|
|
|
WORKING_DIRECTORY "${TOP_SEARCH_PATH}"
|
|
|
|
COMMAND ${PERL_EXECUTABLE} "${SEARCH_URL_SCRIPT}"
|
|
|
|
"filesToScan=${LYXFILES_FILE}"
|
2013-08-28 14:50:23 +00:00
|
|
|
"ignoredURLS=${CMAKE_CURRENT_SOURCE_DIR}/inaccessibleURLS"
|
2015-11-23 12:07:53 +00:00
|
|
|
"ignoredURLS=${CMAKE_CURRENT_SOURCE_DIR}/knownInvalidURLS"
|
2016-01-03 14:25:09 +00:00
|
|
|
"knownToRegisterURLS=${CMAKE_CURRENT_SOURCE_DIR}/knownToRegisterURLS"
|
2015-11-23 12:07:53 +00:00
|
|
|
"summaryFile=${TOP_BINARY_DIR}/Testing/Temporary/LastFailedAccessibleURLS.log")
|
2013-08-28 10:17:40 +00:00
|
|
|
|
|
|
|
# Test inaccessible, but revert the error marker (failed <=> passed)
|
|
|
|
# if this fails, then some url is accessible and does not belong
|
|
|
|
# to file inaccessibleURLS
|
|
|
|
add_test(NAME "check_inaccessible_urls"
|
|
|
|
WORKING_DIRECTORY "${TOP_SEARCH_PATH}"
|
|
|
|
COMMAND ${PERL_EXECUTABLE} "${SEARCH_URL_SCRIPT}"
|
|
|
|
"filesToScan=${LYXFILES_FILE}"
|
|
|
|
"selectedURLS=${CMAKE_CURRENT_SOURCE_DIR}/inaccessibleURLS"
|
2015-11-23 12:07:53 +00:00
|
|
|
"revertedURLS=${CMAKE_CURRENT_SOURCE_DIR}/inaccessibleURLS"
|
2016-01-03 14:25:09 +00:00
|
|
|
"knownToRegisterURLS=${CMAKE_CURRENT_SOURCE_DIR}/knownToRegisterURLS"
|
2015-11-23 12:07:53 +00:00
|
|
|
"summaryFile=${TOP_BINARY_DIR}/Testing/Temporary/LastFailedInaccessibleURLS.log")
|
2013-08-28 10:17:40 +00:00
|
|
|
|
|
|
|
#
|
2013-08-28 14:50:23 +00:00
|
|
|
# Test our own bad urls
|
|
|
|
# and urls used in examples which should not match valid urls
|
2013-08-28 10:17:40 +00:00
|
|
|
# if this test fails, then our testtool contains errors
|
|
|
|
add_test(NAME "check_invalid_urls"
|
|
|
|
WORKING_DIRECTORY "${TOP_SEARCH_PATH}"
|
|
|
|
COMMAND ${PERL_EXECUTABLE} "${SEARCH_URL_SCRIPT}"
|
|
|
|
"extraURLS=${CMAKE_CURRENT_SOURCE_DIR}/knownInvalidURLS"
|
2015-11-23 12:07:53 +00:00
|
|
|
"revertedURLS=${CMAKE_CURRENT_SOURCE_DIR}/knownInvalidURLS"
|
2016-01-03 14:25:09 +00:00
|
|
|
"knownToRegisterURLS=${CMAKE_CURRENT_SOURCE_DIR}/knownToRegisterURLS"
|
2015-11-23 12:07:53 +00:00
|
|
|
"summaryFile=${TOP_BINARY_DIR}/Testing/Temporary/LastFailedKnownInvalidURLS.log")
|
2013-08-28 10:17:40 +00:00
|
|
|
|
2015-11-26 13:31:15 +00:00
|
|
|
set(URL_TEST_NAMES "check_accessible_urls" "check_inaccessible_urls" "check_invalid_urls")
|
|
|
|
set_tests_properties(${URL_TEST_NAMES}
|
2016-01-03 12:02:08 +00:00
|
|
|
PROPERTIES RESOURCE_LOCK "url.lock" LABELS "url")
|
|
|
|
|
|
|
|
find_file(PHANTOMJS_EXE NAME phantomjs PATHS ENV PATH)
|
|
|
|
message(STATUS "PHANTOMJS_EXE = ${PHANTOMJS_EXE}")
|
|
|
|
if (PHANTOMJS_EXE)
|
|
|
|
add_test(NAME "check_translators"
|
|
|
|
WORKING_DIRECTORY "${TOP_BINARY_DIR}"
|
|
|
|
COMMAND ${PERL_EXECUTABLE} "${GET_TRANSLATORS_SCRIPT}")
|
|
|
|
|
|
|
|
set_tests_properties("check_translators"
|
|
|
|
PROPERTIES RESOURCE_LOCK "url.lock")
|
|
|
|
|
|
|
|
else()
|
|
|
|
message(STATUS "Cannot check translators, missing required program phantomjs")
|
|
|
|
endif()
|
2013-08-28 10:17:40 +00:00
|
|
|
|
2015-12-02 23:23:07 +00:00
|
|
|
settestlabel("check_inaccessible_urls" "inverted")
|
|
|
|
settestlabel("check_invalid_urls" "inverted")
|