From 47a4f373212b88e38eac34efed412b3d4444a58b Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Mon, 25 Nov 2024 05:03:35 +0000 Subject: [PATCH] debug --- .github/workflows/windows.yml | 30 ++++++++++++++++-------------- .pfnci/windows/GHA-test.ps1 | 29 ++++++++++++++++++----------- .pfnci/windows/_error_handler.ps1 | 17 +++++++++++++---- 3 files changed, 47 insertions(+), 29 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 11f3798fd05..8d81b518060 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -37,18 +37,20 @@ jobs: with: submodules: recursive - - name: Install gh cli - # for some reason the GPU runner image does not have gh pre-installed... - env: - # doesn't seem there's an easy way to avoid hard-coding it? - GH_MSI_URL: https://github.com/cli/cli/releases/download/v2.62.0/gh_2.62.0_windows_amd64.msi - run: | - Invoke-WebRequest -Uri "$env:GH_MSI_URL" -OutFile "gh_installer.msi" - Start-Process msiexec.exe -Wait -Verbose -ArgumentList '/i "gh_installer.msi" /qn' - $env:GH_POSSIBLE_PATHS = "C:\\Program Files\\GitHub CLI;C:\\Program Files (x86)\\GitHub CLI" - echo "GH_POSSIBLE_PATHS=$env:GH_POSSIBLE_PATHS" >> $env:GITHUB_ENV - $env:Path += ";$env:GH_POSSIBLE_PATHS" - gh --version + # - name: Install gh cli + # # for some reason the GPU runner image does not have gh pre-installed... + # env: + # # doesn't seem there's an easy way to avoid hard-coding it? + # GH_MSI_URL: https://github.com/cli/cli/releases/download/v2.62.0/gh_2.62.0_windows_amd64.msi + # run: | + # Invoke-WebRequest -Uri "$env:GH_MSI_URL" -OutFile "gh_installer.msi" + # Start-Process msiexec.exe -Wait -Verbose -ArgumentList '/i "gh_installer.msi" /qn' + # $GH_POSSIBLE_PATHS = "C:\\Program Files\\GitHub CLI", "C:\\Program Files (x86)\\GitHub CLI" + # foreach ($p in $GH_POSSIBLE_PATHS) { + # echo "$p" >> $env:GITHUB_PATH + # $env:Path += ";$p" + # } + # gh --version - name: Check system run: | @@ -115,7 +117,7 @@ jobs: # FIXME: get the version strings from a test matrix. Right now, we have # to hard code the values to what're pre-installed in the CI image. .pfnci\windows\GHA-test.ps1 -stage setup -python 3.12 -cuda 11.4 - .pfnci\windows\GHA-test.ps1 -stage build + #.pfnci\windows\GHA-test.ps1 -stage build .pfnci\windows\GHA-test.ps1 -stage test - name: Prepare cache @@ -139,7 +141,7 @@ jobs: # TODO: this is dangerous because we're overwriting the global GHA cache! # We should have another workflow that updates the global cache upon PR merge. - $env:Path += ";$env:GH_POSSIBLE_PATHS" + #$env:Path += ";$env:GH_POSSIBLE_PATHS" if ((gh cache list | Select-String -Pattern ${{ env.CACHE_KEY }}).Count -eq 1) { gh cache delete ${{ env.CACHE_KEY }} } diff --git a/.pfnci/windows/GHA-test.ps1 b/.pfnci/windows/GHA-test.ps1 index dd9e0b8070b..7bdec3e702e 100644 --- a/.pfnci/windows/GHA-test.ps1 +++ b/.pfnci/windows/GHA-test.ps1 @@ -23,12 +23,18 @@ function FindAndCheckMSVC { -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ` -property installationPath $clPath = Join-Path $vsPath "VC\Tools\MSVC\*\bin\Hostx64\x64\cl.exe" - $clPath = Get-ChildItem $clPath - - $CL_VERSION_STRING = & $clPath /? - if ($CL_VERSION_STRING -match "Version (\d+\.\d+)\.\d+") { - $CL_VERSION = [version]$matches[1] + echo "getting full name" + $clPath = (Get-ChildItem $clPath).FullName + echo "execute?" + "$clPath" + echo "get stderr" + Start-Process -NoNewWindow -RedirectStandardError cl.out -FilePath "$clPath" + $CL_VERSION_STRING = & type cl.out + if (($CL_VERSION_STRING -join " ") -match "Version (\d+\.\d+)\.\d+") { + $CL_VERSION = $matches[1] echo "Detected cl.exe version: $CL_VERSION" + } else { + echo "no match...? $CL_VERSION_STRING" } } @@ -47,8 +53,9 @@ function Main { ActivatePython $python echo "Setting up test environment" RunOrDie python -V - RunOrDie python -m pip install -U pip setuptools wheel - RunOrDie python -m pip freeze + # TODO: this is tentatively disabled as it seems slow + #RunOrDie python -m pip install -U pip setuptools wheel + #RunOrDie python -m pip freeze # Check MSVC version # TODO: we might want to be able to choose MSVC version in the future @@ -102,12 +109,12 @@ function Main { # InstallZLIB pushd tests - echo "CuPy Configuration:" - RunOrDie python -c "import cupy; print(cupy); cupy.show_config()" + #echo "CuPy Configuration:" + #RunOrDie python -c "import cupy; print(cupy); cupy.show_config()" echo "Running test..." - $pytest_tests = "cupy_tests/core_tests/test*.py" # TODO: remove me + $pytest_tests = @("cupy_tests/core_tests/test*.py") # TODO: remove me # TODO: pass timeout as a function argument? - $test_retval = RunWithTimeout -timeout 18000 -- python -m pytest -rfEX @pytest_opts @pytest_tests + $test_retval = RunWithTimeout -timeout 18000 -output "" -- python -m pytest -rfEX @pytest_opts --maxfail=10 @pytest_tests popd if ($test_retval -ne 0) { diff --git a/.pfnci/windows/_error_handler.ps1 b/.pfnci/windows/_error_handler.ps1 index 79f895d1e1d..5dfeff61d36 100644 --- a/.pfnci/windows/_error_handler.ps1 +++ b/.pfnci/windows/_error_handler.ps1 @@ -18,18 +18,27 @@ function RunWithTimeout { param( [Parameter(Mandatory=$true)] [int]$timeout, - [Parameter(Mandatory=$false)] + [Parameter(Mandatory=$true)] + [AllowEmptyString()] [string]$output, [Parameter(Mandatory=$true)] [string]$command, [Parameter(Mandatory=$true, ValueFromRemainingArguments=$true)] [string[]]$params ) - if ($PSBoundParameters.ContainsKey('output')) { - $process = Start-Process -PassThru -NoNewWindow -RedirectStandardOutput $output -FilePath $command -ArgumentList $params + if ($output) { + Write-Host "debug: $timeout" + Write-Host "debug: $output" + Write-Host "debug: $command" + Write-Host "debug: $params" + #$process = Start-Process -PassThru -NoNewWindow -RedirectStandardOutput $output -FilePath $command -ArgumentList $params } else { - $process = Start-Process -PassThru -NoNewWindow -FilePath $command -ArgumentList $params + Write-Host "debug: $timeout" + Write-Host "debug: $command" + Write-Host "debug: $params" + #$process = Start-Process -PassThru -NoNewWindow -FilePath $command -ArgumentList $params } + return -1 try { $process | Wait-Process -Timeout $timeout } catch [TimeoutException] {