Skip to content

Commit 65aa41f

Browse files
authored
[lit] use lit.py directly to allow send parameter to lit from hcttest (#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.
1 parent b97f9b9 commit 65aa41f

4 files changed

Lines changed: 27 additions & 9 deletions

File tree

tools/clang/test/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ set(CLANG_TEST_PARAMS
106106
${CLANG_TEST_PARAMS}
107107
clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
108108
clang_taef_site_config=${CMAKE_CURRENT_BINARY_DIR}/taef/lit.site.cfg
109+
no_priority=True
109110
clang_taef_exec_site_config=${CMAKE_CURRENT_BINARY_DIR}/taef_exec/lit.site.cfg
110111
)
111112

@@ -138,9 +139,12 @@ if (WIN32)
138139
DEPENDS ClangHLSLTests
139140
ARGS ${CLANG_TEST_EXTRA_ARGS}
140141
)
142+
set(TAEF_EXEC_ADAPTER "" CACHE STRING "adapter for taef exec test")
143+
141144
add_lit_target("check-clang-taef-exec" "Running lit suite hlsl execution test"
142145
${CMAKE_CURRENT_SOURCE_DIR}/taef_exec
143146
PARAMS ${CLANG_TEST_PARAMS}
147+
adapter=${TAEF_EXEC_ADAPTER}
144148
DEPENDS ExecHLSLTests dxexp
145149
ARGS ${CLANG_TEST_EXTRA_ARGS}
146150
)

tools/clang/test/taef_exec/lit.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ if config.unsupported == False:
6060

6161
adapter = lit_config.params.get('adapter', None)
6262
if adapter:
63-
extra_params.append(str.format('/p:"Adapter={}"', adapter))
63+
if adapter != '':
64+
extra_params.append(str.format('/p:"Adapter={}"', adapter))
6465

6566
agility_sdk = lit_config.params.get('agility_sdk', None)
6667
if agility_sdk:

utils/hct/hctbuild.cmd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ set SHOW_CMAKE_LOG=0
4545
set ENABLE_LIT=ON
4646
set WINSDK_MIN_VERSION=10.0.17763.0
4747
set INSTALL_DIR=
48+
set DEFAULT_EXEC_ADAPTER=-DTAEF_EXEC_ADAPTER=
4849

4950
:parse_args
5051
if "%1"=="" (
@@ -204,6 +205,11 @@ if "%1"=="-lit-xml-output-path" (
204205
shift /1
205206
shift /1 & goto :parse_args
206207
)
208+
if "%1"=="-default-adapter" (
209+
set DEFAULT_EXEC_ADAPTER=-DTAEF_EXEC_ADAPTER=%~2
210+
shift /1
211+
shift /1 & goto :parse_args
212+
)
207213
rem Begin SPIRV change
208214
if "%1"=="-spirv" (
209215
echo SPIR-V codegen is enabled.
@@ -340,6 +346,9 @@ set CMAKE_OPTS=%CMAKE_OPTS% -DCLANG_CL:BOOL=OFF
340346
set CMAKE_OPTS=%CMAKE_OPTS% -DCMAKE_SYSTEM_VERSION=%DXC_CMAKE_SYSTEM_VERSION%
341347
set CMAKE_OPTS=%CMAKE_OPTS% -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR%
342348

349+
rem Setup taef exec adapter.
350+
set CMAKE_OPTS=%CMAKE_OPTS% %DEFAULT_EXEC_ADAPTER%
351+
343352
rem ARM cross-compile setup
344353
if %BUILD_ARM_CROSSCOMPILING% == 0 goto :after-cross-compile
345354

utils/hct/hcttest.cmd

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ if "%1"=="-clean" (
183183
) else if /i "%1"=="-arm64ec" (
184184
set BUILD_ARCH=ARM64EC
185185
) else if "%1"=="-adapter" (
186-
set TEST_USE_LIT=0
187186
set TEST_ADAPTER= /p:"Adapter=%~2"
187+
set EXEC_ADAPTER=--param adapter=%~2
188188
shift /1
189189
) else if "%1"=="-verbose" (
190190
set LOG_FILTER=
@@ -304,15 +304,12 @@ if "%TEST_MANUAL_FILE_CHECK%"=="1" (
304304
)
305305

306306
if "%TEST_USE_LIT%"=="1" (
307-
rem LIT does not separate cmd tests from other clang hlsl tests.
308-
if "%TEST_CMD%"=="1" (
309-
set TEST_CLANG=1
310-
)
307+
rem LIT does not separate spirv tests from other clang hlsl tests.
311308
if "%TEST_SPIRV%"=="1" (
312309
set TEST_CLANG=1
313310
)
314311
if "%TEST_ALL%"=="1" (
315-
rem check all includes clang, dxilconv, and exec
312+
rem check all except exec.
316313
cmake --build %HLSL_BLD_DIR% --config %BUILD_CONFIG% --target check-all
317314
set RES_CLANG=!ERRORLEVEL!
318315
set RES_DXILCONV=%RES_CLANG%
@@ -323,13 +320,20 @@ if "%TEST_USE_LIT%"=="1" (
323320
cmake --build %HLSL_BLD_DIR% --config %BUILD_CONFIG% --target check-dxilconv
324321
set RES_DXILCONV=!ERRORLEVEL!
325322
)
323+
if "%TEST_CMD%"=="1" (
324+
py %BIN_DIR%\llvm-lit.py %HLSL_SRC_DIR%/tools/clang/test/DXC -v
325+
set RES_CMD=!ERRORLEVEL!
326+
)
326327
if "!TEST_CLANG!"=="1" (
327328
cmake --build %HLSL_BLD_DIR% --config %BUILD_CONFIG% --target check-clang
328329
set RES_CLANG=!ERRORLEVEL!
329-
set RES_CMD=%RES_CLANG%
330330
)
331331
if "!TEST_EXEC!"=="1" (
332-
cmake --build %HLSL_BLD_DIR% --config %BUILD_CONFIG% --target check-clang-taef-exec
332+
if defined EXEC_ADAPTER (
333+
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
334+
) else (
335+
cmake --build %HLSL_BLD_DIR% --config %BUILD_CONFIG% --target check-clang-taef-exec
336+
)
333337
set RES_EXEC=!ERRORLEVEL!
334338
)
335339
)

0 commit comments

Comments
 (0)