Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 
 

51 рядки
1.1 KiB

  1. param([string]$Filter)
  2. $ErrorActionPreference = "Stop"
  3. $gcc = "D:\Dev-Cpp\MinGW64\bin\gcc.exe"
  4. $repoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).Path
  5. $temporaryExe = Join-Path ([System.IO.Path]::GetTempPath()) `
  6. ("plsr_host_tests_{0}.exe" -f [System.Guid]::NewGuid().ToString("N"))
  7. $exitCode = 1
  8. if (-not (Test-Path -LiteralPath $gcc)) {
  9. throw "Required compiler not found: $gcc"
  10. }
  11. $compileArguments = @(
  12. "-std=c99"
  13. "-Wall"
  14. "-Wextra"
  15. "-Werror"
  16. "-DPLSR_HOST_TEST"
  17. "-I$repoRoot\PLSR\Inc"
  18. "-I$repoRoot\PLSR\Src"
  19. "$repoRoot\PLSR\Src\plsr.c"
  20. "$repoRoot\PLSR\Src\plsr_planner.c"
  21. "$repoRoot\PLSR\Src\plsr_platform_f407.c"
  22. "$PSScriptRoot\test_plsr_host.c"
  23. "-o"
  24. $temporaryExe
  25. )
  26. try {
  27. & $gcc @compileArguments
  28. if ($LASTEXITCODE -ne 0) {
  29. $exitCode = $LASTEXITCODE
  30. }
  31. else {
  32. if ([string]::IsNullOrEmpty($Filter)) {
  33. & $temporaryExe
  34. }
  35. else {
  36. & $temporaryExe $Filter
  37. }
  38. $exitCode = $LASTEXITCODE
  39. }
  40. }
  41. finally {
  42. Remove-Item -LiteralPath $temporaryExe -Force -ErrorAction SilentlyContinue
  43. }
  44. exit $exitCode