testloop.sh 819 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. # This script runs the tests in a loop until they all pass.
  3. # It will exit if any test run fails.
  4. dotnet build -c Debug
  5. iterationCount=1
  6. while true; do
  7. echo "Starting iteration $iterationCount..."
  8. dotnet test Tests/UnitTests --no-build --diag:TestResults/UnitTests.log -- xunit.stopOnFail=true
  9. if [ $? -ne 0 ]; then
  10. echo "UnitTests run failed on iteration $iterationCount. Exiting."
  11. exit 1
  12. fi
  13. dotnet test Tests/UnitTestsParallelizable --no-build --diag:TestResults/UnitTestsParallelizable.log -- xunit.stopOnFail=true
  14. if [ $? -ne 0 ]; then
  15. echo "UnitTestsParallelizable run failed on iteration $iterationCount. Exiting."
  16. exit 1
  17. fi
  18. # Clean up the log files
  19. rm log*
  20. # Increment the iteration counter
  21. ((iterationCount++))
  22. done