summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorAdrian Negreanu <adrian.m.negreanu@intel.com>2015-05-15 14:30:11 (GMT)
committerAdrian Negreanu <adrian.m.negreanu@intel.com>2015-05-15 16:34:41 (GMT)
commit2e099b1950eee2c3a0d5d8ae4b25575caeb938b1 (patch)
tree4db52f4b6a2078ede1554bf586d012eb8d58be4f /testing
parentac576bd974ac27bc1f395e8ae6c77b19f800b6db (diff)
downloadDoxygen-2e099b1950eee2c3a0d5d8ae4b25575caeb938b1.zip
Doxygen-2e099b1950eee2c3a0d5d8ae4b25575caeb938b1.tar.gz
Doxygen-2e099b1950eee2c3a0d5d8ae4b25575caeb938b1.tar.bz2
use cmake
runtest.pl replaced by testing/test_driver.cmake version.py replaced by cmake/version.cmake lang_cfg.py replaced by cmake/lang_cfg.cmake settings.py implemented in src/CMakeLists.txt increasebuffer.py replaced by defining the YY_BUF_SIZE and YY_READ_BUF_SIZE Signed-off-by: Adrian Negreanu <adrian.m.negreanu@intel.com>
Diffstat (limited to 'testing')
-rw-r--r--testing/CMakeLists.txt60
-rw-r--r--testing/test_driver.cmake29
2 files changed, 89 insertions, 0 deletions
diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt
new file mode 100644
index 0000000..cb9479d
--- /dev/null
+++ b/testing/CMakeLists.txt
@@ -0,0 +1,60 @@
+find_program(XMLLINT NAMES xmllint)
+find_program(DIFF NAMES diff)
+
+file(GLOB test_files "[0-9][0-9][0-9]_*.*")
+foreach(test_file ${test_files})
+ if ( ${test_file} MATCHES "([0-9][0-9][0-9])_")
+ set(test_id ${CMAKE_MATCH_1})
+ set(test_out ${CMAKE_BINARY_DIR}/testing/${test_id})
+ get_filename_component(test_dirname ${test_file} DIRECTORY)
+ get_filename_component(test_basename ${test_file} NAME)
+ set(doxyfile ${test_out}/Doxyfile)
+
+ # setup the test directory
+ execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${test_out})
+ execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${test_out})
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/testing/Doxyfile ${test_out})
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${test_file} ${test_out})
+ file(APPEND ${doxyfile} "STRIP_FROM_PATH = ${test_out}\n")
+ file(APPEND ${doxyfile} "INPUT = ${test_basename}\n")
+
+ # extract config lines from test files
+ file(STRINGS "${test_basename}" test_file_config REGEX "// [a-z]+: .*")
+
+ # clear the lists
+ set(test_objective)
+ set(test_config)
+ set(test_check)
+
+ # turn the config lines into lists
+ foreach(line IN LISTS test_file_config)
+ if ("${line}" MATCHES "//[ ]*([a-zA-Z]+)[ ]*:[ ]*(.*)")
+ list(APPEND test_${CMAKE_MATCH_1} ${CMAKE_MATCH_2})
+ endif()
+ endforeach()
+ foreach(line IN LISTS test_config)
+ # append the config line to Doxyfile
+ file(APPEND ${doxyfile} "${line}\n")
+ # in case this is an INPUT line, copy the files to test directory
+ if ("${line}" MATCHES "INPUT[ ]*=(.*)")
+ separate_arguments(items UNIX_COMMAND "${CMAKE_MATCH_1}")
+ foreach(i IN LISTS items)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${test_dirname}/${i} ${test_out})
+ endforeach()
+ endif()
+ endforeach()
+ # replace spaces with semicolons so it can be passed as argument
+ separate_arguments(test_check UNIX_COMMAND "${test_check}")
+ add_test(NAME test_${test_id}
+ WORKING_DIRECTORY ${test_out}
+ COMMAND cmake
+ -D check=${test_check}
+ -D dirname=${test_dirname}/${test_id}
+ -D top=${CMAKE_SOURCE_DIR}
+ -D doxygen=${EXECUTABLE_OUTPUT_PATH}/doxygen
+ -D diff=${DIFF}
+ -D xmllint=${XMLLINT}
+ -P ${CMAKE_SOURCE_DIR}/testing/test_driver.cmake
+ )
+ endif()
+endforeach()
diff --git a/testing/test_driver.cmake b/testing/test_driver.cmake
new file mode 100644
index 0000000..ca591c2
--- /dev/null
+++ b/testing/test_driver.cmake
@@ -0,0 +1,29 @@
+include(${top}/cmake/version.cmake)
+
+macro(check_rv)
+ if (${ARGV0})
+ message(FATAL_ERROR "test failed")
+ endif()
+endmacro()
+
+execute_process( COMMAND ${doxygen} Doxyfile RESULT_VARIABLE rv)
+check_rv(${rv})
+
+foreach (_check IN LISTS check)
+ set(xml_file "out_${_check}")
+
+ set(xml_cmd ${xmllint} --format --noblanks --nowarning xml/${_check} --output ${xml_file})
+ message(STATUS ${xml_cmd})
+ execute_process(COMMAND ${xml_cmd} RESULT_VARIABLE rv)
+ check_rv(${rv})
+
+ message(STATUS "CHOMP VOLATILE")
+ file(READ ${xml_file} OUT_XML)
+ string(REGEX REPLACE "version=\"${VERSION}\"" "version=\"\"" OUT_WO_VERSION_XML "${OUT_XML}")
+ file(WRITE ${xml_file} ${OUT_WO_VERSION_XML})
+
+ set(diff_cmd ${diff} -u ${xml_file} ${dirname}/${_check})
+ message(STATUS ${diff_cmd})
+ execute_process(COMMAND ${diff_cmd} RESULT_VARIABLE rv)
+ check_rv(${rv})
+endforeach()