cmark

My personal build of CMark ✏️

CMakeLists.txt (2773B)

 1 # To get verbose output: cmake --build build --target "test" -- ARGS='-V'
 2 
 3 # By default, we run the spec tests only if python3 is available.
 4 # To require the spec tests, compile with -DSPEC_TESTS=1
 5 
 6 if (SPEC_TESTS)
 7   find_package(PythonInterp 3 REQUIRED)
 8 else(SPEC_TESTS)
 9   find_package(PythonInterp 3)
10 endif(SPEC_TESTS)
11 
12 if (CMARK_SHARED OR CMARK_STATIC)
13   add_test(NAME api_test COMMAND api_test)
14 endif()
15 
16 if (WIN32)
17   file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR}/src WIN_DLL_DIR)
18   set(NEWPATH "${WIN_DLL_DIR};$ENV{PATH}")
19   string(REPLACE ";" "\\;" NEWPATH "${NEWPATH}")
20   set_tests_properties(api_test PROPERTIES ENVIRONMENT "PATH=${NEWPATH}")
21   set(ROUNDTRIP "${CMAKE_CURRENT_SOURCE_DIR}/roundtrip.bat")
22 else(WIN32)
23   set(ROUNDTRIP "${CMAKE_CURRENT_SOURCE_DIR}/roundtrip.sh")
24 endif(WIN32)
25 
26 IF (PYTHONINTERP_FOUND)
27 
28   add_test(html_normalization
29     ${PYTHON_EXECUTABLE} "-m" "doctest"
30     "${CMAKE_CURRENT_SOURCE_DIR}/normalize.py"
31     )
32 
33   if (CMARK_SHARED)
34     add_test(spectest_library
35       ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/spec_tests.py" "--no-normalize" "--spec"
36       "${CMAKE_CURRENT_SOURCE_DIR}/spec.txt" "--library-dir" "${CMAKE_CURRENT_BINARY_DIR}/../src"
37       )
38 
39     add_test(pathological_tests_library
40       ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/pathological_tests.py"
41       "--library-dir" "${CMAKE_CURRENT_BINARY_DIR}/../src"
42       )
43 
44     add_test(roundtriptest_library
45       ${PYTHON_EXECUTABLE}
46       "${CMAKE_CURRENT_SOURCE_DIR}/roundtrip_tests.py"
47       "--spec" "${CMAKE_CURRENT_SOURCE_DIR}/spec.txt"
48       "--library-dir" "${CMAKE_CURRENT_BINARY_DIR}/../src"
49       )
50 
51     add_test(entity_library
52       ${PYTHON_EXECUTABLE}
53       "${CMAKE_CURRENT_SOURCE_DIR}/entity_tests.py"
54       "--library-dir" "${CMAKE_CURRENT_BINARY_DIR}/../src"
55       )
56   endif()
57 
58   add_test(spectest_executable
59     ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/spec_tests.py" "--no-normalize" "--spec" "${CMAKE_CURRENT_SOURCE_DIR}/spec.txt" "--program" "${CMAKE_CURRENT_BINARY_DIR}/../src/cmark"
60     )
61 
62   add_test(smartpuncttest_executable
63     ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/spec_tests.py" "--no-normalize" "--spec" "${CMAKE_CURRENT_SOURCE_DIR}/smart_punct.txt" "--program" "${CMAKE_CURRENT_BINARY_DIR}/../src/cmark --smart"
64     )
65 
66   add_test(regressiontest_executable
67     ${PYTHON_EXECUTABLE}
68     "${CMAKE_CURRENT_SOURCE_DIR}/spec_tests.py" "--no-normalize" "--spec"
69     "${CMAKE_CURRENT_SOURCE_DIR}/regression.txt" "--program"
70     "${CMAKE_CURRENT_BINARY_DIR}/../src/cmark"
71     )
72 
73 ELSE(PYTHONINTERP_FOUND)
74 
75   message("\n*** A python 3 interpreter is required to run the spec tests.\n")
76   add_test(skipping_spectests
77     echo "Skipping spec tests, because no python 3 interpreter is available.")
78 
79 ENDIF(PYTHONINTERP_FOUND)
80