summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/libcroco/tests/CMakeLists.txt
blob: 1ffb9084804467040fcdbaa820881447c63f2dd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
set(testprogs
    test0
    test1
    test2
    test3
    test4
    test5
    test6
    test7
    test8
)

foreach(source ${testprogs})
    add_executable(${source} ${source}-main.c cr-test-utils.c cr-test-utils.h)

    target_include_directories(${source}
        PRIVATE
        ${CMAKE_SOURCE_DIR}/src
        ${CMAKE_BINARY_DIR}/src
        ${GLIB_INCLUDE_DIRS}
        ${LIBXML_INCLUDE_DIRS}
    )

    target_link_libraries(${source}
        croco_LIB
    )
endforeach()

if(1)
    # Run each test separately

    set(testscripts
        test-functional-notation.sh
        test-lots-of-comments.sh
        test-parsing-location.sh
        test-prop-ident.sh
        test-sel-child-class.sh
        test-several-media.sh
        test-unknown-at-rule2.sh
        test-unknown-at-rule.sh
    )

    add_test(NAME cleantest
        COMMAND ${CMAKE_SOURCE_DIR}/tests/testctl cleanup
        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    )

    foreach(source ${testprogs} ${testscripts})
        add_test(NAME ${source}
            COMMAND ${CMAKE_SOURCE_DIR}/tests/testctl run --test-and-report ${source}
            WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
        )
        set_tests_properties(${source} PROPERTIES DEPENDS "cleantest")
    endforeach()
else()
    # Run all tests at once
    add_test(NAME all-tests
        COMMAND ${CMAKE_SOURCE_DIR}/tests/testctl run
        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    )
endif()

get_property(test_names DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY TESTS)
set_property(TEST ${test_names} PROPERTY ENVIRONMENT
    "TEST_OUT_DIR=${CMAKE_CURRENT_BINARY_DIR}"
    "TEST_SOURCE_DIR=${CMAKE_SOURCE_DIR}/tests"
    "TEST_INPUTS_DIR=${CMAKE_SOURCE_DIR}/tests/test-inputs"
    "CSSLINT=${CMAKE_BINARY_DIR}/csslint/csslint"
)