Skip to content

Commit a9d8bf5

Browse files
committed
🔨 Update runUnitTest to save log at different place for different API
1 parent 6c6d8e0 commit a9d8bf5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Plugin/buildtools/runUnitTest.ps1

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ Copyright 2023 - Studio Nyx
1414

1515
. $PSScriptRoot\dependencies.ps1
1616

17-
function WaitUnity([System.Diagnostics.ProcessStartInfo] $processInfo, $targetName, $unityProjectPath) {
17+
function WaitUnity([System.Diagnostics.ProcessStartInfo] $processInfo, $targetName, $unityProjectPath, $apiName) {
1818
$appdata = "$env:LOCALAPPDATA"
1919
$logPath = "$appdata\Unity\Editor\Editor.log"
2020
$processLogsPath = "$unityProjectPath\TestResults"
2121

2222
$processInfo.FileName = "$Env:UNITY_2021_3_17\Unity.exe"
23-
$processInfo.RedirectStandardError = "$processLogsPath\Error.log"
24-
$processInfo.RedirectStandardOutput = "$processLogsPath\Output.log"
23+
$processInfo.RedirectStandardError = "$processLogsPath$apiName\Error.log"
24+
$processInfo.RedirectStandardOutput = "$processLogsPath$apiName\Output.log"
2525
$processInfo.UseShellExecute = $false
2626

2727
$process = New-Object System.Diagnostics.Process
@@ -54,7 +54,7 @@ function WaitUnity([System.Diagnostics.ProcessStartInfo] $processInfo, $targetNa
5454

5555
if ($process.HasExited) {
5656
# Keep a local copy of Unity logs for each targets
57-
$unityLogsCopy = "$processLogsPath\$targetName.log"
57+
$unityLogsCopy = "$processLogsPath\$targetName$apiName.log"
5858
Copy-Item $logPath $unityLogsCopy
5959

6060
# Unity does not send valid keycode at the end of process operation
@@ -103,13 +103,12 @@ function RunUnitTestWithAPI($apiName) {
103103

104104
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
105105
$pinfo.Arguments = $cmdArgs
106-
WaitUnity $pinfo "UnitTest_InteropUnityCUDA" $Env:INTEROP_UNITY_CUDA_UNITY_PROJECT_ROOT
106+
WaitUnity $pinfo "UnitTest_InteropUnityCUDA" $Env:INTEROP_UNITY_CUDA_UNITY_PROJECT_ROOT $apiName
107107

108108
[xml]$c = (Get-Content $xmlPath)
109109
# Display test results
110110
$details = $c.'test-run'.'test-suite'.'test-suite'.'test-suite'.'test-case' | Select-Object name, duration, result
111111
$details | Format-Table | Out-String | ForEach-Object { Write-Host $_ }
112-
Write-Host "Passed " $c.'test-run'.'passed' "/" $c.'test-run'.'total'
113112
$resultTest = $c.'test-run'.'passed' -eq $c.'test-run'.'total'
114113
if ($resultTest -eq $True) {
115114
Write-Host "Unit tests with $apiName have passed !" -ForegroundColor Green

0 commit comments

Comments
 (0)