GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — mcpproxy-go/scripts/run-unit-tests.ps1 at main · DocSpring/mcpproxy-go Expand file tree/ Copy pathrun-unit-tests.ps1More file actions 100 lines (85 loc) · 3.24 KB / Copy pathrun-unit-tests.ps1File metadata and controls100 lines (85 loc) · 3.24 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 # Windows PowerShell script for running unit tests param( [switch]$Race = $true, [switch]$Cover = $true, [string]$CoverProfile = "coverage.out", [string]$Timeout = "5m", [switch]$Verbose = $true ) Write-Host "Running MCP Proxy Unit Tests" -ForegroundColor Green Write-Host "=============================" -ForegroundColor Green # Check if Go is installed if (!(Get-Command go -ErrorAction SilentlyContinue)) { Write-Host "Error: Go is not installed" -ForegroundColor Red exit 1 } $goVersion = go version Write-Host "Go version: $goVersion" -ForegroundColor Yellow # Check if CGO is available (required for race detection) if ($Race) { $env:CGO_ENABLED = "1" $cgoTest = go env CGO_ENABLED if ($cgoTest -eq "0") { Write-Host "Warning: CGO is not available. Race detection will be disabled." -ForegroundColor Yellow Write-Host "To enable race detection, install MinGW-w64: https://www.mingw-w64.org/" -ForegroundColor Yellow $Race = $false } else { # Check if gcc is available if (!(Get-Command gcc -ErrorAction SilentlyContinue)) { Write-Host "Warning: gcc not found. Race detection will be disabled." -ForegroundColor Yellow Write-Host "To enable race detection, install MinGW-w64 and add it to PATH" -ForegroundColor Yellow $Race = $false } } } Write-Host "Test timeout: $Timeout" -ForegroundColor Yellow Write-Host "Race detection: $Race" -ForegroundColor Yellow Write-Host "Coverage: $Cover" -ForegroundColor Yellow Write-Host "" # Build the binary first to ensure everything compiles Write-Host "Building mcpproxy binary..." -ForegroundColor Yellow go build -o mcpproxy.exe ./cmd/mcpproxy if ($LASTEXITCODE -ne 0) { Write-Host "✗ Build failed" -ForegroundColor Red exit 1 } Write-Host "✓ Build successful" -ForegroundColor Green # Prepare test arguments $testArgs = @("-v", "-timeout", $Timeout) if ($Race) { $testArgs += "-race" } if ($Cover) { $testArgs += "-coverprofile=$CoverProfile" $testArgs += "-covermode=atomic" } # Add test pattern and package path $testArgs += "-run" $testArgs += "^Test[^E]" $testArgs += "./..." # Run unit tests Write-Host "Running unit tests..." -ForegroundColor Yellow Write-Host "Command: go test $($testArgs -join ' ')" -ForegroundColor Cyan & go test @testArgs if ($LASTEXITCODE -eq 0) { Write-Host "✓ Unit tests passed" -ForegroundColor Green } else { Write-Host "✗ Unit tests failed" -ForegroundColor Red # Clean up if (Test-Path "mcpproxy.exe") { Remove-Item "mcpproxy.exe" } exit 1 } # Generate coverage report if enabled if ($Cover -and (Test-Path $CoverProfile)) { Write-Host "Generating coverage report..." -ForegroundColor Yellow go tool cover -html=$CoverProfile -o coverage.html Write-Host "Coverage report generated: coverage.html" -ForegroundColor Green # Show coverage summary $coverageOutput = go tool cover -func=$CoverProfile $coverageSummary = $coverageOutput | Select-Object -Last 1 Write-Host $coverageSummary -ForegroundColor Green } # Cleanup Write-Host "Cleaning up..." -ForegroundColor Yellow if (Test-Path "mcpproxy.exe") { Remove-Item "mcpproxy.exe" } Write-Host "All tests completed successfully!" -ForegroundColor Green |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |