fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Daniel Rainerformat: use 4-space indents in more filesc5e4fed02

master
2.5 KiB76 linesraw
1FILE(GLOB FISH_CHECKS CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/tests/checks/*.fish)
2foreach(CHECK ${FISH_CHECKS})
3    get_filename_component(CHECK_NAME ${CHECK} NAME)
4    add_custom_target(
5        test_${CHECK_NAME}
6        COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py ${CMAKE_CURRENT_BINARY_DIR}
7            checks/${CHECK_NAME}
8        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
9        DEPENDS fish fish_indent fish_key_reader
10        USES_TERMINAL
11    )
12endforeach(CHECK)
13
14FILE(GLOB PEXPECTS CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/tests/pexpects/*.py)
15foreach(PEXPECT ${PEXPECTS})
16    get_filename_component(PEXPECT ${PEXPECT} NAME)
17    add_custom_target(
18        test_${PEXPECT}
19        COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py ${CMAKE_CURRENT_BINARY_DIR}
20            pexpects/${PEXPECT}
21        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
22        DEPENDS fish fish_indent fish_key_reader
23        USES_TERMINAL
24    )
25endforeach(PEXPECT)
26
27# Rust stuff.
28set(cargo_test_flags)
29if(DEFINED ASAN)
30    # Rust w/ -Zsanitizer=address requires explicitly specifying the --target triple or else linker
31    # errors pertaining to asan symbols will ensue.
32    if(NOT DEFINED Rust_CARGO_TARGET)
33        message(
34            FATAL_ERROR
35            "ASAN requires defining the CMake variable Rust_CARGO_TARGET to the
36            intended target triple"
37        )
38    endif()
39endif()
40if(DEFINED TSAN)
41    if(NOT DEFINED Rust_CARGO_TARGET)
42        message(
43            FATAL_ERROR
44            "TSAN requires defining the CMake variable Rust_CARGO_TARGET to the
45            intended target triple"
46        )
47    endif()
48endif()
49
50if(DEFINED Rust_CARGO_TARGET)
51    list(APPEND cargo_test_flags "--target" ${Rust_CARGO_TARGET})
52    list(APPEND cargo_test_flags "--lib")
53endif()
54
55set(max_concurrency_flag)
56if(DEFINED ENV{FISH_TEST_MAX_CONCURRENCY})
57    list(APPEND max_concurrency_flag "--max-concurrency" $ENV{FISH_TEST_MAX_CONCURRENCY})
58endif()
59
60# The top-level test target is "fish_run_tests".
61add_custom_target(fish_run_tests
62    # TODO: This should be replaced with a unified solution, possibly build_tools/check.sh.
63    COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py ${max_concurrency_flag} ${CMAKE_CURRENT_BINARY_DIR}
64    COMMAND
65        env ${VARS_FOR_CARGO} ${Rust_CARGO}
66            test
67            --no-default-features
68            --features=${FISH_CARGO_FEATURES}
69            ${CARGO_FLAGS}
70            --workspace
71            --target-dir ${rust_target_dir}
72            ${cargo_test_flags}
73    WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
74    DEPENDS fish fish_indent fish_key_reader
75    USES_TERMINAL
76)