@@ -27,22 +27,22 @@ jobs:
2727 include :
2828 - os : " linux"
2929 name : " noavx-x64"
30- runs-on : " ubuntu-20. 04"
30+ runs-on : " ubuntu-20- 04"
3131 binary-name : " llama-server"
3232 artifact-name : " llama-linux-noavx-x64"
3333 - os : " linux"
3434 name : " avx-x64"
35- runs-on : " ubuntu-20. 04"
35+ runs-on : " ubuntu-20- 04"
3636 binary-name : " llama-server"
3737 artifact-name : " llama-linux-avx-x64"
3838 - os : " linux"
3939 name : " avx512-x64"
40- runs-on : " ubuntu-20. 04"
40+ runs-on : " ubuntu-20- 04"
4141 binary-name : " llama-server"
4242 artifact-name : " llama-linux-avx512-x64"
4343 - os : " linux"
4444 name : " vulkan-x64"
45- runs-on : " ubuntu-22. 04"
45+ runs-on : " ubuntu-22- 04"
4646 binary-name : " llama-server"
4747 artifact-name : " llama-linux-vulkan-x64"
4848
@@ -315,17 +315,53 @@ jobs:
315315 shell : pwsh
316316 run : |
317317 Write-Host "Testing binary basic functionality..."
318+
319+ # Test version command
318320 try {
319- .\llama\build\bin\${{ matrix.binary-name }} --version
321+ $versionOutput = & ".\llama\build\bin\${{ matrix.binary-name }}" --version 2>&1
322+ Write-Host "Version output:"
323+ Write-Host $versionOutput
320324 } catch {
321- Write-Host "Version check completed with exit code : $LASTEXITCODE "
325+ Write-Host "Version check failed : $($_.Exception.Message) "
322326 }
327+
323328 Write-Host "Available arguments:"
324329 try {
325- .\llama\build\bin\${{ matrix.binary-name }} --help
330+ # Use Start-Process to capture output properly and avoid exit code issues
331+ $helpProcess = Start-Process -FilePath ".\llama\build\bin\${{ matrix.binary-name }}" `
332+ -ArgumentList "--help" `
333+ -RedirectStandardOutput "help_output.txt" `
334+ -RedirectStandardError "help_error.txt" `
335+ -Wait -PassThru -WindowStyle Hidden
336+
337+ if (Test-Path "help_output.txt") {
338+ $helpContent = Get-Content "help_output.txt" -Raw
339+ if ($helpContent) {
340+ Write-Host $helpContent
341+ }
342+ }
343+
344+ if (Test-Path "help_error.txt") {
345+ $errorContent = Get-Content "help_error.txt" -Raw
346+ if ($errorContent) {
347+ Write-Host "Help stderr:"
348+ Write-Host $errorContent
349+ }
350+ }
351+
352+ Write-Host "Help command exit code: $($helpProcess.ExitCode)"
353+
326354 } catch {
327- Write-Host "Help check completed with exit code: $LASTEXITCODE"
355+ Write-Host "Help check failed: $($_.Exception.Message)"
356+ Write-Host "This might be normal for some binary versions"
328357 }
358+
359+ # Clean up temp files
360+ Remove-Item -Path "help_output.txt" -ErrorAction SilentlyContinue
361+ Remove-Item -Path "help_error.txt" -ErrorAction SilentlyContinue
362+
363+ # Don't fail the step - verification is informational
364+ Write-Host "Binary verification completed"
329365
330366 - name : Test server startup (Linux/macOS)
331367 if : runner.os != 'Windows'
@@ -593,29 +629,93 @@ jobs:
593629 run : |
594630 Write-Host "Testing ${{ matrix.binary-name }} server startup..."
595631
596- # Start server with CPU mode
632+ # Start server with CPU mode and capture output
633+ $logFile = "server_output.log"
597634 $process = Start-Process -FilePath ".\llama\build\bin\${{ matrix.binary-name }}" `
598635 -ArgumentList "--model", "models\Lucy-Q4_0.gguf", "--port", "8080", "--host", "127.0.0.1", "--n-gpu-layers", "0", "--ctx-size", "512" `
599- -WindowStyle Hidden -PassThru
636+ -WindowStyle Hidden -PassThru -RedirectStandardOutput $logFile -RedirectStandardError "server_error.log"
600637
601638 Write-Host "Server PID: $($process.Id)"
602639
603- # Wait for server to start
604- for ($i = 1; $i -le 30; $i++) {
640+ # Give server more time to start and check if process is alive
641+ Start-Sleep -Seconds 10
642+
643+ if ($process.HasExited) {
644+ Write-Host "Server process exited immediately"
645+ Write-Host "Exit code: $($process.ExitCode)"
646+ Write-Host "Server output:"
647+ if (Test-Path $logFile) { Get-Content $logFile }
648+ Write-Host "Server errors:"
649+ if (Test-Path "server_error.log") { Get-Content "server_error.log" }
650+ exit 1
651+ }
652+
653+ # Wait for server to start responding with better error handling
654+ $serverResponded = $false
655+ for ($i = 1; $i -le 20; $i++) {
605656 try {
606- $response = Invoke-RestMethod -Uri "http://127.0.0.1:8080/health" -Method Get -TimeoutSec 2
607- Write-Host "[PASSED] Server started successfully and is responding"
608- Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue
609- exit 0
657+ # Try multiple endpoints
658+ $healthResponse = $null
659+ try {
660+ $healthResponse = Invoke-RestMethod -Uri "http://127.0.0.1:8080/health" -Method Get -TimeoutSec 3
661+ $serverResponded = $true
662+ Write-Host "[PASSED] Server started successfully and is responding on /health"
663+ break
664+ } catch {
665+ # Try root endpoint
666+ try {
667+ $rootResponse = Invoke-RestMethod -Uri "http://127.0.0.1:8080/" -Method Get -TimeoutSec 3
668+ $serverResponded = $true
669+ Write-Host "[PASSED] Server started successfully and is responding on /"
670+ break
671+ } catch {
672+ # Try basic connection test
673+ try {
674+ $tcpClient = New-Object System.Net.Sockets.TcpClient
675+ $tcpClient.Connect("127.0.0.1", 8080)
676+ $tcpClient.Close()
677+ Write-Host "[PASSED] Server started successfully (TCP connection established)"
678+ $serverResponded = $true
679+ break
680+ } catch {
681+ Write-Host "Attempt $i/20 - waiting for server... (HTTP and TCP failed)"
682+ }
683+ }
684+ }
610685 } catch {
611- Write-Host "Attempt $i/30 - waiting for server..."
612- Start-Sleep -Seconds 2
686+ Write-Host "Attempt $i/20 - connection error: $($_.Exception.Message)"
613687 }
688+ Start-Sleep -Seconds 3
689+ }
690+
691+ if (-not $serverResponded) {
692+ Write-Host "[FAILED] Server failed to respond within timeout"
693+ Write-Host "Server process status: Running = $(-not $process.HasExited)"
694+ Write-Host "Server output (last 20 lines):"
695+ if (Test-Path $logFile) { Get-Content $logFile | Select-Object -Last 20 }
696+ Write-Host "Server errors:"
697+ if (Test-Path "server_error.log") { Get-Content "server_error.log" }
698+
699+ # Try to get more info about what the server is doing
700+ Write-Host "Checking if server is listening on port 8080..."
701+ try {
702+ $netstat = netstat -an | Select-String ":8080"
703+ if ($netstat) {
704+ Write-Host "Port 8080 status:"
705+ Write-Host $netstat
706+ } else {
707+ Write-Host "Port 8080 is not being listened on"
708+ }
709+ } catch {
710+ Write-Host "Could not check port status"
711+ }
712+
713+ Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue
714+ exit 1
614715 }
615716
616- Write-Host "[FAILED] Server failed to start or respond within timeout"
617717 Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue
618- exit 1
718+ Write-Host "Server test completed successfully"
619719
620720 - name : Test inference (Windows)
621721 if : runner.os == 'Windows'
0 commit comments