tmp_runtests.ps1 2.0 KB

123456789101112131415161718192021222324252627282930313233
  1. $root = 'd:/GOPATH/src/TsDB2'
  2. $demos = @(
  3. 'dirty_threshold_test','integrity_test','mem_test',
  4. 'btree_verify','commit_preset_test','feature_demo','hash_bench','hash_index_test',
  5. 'hash_probe','hash_verify','hash_widekey_test','lock_table_test','orm_full',
  6. 'stress_extreme_config','stress_small_config','stress_test','txn_test','wal_rowlevel_test'
  7. )
  8. $summary = Join-Path $root 'tmp_test_summary.txt'
  9. Set-Content -Path $summary -Value 'START' -Encoding UTF8
  10. foreach ($d in $demos) {
  11. $dir = Join-Path $root ('demo/' + $d)
  12. Add-Content -Path $summary -Value ('===== ' + $d + ' =====') -Encoding UTF8
  13. if (-not (Test-Path $dir)) { Add-Content -Path $summary -Value 'DIR MISSING' -Encoding UTF8; continue }
  14. Push-Location $dir
  15. foreach ($f in @('_t.exe','_out.log','_err.log')) { if (Test-Path $f) { Remove-Item $f -Force } }
  16. $b = & go build -o '_t.exe' . 2>&1
  17. if ($LASTEXITCODE -ne 0) {
  18. Add-Content -Path $summary -Value 'BUILD FAILED' -Encoding UTF8
  19. Add-Content -Path $summary -Value (($b | Select-Object -Last 15) -join ' | ') -Encoding UTF8
  20. Pop-Location
  21. continue
  22. }
  23. $p = Start-Process -FilePath (Join-Path $dir '_t.exe') -RedirectStandardOutput (Join-Path $dir '_out.log') -RedirectStandardError (Join-Path $dir '_err.log') -PassThru -WindowStyle Hidden
  24. $exited = $p.WaitForExit(240000)
  25. if (-not $exited) { try { $p.Kill() } catch {}; Add-Content -Path $summary -Value 'TIMEOUT(240s)' -Encoding UTF8 }
  26. else { Add-Content -Path $summary -Value ('exitcode=' + $p.ExitCode) -Encoding UTF8 }
  27. $o = Get-Content (Join-Path $dir '_out.log') -Encoding UTF8 -ErrorAction SilentlyContinue
  28. $e = Get-Content (Join-Path $dir '_err.log') -Encoding UTF8 -ErrorAction SilentlyContinue
  29. Add-Content -Path $summary -Value ('STDOUT_TAIL: ' + (($o | Select-Object -Last 12) -join ' | ')) -Encoding UTF8
  30. Add-Content -Path $summary -Value ('STDERR_TAIL: ' + (($e | Select-Object -Last 12) -join ' | ')) -Encoding UTF8
  31. Pop-Location
  32. }
  33. Add-Content -Path $summary -Value 'ALL DONE' -Encoding UTF8