Skip to content

Commit

Permalink
[lit] use lit.py directly to allow send parameter to lit from hcttest (
Browse files Browse the repository at this point in the history
…#5438)

This is for support adapter option for exec test when using lit.
no_priority is enabled for clang test too.

CMake behavior will be the same except not support adapter option.

Also hcttest cmd will only run cmd test for lit.
  • Loading branch information
python3kgae authored Jul 27, 2023
1 parent b97f9b9 commit 65aa41f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
4 changes: 4 additions & 0 deletions tools/clang/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ set(CLANG_TEST_PARAMS
${CLANG_TEST_PARAMS}
clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
clang_taef_site_config=${CMAKE_CURRENT_BINARY_DIR}/taef/lit.site.cfg
no_priority=True
clang_taef_exec_site_config=${CMAKE_CURRENT_BINARY_DIR}/taef_exec/lit.site.cfg
)

Expand Down Expand Up @@ -138,9 +139,12 @@ if (WIN32)
DEPENDS ClangHLSLTests
ARGS ${CLANG_TEST_EXTRA_ARGS}
)
set(TAEF_EXEC_ADAPTER "" CACHE STRING "adapter for taef exec test")

add_lit_target("check-clang-taef-exec" "Running lit suite hlsl execution test"
${CMAKE_CURRENT_SOURCE_DIR}/taef_exec
PARAMS ${CLANG_TEST_PARAMS}
adapter=${TAEF_EXEC_ADAPTER}
DEPENDS ExecHLSLTests dxexp
ARGS ${CLANG_TEST_EXTRA_ARGS}
)
Expand Down
3 changes: 2 additions & 1 deletion tools/clang/test/taef_exec/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ if config.unsupported == False:

adapter = lit_config.params.get('adapter', None)
if adapter:
extra_params.append(str.format('/p:"Adapter={}"', adapter))
if adapter != '':
extra_params.append(str.format('/p:"Adapter={}"', adapter))

agility_sdk = lit_config.params.get('agility_sdk', None)
if agility_sdk:
Expand Down
9 changes: 9 additions & 0 deletions utils/hct/hctbuild.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ set SHOW_CMAKE_LOG=0
set ENABLE_LIT=ON
set WINSDK_MIN_VERSION=10.0.17763.0
set INSTALL_DIR=
set DEFAULT_EXEC_ADAPTER=-DTAEF_EXEC_ADAPTER=

:parse_args
if "%1"=="" (
Expand Down Expand Up @@ -204,6 +205,11 @@ if "%1"=="-lit-xml-output-path" (
shift /1
shift /1 & goto :parse_args
)
if "%1"=="-default-adapter" (
set DEFAULT_EXEC_ADAPTER=-DTAEF_EXEC_ADAPTER=%~2
shift /1
shift /1 & goto :parse_args
)
rem Begin SPIRV change
if "%1"=="-spirv" (
echo SPIR-V codegen is enabled.
Expand Down Expand Up @@ -340,6 +346,9 @@ set CMAKE_OPTS=%CMAKE_OPTS% -DCLANG_CL:BOOL=OFF
set CMAKE_OPTS=%CMAKE_OPTS% -DCMAKE_SYSTEM_VERSION=%DXC_CMAKE_SYSTEM_VERSION%
set CMAKE_OPTS=%CMAKE_OPTS% -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR%

rem Setup taef exec adapter.
set CMAKE_OPTS=%CMAKE_OPTS% %DEFAULT_EXEC_ADAPTER%

rem ARM cross-compile setup
if %BUILD_ARM_CROSSCOMPILING% == 0 goto :after-cross-compile

Expand Down
20 changes: 12 additions & 8 deletions utils/hct/hcttest.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ if "%1"=="-clean" (
) else if /i "%1"=="-arm64ec" (
set BUILD_ARCH=ARM64EC
) else if "%1"=="-adapter" (
set TEST_USE_LIT=0
set TEST_ADAPTER= /p:"Adapter=%~2"
set EXEC_ADAPTER=--param adapter=%~2
shift /1
) else if "%1"=="-verbose" (
set LOG_FILTER=
Expand Down Expand Up @@ -304,15 +304,12 @@ if "%TEST_MANUAL_FILE_CHECK%"=="1" (
)

if "%TEST_USE_LIT%"=="1" (
rem LIT does not separate cmd tests from other clang hlsl tests.
if "%TEST_CMD%"=="1" (
set TEST_CLANG=1
)
rem LIT does not separate spirv tests from other clang hlsl tests.
if "%TEST_SPIRV%"=="1" (
set TEST_CLANG=1
)
if "%TEST_ALL%"=="1" (
rem check all includes clang, dxilconv, and exec
rem check all except exec.
cmake --build %HLSL_BLD_DIR% --config %BUILD_CONFIG% --target check-all
set RES_CLANG=!ERRORLEVEL!
set RES_DXILCONV=%RES_CLANG%
Expand All @@ -323,13 +320,20 @@ if "%TEST_USE_LIT%"=="1" (
cmake --build %HLSL_BLD_DIR% --config %BUILD_CONFIG% --target check-dxilconv
set RES_DXILCONV=!ERRORLEVEL!
)
if "%TEST_CMD%"=="1" (
py %BIN_DIR%\llvm-lit.py %HLSL_SRC_DIR%/tools/clang/test/DXC -v
set RES_CMD=!ERRORLEVEL!
)
if "!TEST_CLANG!"=="1" (
cmake --build %HLSL_BLD_DIR% --config %BUILD_CONFIG% --target check-clang
set RES_CLANG=!ERRORLEVEL!
set RES_CMD=%RES_CLANG%
)
if "!TEST_EXEC!"=="1" (
cmake --build %HLSL_BLD_DIR% --config %BUILD_CONFIG% --target check-clang-taef-exec
if defined EXEC_ADAPTER (
py %HLSL_SRC_DIR%/utils/lit/lit.py -sv --no-progress-bar --param build_mode=%BUILD_CONFIG% --param clang_site_config=%HLSL_BLD_DIR%/tools/clang/test/lit.site.cfg --param clang_taef_exec_site_config=%HLSL_BLD_DIR%/tools/clang/test/taef_exec/lit.site.cfg %EXEC_ADAPTER% %HLSL_SRC_DIR%/tools/clang/test/taef_exec
) else (
cmake --build %HLSL_BLD_DIR% --config %BUILD_CONFIG% --target check-clang-taef-exec
)
set RES_EXEC=!ERRORLEVEL!
)
)
Expand Down

0 comments on commit 65aa41f

Please sign in to comment.