hcttestcmds.cmd 21 KB

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