mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 05:53:59 +00:00
Override all XDG paths when running tests
This is far preferable to the per-test XDG overrides that we may or may not remember to add the next time around. Also rename all the directories so it is clear via which variable a file made its way into that path.
This commit is contained in:
parent
a29b5b6e8f
commit
4c2a0de5de
1 changed files with 31 additions and 10 deletions
|
@ -60,13 +60,22 @@ endif()
|
||||||
|
|
||||||
# Prep the environment for running the unit tests.
|
# Prep the environment for running the unit tests.
|
||||||
add_custom_target(test_prep
|
add_custom_target(test_prep
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TEST_DIR}/data
|
# Add directories hard-coded into the tests
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TEST_DIR}/home
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TEST_DIR}/data
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TEST_DIR}/temp
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_DIR}/data
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TEST_DIR}/temp
|
||||||
${TEST_DIR}/data ${TEST_DIR}/home ${TEST_DIR}/temp
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_DIR}/temp
|
||||||
DEPENDS tests_buildroot_target tests_dir
|
|
||||||
USES_TERMINAL)
|
# Add the XDG_* directories
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TEST_DIR}/xdg_data
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_DIR}/xdg_data
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TEST_DIR}/xdg_config
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_DIR}/xdg_config
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TEST_DIR}/xdg_runtime
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_DIR}/xdg_runtime
|
||||||
|
|
||||||
|
DEPENDS tests_buildroot_target tests_dir
|
||||||
|
USES_TERMINAL)
|
||||||
|
|
||||||
# Define our individual tests.
|
# Define our individual tests.
|
||||||
# Each test is conceptually independent.
|
# Each test is conceptually independent.
|
||||||
|
@ -74,18 +83,30 @@ add_custom_target(test_prep
|
||||||
# So define both a normal target, and a serial variant which enforces ordering.
|
# So define both a normal target, and a serial variant which enforces ordering.
|
||||||
foreach(TESTTYPE test serial_test)
|
foreach(TESTTYPE test serial_test)
|
||||||
add_custom_target(${TESTTYPE}_low_level
|
add_custom_target(${TESTTYPE}_low_level
|
||||||
COMMAND env XDG_DATA_HOME=test/data XDG_CONFIG_HOME=test/home ./fish_tests
|
COMMAND env XDG_DATA_HOME=${CMAKE_CURRENT_BINARY_DIR}/test/xdg_data
|
||||||
|
XDG_CONFIG_HOME=${CMAKE_CURRENT_BINARY_DIR}/test/xdg_config
|
||||||
|
XDG_RUNTIME_HOME=${CMAKE_CURRENT_BINARY_DIR}/test/xdg_runtime
|
||||||
|
./fish_tests
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
DEPENDS fish_tests
|
DEPENDS fish_tests
|
||||||
USES_TERMINAL)
|
USES_TERMINAL)
|
||||||
|
|
||||||
add_custom_target(${TESTTYPE}_fishscript
|
add_custom_target(${TESTTYPE}_fishscript
|
||||||
COMMAND cd tests && ${TEST_ROOT_DIR}/bin/fish test.fish
|
COMMAND
|
||||||
|
cd tests &&
|
||||||
|
env XDG_DATA_HOME=${CMAKE_CURRENT_BINARY_DIR}/test/xdg_data
|
||||||
|
XDG_CONFIG_HOME=${CMAKE_CURRENT_BINARY_DIR}/test/xdg_config
|
||||||
|
XDG_RUNTIME_HOME=${CMAKE_CURRENT_BINARY_DIR}/test/xdg_runtime
|
||||||
|
${TEST_ROOT_DIR}/bin/fish test.fish
|
||||||
DEPENDS test_prep
|
DEPENDS test_prep
|
||||||
USES_TERMINAL)
|
USES_TERMINAL)
|
||||||
|
|
||||||
add_custom_target(${TESTTYPE}_interactive
|
add_custom_target(${TESTTYPE}_interactive
|
||||||
COMMAND cd tests && ${TEST_ROOT_DIR}/bin/fish interactive.fish
|
COMMAND cd tests &&
|
||||||
|
env XDG_DATA_HOME=${CMAKE_CURRENT_BINARY_DIR}/test/xdg_data
|
||||||
|
XDG_CONFIG_HOME=${CMAKE_CURRENT_BINARY_DIR}/test/xdg_config
|
||||||
|
XDG_RUNTIME_HOME=${CMAKE_CURRENT_BINARY_DIR}/test/xdg_runtime
|
||||||
|
${TEST_ROOT_DIR}/bin/fish interactive.fish
|
||||||
DEPENDS test_prep
|
DEPENDS test_prep
|
||||||
USES_TERMINAL)
|
USES_TERMINAL)
|
||||||
endforeach(TESTTYPE)
|
endforeach(TESTTYPE)
|
||||||
|
|
Loading…
Reference in a new issue