blob: 9dbbaeffa6a47ce0b0759769e80f27d9b081e076 [file] [log] [blame]
Mark Lobodzinskif39d70c2015-08-14 14:24:50 -06001# Powershell script for running the vktrace trace/replay auto test
David Pinedo1405a432015-06-30 15:37:50 -06002# To run this test:
3# cd <this-dir>
Mark Lobodzinskif39d70c2015-08-14 14:24:50 -06004# powershell C:\src\LoaderAndTools\vktracereplay.ps1 [-Debug]
David Pinedo1405a432015-06-30 15:37:50 -06005
6if ($args[0] -eq "-Debug") {
7 $dPath = "Debug"
8} else {
9 $dPath = "Release"
10}
11
12write-host -background black -foreground green "[ RUN ] " -nonewline
Mark Lobodzinskif39d70c2015-08-14 14:24:50 -060013write-host "vktracereplay.ps1: Vktrace trace/replay"
David Pinedo1405a432015-06-30 15:37:50 -060014
Mark Lobodzinskif39d70c2015-08-14 14:24:50 -060015$gdir = "..\..\..\Vktrace"
David Pinedo1405a432015-06-30 15:37:50 -060016
17# Create a temp directory to run the test in
18rm -recurse -force vktracereplay_tmp > $null 2> $null
19new-item vktracereplay_tmp -itemtype directory > $null 2> $null
20
21# Copy everything we need into the temp directory, so we
22# can make sure we are using the correct dll and exe files
23cd vktracereplay_tmp
Mark Lobodzinskif39d70c2015-08-14 14:24:50 -060024cp ..\$gdir\$dPath\vkreplay.exe .
25cp ..\$gdir\$dPath\vktrace.exe .
26cp ..\$gdir\$dPath\vkreplay.dll .
27cp ..\$gdir\$dPath\vktrace.dll .
David Pinedo1405a432015-06-30 15:37:50 -060028cp ..\..\demos\$dPath\cube.exe .
29cp ..\..\demos\*.png .
Mark Lobodzinskif39d70c2015-08-14 14:24:50 -060030cp ..\..\loader\$dPath\vulkan.0.dll .
David Pinedo1405a432015-06-30 15:37:50 -060031cp ..\..\layers\$dPath\VKLayerScreenShot.dll .
32
33# Change PATH to the temp directory
34$oldpath = $Env:PATH
35$Env:PATH = $pwd
Cody Northropbc6ecfa2015-08-14 10:59:35 -060036$Env:VK_LAYER_PATH = $pwd
David Pinedo1405a432015-06-30 15:37:50 -060037
38# Do a trace and replay
Mark Lobodzinski52325c92015-08-27 11:47:25 -060039& vktrace -o c01.vktrace -s 1 -p cube -a "--c 10" -l0 vktrace.dll > trace.sout 2> trace.serr
David Pinedo1405a432015-06-30 15:37:50 -060040rename-item -path 1.ppm -newname 1-trace.ppm
Mark Lobodzinski52325c92015-08-27 11:47:25 -060041& vkreplay -s 1 -t c01.vktrace > replay.sout 2> replay.serr
David Pinedo1405a432015-06-30 15:37:50 -060042rename-item -path 1.ppm -newname 1-replay.ppm
43
44# Force a failure - for testing this script
45#cp vulkan.dll 1-replay.ppm
46#rm 1-trace.ppm
47#rm 1-replay.ppm
48
49# Restore PATH
50$Env:PATH = $oldpath
51
52# Compare the trace file, print a message
53if (!(Test-Path 1-trace.ppm) -or !(Test-Path 1-replay.ppm)) {
54 echo 'Trace file does not exist'
55 write-host -background black -foreground red "[ FAILED ] " -nonewline;
56 $exitstatus = 1
57} else {
58 fc.exe /b 1-trace.ppm 1-replay.ppm > $null
59 if (!(Test-Path 1-trace.ppm) -or !(Test-Path 1-replay.ppm) -or $LastExitCode -eq 1) {
60 echo 'Trace files do not match'
61 write-host -background black -foreground red "[ FAILED ] " -nonewline;
62 $exitstatus = 1
63 } else {
64 write-host -background black -foreground green "[ PASSED ] " -nonewline;
65 $exitstatus = 0
66 }
67}
Mark Lobodzinskif39d70c2015-08-14 14:24:50 -060068write-host "vktracereplay.ps1: Vktrace trace/replay"
David Pinedo1405a432015-06-30 15:37:50 -060069write-host
70if ($exitstatus) {
71 echo '1 FAILED TEST'
72}
73
74cd ..
75rm -recurse -force vktracereplay_tmp > $null 2> $null
76exit $exitstatus