2
0

hcttestcmds.cmd 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. @echo off
  2. if "%1"=="" (
  3. echo First argument to hcttestcmds should be directory with command-line tools.
  4. exit /b 1
  5. )
  6. echo Testing command line programs at %1 ...
  7. setlocal enableextensions enabledelayedexpansion
  8. set script_dir=%~dp0
  9. set testfiles=%script_dir%cmdtestfiles
  10. set Failed=0
  11. set FailingCmdWritten=0
  12. set OutputLog=%1\testcmd.log
  13. set LogOutput=1
  14. pushd %1
  15. set testname=Basic Rewriter Smoke Test
  16. call :run dxr.exe -remove-unused-globals "%testfiles%\smoke.hlsl" -Emain
  17. call :check_file log find-not g_unused
  18. if %Failed% neq 0 goto :failed
  19. echo Smoke test for dxc command line program ...
  20. set testname=Basic DXC Smoke Test
  21. call :run dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Fc smoke.hlsl.h
  22. call :check_file smoke.hlsl.h find "define void @main()" del
  23. if %Failed% neq 0 goto :failed
  24. set testname=Test extra DXC outputs together
  25. call :run dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /DDX12 /Dcheck_warning /Fh smoke.hlsl.h /Vn g_myvar /Fc smoke.ll /Fo smoke.cso /Fre smoke.reflection /Frs smoke.rootsig /Fe smoke.err
  26. call :check_file smoke.hlsl.h find g_myvar find "0x44, 0x58" find "define void @main()" del
  27. call :check_file smoke.ll find "define void @main()" del
  28. call :check_file smoke.cso del
  29. call :check_file smoke.reflection del
  30. call :check_file smoke.rootsig del
  31. call :check_file smoke.err find "warning: expression result unused" del
  32. if %Failed% neq 0 goto :failed
  33. set testname=/Fd implies /Qstrip_debug
  34. call :run dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Zi /Fd smoke.hlsl.d /Fo smoke.hlsl.Fd.dxo
  35. call :check_file smoke.hlsl.d del
  36. call :check_file smoke.hlsl.Fd.dxo
  37. if %Failed% neq 0 goto :failed
  38. call :run dxc.exe -dumpbin smoke.hlsl.Fd.dxo
  39. rem Should have debug name, and debug info should be stripped from module
  40. call :check_file log find "shader debug name: smoke.hlsl.d" find-not "DICompileUnit"
  41. if %Failed% neq 0 goto :failed
  42. rem del .pdb file if exists
  43. del %CD%\*.pdb 1>nul 2>nul
  44. set testname=/Fd implies /Qstrip_debug ; path with \ produces auto hash-named .pdb file
  45. call :run dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Zi /Fd .\ /Fo smoke.hlsl.strip
  46. rem .pdb file should be produced
  47. call :check_file *.PDB del
  48. if %Failed% neq 0 goto :failed
  49. call :run dxc.exe -dumpbin smoke.hlsl.strip
  50. rem auto debug name is hex digest + .pdb
  51. call :check_file log find-opt -r "shader debug name: [0-9a-f]*.pdb" find-not "DICompileUnit" del
  52. if %Failed% neq 0 goto :failed
  53. rem del .pdb file if exists
  54. del %CD%\*.pdb 1>nul 2>nul
  55. set testname=Embed debug info
  56. call :run dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Zi /Qembed_debug /Fo smoke.hlsl.embedpdb
  57. call :check_file smoke.hlsl.embedpdb
  58. if %Failed% neq 0 goto :failed
  59. rem .pdb file should NOT be produced
  60. call :check_file_not *.pdb del
  61. call :run dxc.exe -dumpbin smoke.hlsl.embedpdb
  62. rem should have auto debug name, which is hex digest + .pdb
  63. call :check_file log find-opt -r "shader debug name: [0-9a-f]*.pdb" find "DICompileUnit" del
  64. call :check_file smoke.hlsl.embedpdb del
  65. if %Failed% neq 0 goto :failed
  66. set testname=Auto-embed debug info when no debug output, and expect warning signifying that this is the case.
  67. call :run dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Zi /Fo smoke.hlsl.embedpdb /Fe smoke.err.embedpdb
  68. call :check_file smoke.hlsl.embedpdb
  69. rem Search for warning:
  70. call :check_file smoke.err.embedpdb find "warning: no output provided for debug - embedding PDB in shader container. Use -Qembed_debug to silence this warning." del
  71. rem .pdb file should NOT be produced
  72. call :check_file_not *.pdb del
  73. if %Failed% neq 0 goto :failed
  74. call :run dxc.exe -dumpbin smoke.hlsl.embedpdb
  75. rem should have auto debug name, which is hex digest + .pdb
  76. call :check_file log find-opt -r "shader debug name: [0-9a-f]*.pdb" find "DICompileUnit"
  77. call :check_file smoke.hlsl.embedpdb del
  78. if %Failed% neq 0 goto :failed
  79. set testname=/Zi with /Qstrip_debug and no output should not embed
  80. call :run dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Zi /Qstrip_debug /Fo smoke.hlsl.strip
  81. call :check_file smoke.hlsl.strip
  82. if %Failed% neq 0 goto :failed
  83. call :run dxc.exe -dumpbin smoke.hlsl.strip
  84. call :check_file log find-opt -r "shader debug name: [0-9a-f]*.pdb" find-not "DICompileUnit"
  85. call :check_file smoke.hlsl.strip del
  86. if %Failed% neq 0 goto :failed
  87. set testname=/Qstrip_reflect strips reflection
  88. call :run dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" -D DX12 /Qstrip_reflect /Fo smoke.hlsl.strip
  89. call :check_file smoke.hlsl.strip
  90. if %Failed% neq 0 goto :failed
  91. call :run dxc.exe -dumpbin smoke.hlsl.strip
  92. call :check_file log find-not "i32 6, !\"g\""
  93. call :check_file smoke.hlsl.strip del
  94. if %Failed% neq 0 goto :failed
  95. set testname=ast-dump
  96. call :run dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /ast-dump
  97. call :check_file log find TranslationUnitDecl
  98. if %Failed% neq 0 goto :failed
  99. set testname=Check Warning
  100. call :run dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Dcheck_warning
  101. call :check_file log find warning:
  102. if %Failed% neq 0 goto :failed
  103. set testname=/no-warnings
  104. call :run dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Dcheck_warning /no-warnings
  105. call :check_file log find-not warning:
  106. if %Failed% neq 0 goto :failed
  107. set testname=Preprocess
  108. call :run dxc.exe "%testfiles%\smoke.hlsl" /P preprocessed.hlsl
  109. call :check_file preprocessed.hlsl find "float4 main"
  110. if %Failed% neq 0 goto :failed
  111. set testname=-force_rootsig_ver
  112. call :run dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" -force_rootsig_ver rootsig_1_0
  113. if %Failed% neq 0 goto :failed
  114. call :run dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" -force_rootsig_ver rootsig_1_1
  115. if %Failed% neq 0 goto :failed
  116. call :run-fail dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" -force_rootsig_ver rootsig_2_0
  117. if %Failed% neq 0 goto :failed
  118. set testname=Root Signature target
  119. echo #define main "CBV(b0)"> test-global-rs.hlsl
  120. call :run dxc -T rootsig_1_1 test-global-rs.hlsl -rootsig-define main -Fo test-global-rs.cso
  121. call :check_file test-global-rs.cso del
  122. if %Failed% neq 0 goto :failed
  123. set testname=Local Root Signature target
  124. echo #define main "CBV(b0), RootFlags(LOCAL_ROOT_SIGNATURE)"> test-local-rs.hlsl
  125. call :run dxc -T rootsig_1_1 test-local-rs.hlsl -rootsig-define main -Fo test-local-rs.cso
  126. call :check_file test-local-rs.cso del
  127. if %Failed% neq 0 goto :failed
  128. set testname=HLSL Version
  129. call :run dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /HV 2016
  130. call :run-fail dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /HV 2015
  131. if %Failed% neq 0 goto :failed
  132. set testname=Embed Debug, Recompile
  133. call :run dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Zi /Qembed_debug /Fo smoke.cso 1> nul
  134. call :check_file smoke.cso
  135. if %Failed% neq 0 goto :failed
  136. call :run dxc.exe -dumpbin smoke.cso
  137. call :check_file log find "DICompileUnit"
  138. call :check_file smoke.cso del
  139. if %Failed% neq 0 goto :failed
  140. call :run dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Zi /Qembed_debug /Fo smoke.cso /Cc /Ni /No /Lx
  141. call :check_file smoke.cso
  142. if %Failed% neq 0 goto :failed
  143. call :run dxc.exe -dumpbin smoke.cso
  144. call :check_file log find "DICompileUnit"
  145. if %Failed% neq 0 goto :failed
  146. call :run dxc.exe smoke.cso /recompile
  147. if %Failed% neq 0 goto :failed
  148. call :run dxc.exe smoke.cso /recompile /T ps_6_0 /E main
  149. if %Failed% neq 0 goto :failed
  150. set testname=Strip Debug, Recompile PDB
  151. call :run dxc.exe /T ps_6_0 "%testfiles%\smoke.hlsl" /Zi /Fd smoke.pdb 1> nul
  152. call :check_file smoke.pdb
  153. if %Failed% neq 0 goto :failed
  154. call :run dxc.exe -dumpbin smoke.pdb
  155. call :check_file log find "DICompileUnit"
  156. if %Failed% neq 0 goto :failed
  157. call :run dxc.exe smoke.pdb /recompile > smoke.pdb.ll
  158. if %Failed% neq 0 goto :failed
  159. call :run dxc.exe smoke.pdb /recompile /T ps_6_0 /E main
  160. if %Failed% neq 0 goto :failed
  161. call :check_file smoke.pdb del
  162. rem Note: this smoke.cso is used for a lot of other tests, and they rely on options set here
  163. set testname=Command-line Defines, Recompile
  164. call :run dxc.exe "%testfiles%\smoke.hlsl" /D "semantic = SV_Position" /T vs_6_0 /Zi /Qembed_debug /DDX12 /Fo smoke.cso
  165. call :check_file smoke.cso
  166. if %Failed% neq 0 goto :failed
  167. call :run dxc.exe smoke.cso /recompile
  168. if %Failed% neq 0 goto :failed
  169. set testname=Strip Debug from compiled object
  170. call :run dxc.exe smoke.cso /dumpbin /Qstrip_debug /Fo nodebug.cso
  171. call :check_file nodebug.cso
  172. if %Failed% neq 0 goto :failed
  173. set testname=Strip Root Signature from compiled object
  174. call :run dxc.exe smoke.cso /dumpbin /Qstrip_rootsignature /Fo norootsignature.cso
  175. call :check_file norootsignature.cso
  176. if %Failed% neq 0 goto :failed
  177. set testname=Extract rootsignature from compiled object
  178. call :run dxc.exe smoke.cso /dumpbin /extractrootsignature /Fo rootsig.cso
  179. call :check_file rootsig.cso
  180. if %Failed% neq 0 goto :failed
  181. call :check_file smoke.cso del
  182. set testname=Add rootsignature to compiled object
  183. call :run dxc.exe norootsignature.cso /dumpbin /setrootsignature rootsig.cso /Fo smoke.cso
  184. call :check_file rootsig.cso del
  185. rem These are still needed later:
  186. call :check_file smoke.cso
  187. call :check_file norootsignature.cso
  188. if %Failed% neq 0 goto :failed
  189. rem Check that it added by extracting
  190. call :run dxc.exe smoke.cso /dumpbin /extractrootsignature /Fo rootsig.cso
  191. rem Need these later:
  192. call :check_file smoke.cso
  193. call :check_file rootsig.cso
  194. if %Failed% neq 0 goto :failed
  195. set testname=Compile NonUniform.hlsl, extract and strip root signature
  196. call :run dxc.exe "%testfiles%\NonUniform.hlsl" /T ps_6_0 /DDX12 /Fo NonUniform.cso
  197. call :check_file NonUniform.cso
  198. if %Failed% neq 0 goto :failed
  199. call :run dxc.exe NonUniform.cso /dumpbin /Qstrip_rootsignature /Fo NonUniformNoRootSig.cso
  200. call :check_file NonUniformNoRootSig.cso
  201. if %Failed% neq 0 goto :failed
  202. call :run dxc.exe NonUniform.cso /dumpbin /extractrootsignature /Fo NonUniformRootSig.cso
  203. call :check_file NonUniformRootSig.cso
  204. if %Failed% neq 0 goto :failed
  205. set testname=Verify root signature for smoke.cso
  206. call :run dxc.exe smoke.cso /dumpbin /verifyrootsignature rootsig.cso
  207. if %Failed% neq 0 goto :failed
  208. call :run dxc.exe norootsignature.cso /dumpbin /verifyrootsignature rootsig.cso
  209. if %Failed% neq 0 goto :failed
  210. set testname=Verify root signature for NonUniform.cso
  211. call :run dxc.exe NonUniform.cso /dumpbin /verifyrootsignature NonUniformRootSig.cso
  212. if %Failed% neq 0 goto :failed
  213. call :run dxc.exe NonUniformNoRootSig.cso /dumpbin /verifyrootsignature NonUniformRootSig.cso
  214. if %Failed% neq 0 goto :failed
  215. set testname=Verify mismatched root signatures fail verification
  216. call :run-fail dxc.exe NonUniformNoRootSig.cso /dumpbin /verifyrootsignature rootsig.cso
  217. if %Failed% neq 0 goto :failed
  218. call :run-fail dxc.exe norootsignature.cso /dumpbin /verifyrootsignature NonUniformRootSig.cso
  219. if %Failed% neq 0 goto :failed
  220. set testname=Set root signature when already has one should succeed
  221. call :run dxc.exe smoke.cso /dumpbin /setrootsignature rootsig.cso /Fo smoke.rsadded.cso
  222. call :check_file smoke.rsadded.cso del
  223. if %Failed% neq 0 goto :failed
  224. set testname=Set mismatched root signature when already has one should fail
  225. call :run-fail dxc.exe smoke.cso /dumpbin /setrootsignature NonUniformRootSig.cso /Fo smoke.rsadded.cso
  226. call :check_file_not smoke.rsadded.cso del
  227. if %Failed% neq 0 goto :failed
  228. set testname=Compile TextVS.hlsl
  229. call :run dxc.exe "%testfiles%\TextVS.hlsl" /Tvs_6_0 /Zi /Qembed_debug /Fo TextVS.cso
  230. call :check_file TextVS.cso
  231. if %Failed% neq 0 goto :failed
  232. call :run dxc.exe smoke.cso /dumpbin /verifyrootsignature TextVS.cso
  233. call :check_file TextVS.cso del
  234. if %Failed% neq 0 goto :failed
  235. set testname=Set private data
  236. echo private data > private.txt
  237. call :check_file private.txt
  238. call :run dxc.exe smoke.cso /dumpbin /setprivate private.txt /Fo private.cso
  239. call :check_file private.cso
  240. if %Failed% neq 0 goto :failed
  241. call :run dxc.exe private.cso /dumpbin /setprivate private.txt /Fo private.cso
  242. call :check_file private.cso
  243. if %Failed% neq 0 goto :failed
  244. call :run dxc.exe private.cso /dumpbin /Qstrip_priv /Fo noprivate.cso
  245. call :check_file noprivate.cso
  246. if %Failed% neq 0 goto :failed
  247. call :run dxc.exe private.cso /dumpbin /getprivate private1.txt
  248. call :check_file private1.txt find "private data" del
  249. if %Failed% neq 0 goto :failed
  250. set testname=Appending and removing private data blob roundtrip
  251. call :run FC smoke.cso noprivate.cso
  252. call :check_file noprivate.cso del
  253. if %Failed% neq 0 goto :failed
  254. set testname=Strip multiple, verify stripping
  255. call :run dxc.exe private.cso /dumpbin /Qstrip_priv /Qstrip_debug /Qstrip_rootsignature /Fo noprivdebugroot.cso
  256. call :check_file noprivdebugroot.cso
  257. if %Failed% neq 0 goto :failed
  258. call :run-fail dxc.exe noprivdebugroot.cso /dumpbin /getprivate private1.txt
  259. call :check_file_not private1.txt del
  260. if %Failed% neq 0 goto :failed
  261. call :run-fail dxc.exe noprivdebugroot.cso /dumpbin /extractrootsignature rootsig1.cso
  262. call :check_file_not rootsig1.cso del
  263. if %Failed% neq 0 goto :failed
  264. call :run dxc.exe noprivdebugroot.cso /dumpbin
  265. call :check_file_not log find-not "DICompileUnit"
  266. if %Failed% neq 0 goto :failed
  267. rem Cleanup
  268. call :check_file private.cso del
  269. call :check_file noprivdebugroot.cso del
  270. if %Failed% neq 0 goto :failed
  271. set testname=dxc.exe shader model upgrade
  272. call :run dxc.exe -dumpbin smoke.cso -Fc smoke.ll
  273. rem smoke.ll is used later to assemble, so don't delete it.
  274. call :check_file smoke.ll find "DICompileUnit"
  275. if %Failed% neq 0 goto :failed
  276. set testname=dxa command line program
  277. call :run dxa.exe smoke.cso -listfiles
  278. if %Failed% neq 0 goto :failed
  279. call :check_file log find "smoke.hlsl"
  280. if %Failed% neq 0 goto :failed
  281. set testname=dxa -listparts
  282. call :run dxa.exe smoke.cso -listparts
  283. if %Failed% neq 0 goto :failed
  284. rem Check for expected parts for this container
  285. call :check_file log find DXIL find ILDB find RTS0 find PSV0 find STAT find ILDN find HASH find ISG1 find OSG1
  286. if %Failed% neq 0 goto :failed
  287. set testname=dxa extract debug module
  288. call :run dxa.exe smoke.cso -extractpart dbgmodule -o smoke.cso.dbgmodule
  289. call :check_file smoke.cso.dbgmodule
  290. if %Failed% neq 0 goto :failed
  291. call :run dxa.exe smoke.cso.dbgmodule -listfiles
  292. call :check_file log find "smoke.hlsl"
  293. if %Failed% neq 0 goto :failed
  294. set testname=dxa extract all files from debug module
  295. call :run dxa.exe smoke.cso.dbgmodule -extractfile *
  296. call :check_file log find "float4 main()"
  297. if %Failed% neq 0 goto :failed
  298. set testname=dxa extract DXIL module and build container from that
  299. call :run dxa.exe smoke.cso -extractpart module -o smoke.cso.plain.bc
  300. call :check_file smoke.cso.plain.bc
  301. if %Failed% neq 0 goto :failed
  302. call :run dxa.exe smoke.cso.plain.bc -o smoke.rebuilt-container.cso
  303. call :check_file smoke.rebuilt-container.cso del
  304. call :check_file smoke.cso.plain.bc del
  305. if %Failed% neq 0 goto :failed
  306. set testname=dxa assemble container from smoke.ll
  307. call :run dxa.exe smoke.ll -o smoke.rebuilt-container2.cso
  308. call :check_file smoke.rebuilt-container2.cso del
  309. if %Failed% neq 0 goto :failed
  310. set testname=Smoke test for dxopt command line
  311. call :run-nolog dxc /Odump /T ps_6_0 "%testfiles%\smoke.hlsl" > passes.txt
  312. call :check_file passes.txt find emit
  313. if %Failed% neq 0 goto :failed
  314. echo -print-module >> passes.txt
  315. call :run dxc /T ps_6_0 "%testfiles%\smoke.hlsl" /fcgl -Fc smoke.hl.ll
  316. call :check_file smoke.hl.ll
  317. if %Failed% neq 0 goto :failed
  318. call :run-nolog dxopt -pf passes.txt -o=smoke.opt.bc smoke.hl.ll > smoke.opt.prn.txt
  319. call :check_file smoke.opt.bc del
  320. call :check_file smoke.opt.prn.txt find MODULE-PRINT del
  321. if %Failed% neq 0 goto :failed
  322. set testname=Smoke test for dxc_batch command line
  323. call :run dxc_batch.exe -lib-link -multi-thread "%testfiles%\batch_cmds2.txt"
  324. if %Failed% neq 0 goto :failed
  325. call :run dxc_batch.exe -lib-link -multi-thread "%testfiles%\batch_cmds.txt"
  326. if %Failed% neq 0 goto :failed
  327. call :run dxc_batch.exe -multi-thread "%testfiles%\batch_cmds.txt"
  328. if %Failed% neq 0 goto :failed
  329. set testname=Smoke test for dxl command line
  330. call :run dxc.exe -T lib_6_x "%testfiles%\lib_entry4.hlsl" -Fo lib_entry4.dxbc
  331. call :check_file lib_entry4.dxbc
  332. if %Failed% neq 0 goto :failed
  333. call :run dxc.exe -T lib_6_x "%testfiles%\lib_res_match.hlsl" -Fo lib_res_match.dxbc
  334. call :check_file lib_res_match.dxbc
  335. if %Failed% neq 0 goto :failed
  336. call :run dxl.exe -T ps_6_0 lib_res_match.dxbc;lib_entry4.dxbc -Fo res_match_entry.dxbc
  337. call :check_file lib_entry4.dxbc del
  338. call :check_file lib_res_match.dxbc del
  339. call :check_file res_match_entry.dxbc del
  340. if %Failed% neq 0 goto :failed
  341. set testname=Test for denorm options
  342. call :run dxc.exe "%testfiles%\smoke.hlsl" /Tps_6_2 /denorm preserve
  343. if %Failed% neq 0 goto :failed
  344. call :run dxc.exe "%testfiles%\smoke.hlsl" /Tps_6_2 /denorm ftz
  345. if %Failed% neq 0 goto :failed
  346. call :run-fail dxc.exe "%testfiles%\smoke.hlsl" /Tps_6_2 /denorm abc
  347. if %Failed% neq 0 goto :failed
  348. call :run-fail dxc.exe "%testfiles%\smoke.hlsl" /Tps_6_1 /denorm any
  349. if %Failed% neq 0 goto :failed
  350. set testname=Test /enable-16bit-types
  351. call :run dxc.exe "%testfiles%\smoke.hlsl" /Tps_6_2 /enable-16bit-types
  352. if %Failed% neq 0 goto :failed
  353. call :run-fail dxc.exe "%testfiles%\smoke.hlsl" /Tps_6_1 /enable-16bit-types
  354. if %Failed% neq 0 goto :failed
  355. call :run-fail dxc.exe "%testfiles%\smoke.hlsl" /Tps_6_2 /enable-16bit-types /HV 2017
  356. if %Failed% neq 0 goto :failed
  357. set testname=Test file with relative path and include
  358. mkdir subfolder 2>nul
  359. mkdir inc 2>nul
  360. copy "%testfiles%\include-main.hlsl" subfolder >nul
  361. copy "%testfiles%\include-declarations.h" inc >nul
  362. call :run dxc.exe -Tps_6_0 -I inc subfolder\include-main.hlsl
  363. if %Failed% neq 0 goto :failed
  364. call :run dxc.exe -P include-main.hlsl.pp -I inc subfolder\include-main.hlsl
  365. if %Failed% neq 0 goto :failed
  366. rem SPIR-V Change Starts
  367. echo Smoke test for SPIR-V CodeGen ...
  368. set spirv_smoke_success=0
  369. dxc.exe "%testfiles%\smoke.hlsl" /T ps_6_0 -spirv 1>%CD%\smoke.spirv.log 2>&1
  370. if %errorlevel% equ 0 set spirv_smoke_success=1
  371. findstr /c:"SPIR-V CodeGen not available" %CD%\smoke.spirv.log >nul
  372. if %errorlevel% equ 0 set spirv_smoke_success=1
  373. if %spirv_smoke_success% neq 1 (
  374. echo dxc failed SPIR-V smoke test
  375. call :cleanup 2>nul
  376. exit /b 1
  377. )
  378. rem SPIR-V Change Ends
  379. call :cleanup
  380. exit /b 0
  381. :cleanup
  382. for %%f in (%cleanup_files%) do (
  383. del %%f 1>nul 2>nul
  384. )
  385. popd
  386. endlocal
  387. exit /b 0
  388. rem ============================================
  389. rem Check that output does not exist
  390. :check_file_not
  391. set check_file_pattern=%CD%\%1
  392. shift /1
  393. if exist %check_file_pattern% (
  394. call :set_failed
  395. echo Found unexpected file %check_file_pattern%
  396. if "%1"=="del" (
  397. del %check_file_pattern% 1>nul
  398. )
  399. exit /b 1
  400. )
  401. exit /b 0
  402. rem ============================================
  403. rem Check that file exists and find text
  404. :check_file
  405. rem echo check_file %*
  406. if "%1"=="log" (
  407. set check_file_pattern=%OutputLog%
  408. ) else (
  409. set check_file_pattern=%CD%\%1
  410. )
  411. if not exist %check_file_pattern% (
  412. if !Failed! equ 0 (
  413. call :set_failed
  414. echo Failed to find output file %check_file_pattern%
  415. )
  416. exit /b 1
  417. )
  418. shift /1
  419. :check_file_loop
  420. if "%1"=="" (
  421. set cleanup_files=!cleanup_files! !check_file_pattern!
  422. exit /b !Failed!
  423. ) else if "%1"=="del" (
  424. if !Failed! equ 0 (
  425. del %check_file_pattern% 1>nul
  426. )
  427. exit /b !Failed!
  428. ) else (
  429. set mode=find
  430. set find_not=0
  431. if "%1"=="find-not" (
  432. set find_not=1
  433. ) else if "%1"=="find-opt" (
  434. set mode=find-opt
  435. shift /1
  436. ) else if "%1"=="find-not-opt" (
  437. set mode=find-opt
  438. set find_not=1
  439. shift /1
  440. ) else if "%1"=="findstr" (
  441. set mode=findstr
  442. ) else if "%1"=="findstr-not" (
  443. set mode=findstr
  444. set find_not=1
  445. ) else if not "%1"=="find" (
  446. echo Error: unrecognized check_file command: %1
  447. call :set_failed
  448. exit /b 1
  449. )
  450. if "!mode!"=="find" (
  451. set findcmd=findstr /C:%2 %check_file_pattern%
  452. ) else if "!mode!"=="find-opt" (
  453. set findcmd=findstr %2 /C:%3 %check_file_pattern%
  454. ) else if "!mode!"=="findstr" (
  455. set findcmd=findstr %* %check_file_pattern%
  456. )
  457. !findcmd! 1>nul
  458. if !find_not! equ 0 (
  459. if !errorlevel! neq 0 (
  460. call :set_failed
  461. echo Failed: !findcmd!
  462. )
  463. ) else (
  464. if !errorlevel! equ 0 (
  465. call :set_failed
  466. echo Found: !findcmd!
  467. )
  468. )
  469. if "!mode!"=="findstr" (
  470. rem findstr must be last, since it uses all the rest of the args
  471. exit /b !Failed!
  472. )
  473. shift /1
  474. )
  475. shift /1
  476. goto :check_file_loop
  477. rem ============================================
  478. rem Run, log, and set Failed flag if failing
  479. :run
  480. rem echo run %*
  481. set testcmd=%*
  482. set FailingCmdWritten=0
  483. del %OutputLog% 1>nul 2>nul
  484. if %LogOutput% neq 0 (
  485. %testcmd% 1>%OutputLog% 2>&1
  486. ) else (
  487. %testcmd%
  488. )
  489. if %errorlevel% neq 0 (
  490. echo Command Returned: %errorlevel%
  491. echo See %OutputLog%
  492. call :set_failed %errorlevel%
  493. exit /b %errorlevel%
  494. )
  495. exit /b 0
  496. rem ============================================
  497. rem Run but without redirecting to log
  498. :run-nolog
  499. set LogOutput=0
  500. call :run %*
  501. set LogOutput=1
  502. exit /b %errorlevel%
  503. rem ============================================
  504. rem Run, log, and expect failing result, otherwise set Failed
  505. :run-fail
  506. set testcmd=%*
  507. %testcmd% 1>testcmd.log 2>&1
  508. if %errorlevel% equ 0 (
  509. call :set_failed
  510. exit /b 1
  511. )
  512. exit /b 0
  513. rem ============================================
  514. rem Set Failed and write testname/testcmd once.
  515. :set_failed
  516. if %FailingCmdWritten% neq 1 (
  517. if "%1"=="" (
  518. set Failed=1
  519. ) else (
  520. set Failed=%1
  521. )
  522. echo Test Failed: %testname%
  523. echo %testcmd%
  524. set FailingCmdWritten=1
  525. )
  526. exit /b 0
  527. rem ============================================
  528. rem Cleanup and return failure
  529. :failed
  530. call :cleanup 2>nul
  531. if %Failed%=="0" set Failed=1
  532. exit /b %Failed%