Skip to content

Commit

Permalink
Use env variables to disable LIT tests selectively
Browse files Browse the repository at this point in the history
This change is to disable running the targets according to env variables.
  • Loading branch information
krystian-andrzejewski authored and igcbot committed Sep 3, 2024
1 parent 507ff7f commit f7b5a52
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions IGC/Compiler/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ if(NOT TARGET igc_opt)
message("[check-igc] LIT tests disabled. Missing igc_opt target.")
return()
endif()
if(DEFINED ENV{DISABLE_check-igc})
message("[check-igc] LIT tests disabled. DISABLE_check-igc is defined as an env variable.")
return()
endif()
if(NOT IGC_OPTION__ENABLE_LIT_TESTS)
return()
endif()
Expand Down Expand Up @@ -46,11 +50,6 @@ set(IGC_LIT_TEST_DEPENDS
# The consistency can be achived by calling a process which returns the list of tests.
file(GLOB_RECURSE _tests "${IGC_TEST_SOURCE_DIR}/*.ll")
file(GLOB_RECURSE _site_config_files "${CMAKE_CURRENT_BINARY_DIR}/*/lit.site.cfg.py")
if(MSVC)
source_group(TREE "${IGC_TEST_SOURCE_DIR}" PREFIX "tests" FILES ${_tests})
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "config" FILES ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py)
source_group(TREE "${CMAKE_CURRENT_BINARY_DIR}" PREFIX "config/generated" FILES ${_site_config_files})
endif()

# This will create a target called `check-igc`, which will run all tests from
# IGC/Compiler/tests directory. The tests will be run on files in the source
Expand All @@ -68,6 +67,12 @@ else()
)
endif()

if(MSVC)
source_group(TREE "${IGC_TEST_SOURCE_DIR}" PREFIX "tests" FILES ${_tests})
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "config" FILES ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py)
source_group(TREE "${CMAKE_CURRENT_BINARY_DIR}" PREFIX "config/generated" FILES ${_site_config_files})
endif()

# Tests should not be excluded from "Build Solution" in VS.
set_target_properties(check-igc
PROPERTIES
Expand Down

0 comments on commit f7b5a52

Please sign in to comment.