Mark Lobodzinski | f39d70c | 2015-08-14 14:24:50 -0600 | [diff] [blame] | 1 | # Powershell script for running the vktrace trace/replay auto test
|
David Pinedo | 1405a43 | 2015-06-30 15:37:50 -0600 | [diff] [blame] | 2 | # To run this test:
|
| 3 | # cd <this-dir>
|
Mark Lobodzinski | f39d70c | 2015-08-14 14:24:50 -0600 | [diff] [blame] | 4 | # powershell C:\src\LoaderAndTools\vktracereplay.ps1 [-Debug]
|
David Pinedo | 1405a43 | 2015-06-30 15:37:50 -0600 | [diff] [blame] | 5 |
|
| 6 | if ($args[0] -eq "-Debug") {
|
| 7 | $dPath = "Debug"
|
| 8 | } else {
|
| 9 | $dPath = "Release"
|
| 10 | }
|
| 11 |
|
| 12 | write-host -background black -foreground green "[ RUN ] " -nonewline
|
Mark Lobodzinski | f39d70c | 2015-08-14 14:24:50 -0600 | [diff] [blame] | 13 | write-host "vktracereplay.ps1: Vktrace trace/replay"
|
David Pinedo | 1405a43 | 2015-06-30 15:37:50 -0600 | [diff] [blame] | 14 |
|
Mark Lobodzinski | f39d70c | 2015-08-14 14:24:50 -0600 | [diff] [blame] | 15 | $gdir = "..\..\..\Vktrace"
|
David Pinedo | 1405a43 | 2015-06-30 15:37:50 -0600 | [diff] [blame] | 16 |
|
| 17 | # Create a temp directory to run the test in
|
| 18 | rm -recurse -force vktracereplay_tmp > $null 2> $null
|
| 19 | new-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
|
| 23 | cd vktracereplay_tmp
|
Mark Lobodzinski | f39d70c | 2015-08-14 14:24:50 -0600 | [diff] [blame] | 24 | cp ..\$gdir\$dPath\vkreplay.exe .
|
| 25 | cp ..\$gdir\$dPath\vktrace.exe .
|
| 26 | cp ..\$gdir\$dPath\vkreplay.dll .
|
| 27 | cp ..\$gdir\$dPath\vktrace.dll .
|
David Pinedo | 1405a43 | 2015-06-30 15:37:50 -0600 | [diff] [blame] | 28 | cp ..\..\demos\$dPath\cube.exe .
|
| 29 | cp ..\..\demos\*.png .
|
Mark Lobodzinski | f39d70c | 2015-08-14 14:24:50 -0600 | [diff] [blame] | 30 | cp ..\..\loader\$dPath\vulkan.0.dll .
|
David Pinedo | 1405a43 | 2015-06-30 15:37:50 -0600 | [diff] [blame] | 31 | cp ..\..\layers\$dPath\VKLayerScreenShot.dll .
|
| 32 |
|
| 33 | # Change PATH to the temp directory
|
| 34 | $oldpath = $Env:PATH
|
| 35 | $Env:PATH = $pwd
|
Cody Northrop | bc6ecfa | 2015-08-14 10:59:35 -0600 | [diff] [blame] | 36 | $Env:VK_LAYER_PATH = $pwd
|
David Pinedo | 1405a43 | 2015-06-30 15:37:50 -0600 | [diff] [blame] | 37 |
|
| 38 | # Do a trace and replay
|
Mark Lobodzinski | 52325c9 | 2015-08-27 11:47:25 -0600 | [diff] [blame] | 39 | & vktrace -o c01.vktrace -s 1 -p cube -a "--c 10" -l0 vktrace.dll > trace.sout 2> trace.serr
|
David Pinedo | 1405a43 | 2015-06-30 15:37:50 -0600 | [diff] [blame] | 40 | rename-item -path 1.ppm -newname 1-trace.ppm
|
Mark Lobodzinski | 52325c9 | 2015-08-27 11:47:25 -0600 | [diff] [blame] | 41 | & vkreplay -s 1 -t c01.vktrace > replay.sout 2> replay.serr
|
David Pinedo | 1405a43 | 2015-06-30 15:37:50 -0600 | [diff] [blame] | 42 | rename-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
|
| 53 | if (!(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 Lobodzinski | f39d70c | 2015-08-14 14:24:50 -0600 | [diff] [blame] | 68 | write-host "vktracereplay.ps1: Vktrace trace/replay"
|
David Pinedo | 1405a43 | 2015-06-30 15:37:50 -0600 | [diff] [blame] | 69 | write-host
|
| 70 | if ($exitstatus) {
|
| 71 | echo '1 FAILED TEST'
|
| 72 | }
|
| 73 |
|
| 74 | cd ..
|
| 75 | rm -recurse -force vktracereplay_tmp > $null 2> $null
|
| 76 | exit $exitstatus
|