Skip to content

Commit 5074484

Browse files
committed
fix conformance test ps1 script for python
1 parent 2c641d0 commit 5074484

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

test_scripts/run_conformance_tests_golang.ps1

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ $ConformanceTestsFolder = $args[1]
2323

2424
$current_dir = Get-Location
2525

26+
# Resolve conformance tests folder to an absolute path so it can be used
27+
# from the build subfolder (where we'll Push-Location to next).
28+
if (-not [System.IO.Path]::IsPathRooted($ConformanceTestsFolder)) {
29+
$ConformanceTestsFolder = Join-Path $current_dir $ConformanceTestsFolder
30+
}
31+
2632
$GO_BUILD_SUBFOLDER = Join-Path ([System.IO.Path]::GetTempPath()) "go_$(Split-Path $BuildFolder -Leaf)"
2733

2834
if ($env:VERBOSE -eq "1") {
@@ -60,9 +66,9 @@ try {
6066
go get
6167

6268
# Move to conformance tests folder
63-
Set-Location "$current_dir/$ConformanceTestsFolder"
69+
Set-Location $ConformanceTestsFolder
6470
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
65-
Write-Host "Error: Conformance tests folder '$current_dir/$ConformanceTestsFolder' does not exist."
71+
Write-Host "Error: Conformance tests folder '$ConformanceTestsFolder' does not exist."
6672
exit $UNRECOVERABLE_ERROR_EXIT_CODE
6773
}
6874

@@ -83,7 +89,7 @@ try {
8389
# Temporarily allow stderr output without throwing (Go may write to stderr)
8490
# ForEach-Object converts ErrorRecord objects (from stderr) to plain strings to avoid verbose error formatting
8591
$ErrorActionPreference = 'Continue'
86-
$output = go run "$current_dir/$ConformanceTestsFolder/conformance_tests.go" 2>&1 | ForEach-Object { if ($_ -is [System.Management.Automation.ErrorRecord]) { $_.Exception.Message } else { $_ } } | Out-String
92+
$output = go run (Join-Path $ConformanceTestsFolder "conformance_tests.go") 2>&1 | ForEach-Object { if ($_ -is [System.Management.Automation.ErrorRecord]) { $_.Exception.Message } else { $_ } } | Out-String
8793
$exit_code = $LASTEXITCODE
8894
$ErrorActionPreference = 'Stop'
8995

test_scripts/run_conformance_tests_python.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ if (Get-Command python3 -ErrorAction SilentlyContinue) {
3333

3434
$current_dir = Get-Location
3535

36+
# Resolve conformance tests folder to an absolute path so it can be used
37+
# from the build subfolder (where we'll Push-Location to next).
38+
if (-not [System.IO.Path]::IsPathRooted($ConformanceTestsFolder)) {
39+
$ConformanceTestsFolder = Join-Path $current_dir $ConformanceTestsFolder
40+
}
41+
3642
$PYTHON_BUILD_SUBFOLDER = Join-Path ([System.IO.Path]::GetTempPath()) "python_$(Split-Path $BuildFolder -Leaf)"
3743

3844
if ($env:VERBOSE -eq "1") {
@@ -72,7 +78,7 @@ try {
7278
# Temporarily allow stderr output without throwing (Python unittest writes progress to stderr)
7379
# ForEach-Object converts ErrorRecord objects (from stderr) to plain strings to avoid verbose error formatting
7480
$ErrorActionPreference = 'Continue'
75-
$output = & $PYTHON_CMD -m unittest discover -b -s "$current_dir/$ConformanceTestsFolder" 2>&1 | ForEach-Object { if ($_ -is [System.Management.Automation.ErrorRecord]) { $_.Exception.Message } else { $_ } } | Out-String
81+
$output = & $PYTHON_CMD -m unittest discover -b -s $ConformanceTestsFolder 2>&1 | ForEach-Object { if ($_ -is [System.Management.Automation.ErrorRecord]) { $_.Exception.Message } else { $_ } } | Out-String
7682
$exit_code = $LASTEXITCODE
7783
$ErrorActionPreference = 'Stop'
7884

0 commit comments

Comments
 (0)