| 12345678910111213141516171819202122232425262728293031 |
- $root = 'd:/GOPATH/src/TsDB2'
- $demos = @(
- 'hash_index_test','hash_probe','hash_verify','hash_widekey_test','lock_table_test',
- 'orm_full','stress_extreme_config','stress_small_config','stress_test','txn_test','wal_rowlevel_test'
- )
- $summary = Join-Path $root 'tmp_test_summary2.txt'
- Set-Content -Path $summary -Value 'START2' -Encoding UTF8
- foreach ($d in $demos) {
- $dir = Join-Path $root ('demo/' + $d)
- Add-Content -Path $summary -Value ('===== ' + $d + ' =====') -Encoding UTF8
- if (-not (Test-Path $dir)) { Add-Content -Path $summary -Value 'DIR MISSING' -Encoding UTF8; continue }
- Push-Location $dir
- foreach ($f in @('_t.exe','_out.log','_err.log')) { if (Test-Path $f) { Remove-Item $f -Force } }
- $b = & go build -o '_t.exe' . 2>&1
- if ($LASTEXITCODE -ne 0) {
- Add-Content -Path $summary -Value 'BUILD FAILED' -Encoding UTF8
- Add-Content -Path $summary -Value (($b | Select-Object -Last 15) -join ' | ') -Encoding UTF8
- Pop-Location
- continue
- }
- $p = Start-Process -FilePath (Join-Path $dir '_t.exe') -RedirectStandardOutput (Join-Path $dir '_out.log') -RedirectStandardError (Join-Path $dir '_err.log') -PassThru -WindowStyle Hidden
- $exited = $p.WaitForExit(240000)
- if (-not $exited) { try { $p.Kill() } catch {}; Add-Content -Path $summary -Value 'TIMEOUT(240s)' -Encoding UTF8 }
- else { Add-Content -Path $summary -Value 'finished' -Encoding UTF8 }
- $o = Get-Content (Join-Path $dir '_out.log') -Encoding UTF8 -ErrorAction SilentlyContinue
- $e = Get-Content (Join-Path $dir '_err.log') -Encoding UTF8 -ErrorAction SilentlyContinue
- Add-Content -Path $summary -Value ('STDOUT_TAIL: ' + (($o | Select-Object -Last 12) -join ' | ')) -Encoding UTF8
- Add-Content -Path $summary -Value ('STDERR_TAIL: ' + (($e | Select-Object -Last 12) -join ' | ')) -Encoding UTF8
- Pop-Location
- }
- Add-Content -Path $summary -Value 'ALL DONE2' -Encoding UTF8
|