@@ -120,7 +120,7 @@ jobs:
120120 matrix :
121121 os : [ ubuntu-latest, windows-latest, macos-latest ]
122122
123- timeout-minutes : 15
123+ timeout-minutes : 60
124124 steps :
125125
126126 - name : Checkout code
@@ -154,35 +154,81 @@ jobs:
154154 shell : bash
155155 run : echo "VSTEST_DUMP_PATH=logs/UnitTestsParallelizable/${{ runner.os }}/" >> $GITHUB_ENV
156156
157- - name : Run UnitTestsParallelizable
157+ - name : Run UnitTestsParallelizable (10 iterations with varying parallelization)
158158 shell : bash
159159 run : |
160- if [ "${{ runner.os }}" == "Linux" ]; then
161- # Run with coverage on Linux only
162- dotnet test Tests/UnitTestsParallelizable \
163- --no-build \
164- --verbosity normal \
165- --collect:"XPlat Code Coverage" \
166- --settings Tests/UnitTests/runsettings.coverage.xml \
167- --diag:logs/UnitTestsParallelizable/${{ runner.os }}/logs.txt \
168- --blame \
169- --blame-crash \
170- --blame-hang \
171- --blame-hang-timeout 60s \
172- --blame-crash-collect-always
173- else
174- # Run without coverage on Windows/macOS for speed
175- dotnet test Tests/UnitTestsParallelizable \
176- --no-build \
177- --verbosity normal \
178- --settings Tests/UnitTestsParallelizable/runsettings.xml \
179- --diag:logs/UnitTestsParallelizable/${{ runner.os }}/logs.txt \
180- --blame \
181- --blame-crash \
182- --blame-hang \
183- --blame-hang-timeout 60s \
184- --blame-crash-collect-always
185- fi
160+ # Run tests 3 times with different parallelization settings to expose concurrency issues
161+ for RUN in {1..3}; do
162+ echo "============================================"
163+ echo "Starting test run $RUN of 3"
164+ echo "============================================"
165+
166+ # Use a combination of run number and timestamp to create different execution patterns
167+ SEED=$((1000 + $RUN + $(date +%s) % 1000))
168+ echo "Using randomization seed: $SEED"
169+
170+ # Vary the xUnit parallelization based on run number to expose race conditions
171+ # Runs 1-3: Default parallelization (2x CPU cores)
172+ # Runs 4-6: Max parallelization (unlimited)
173+ # Runs 7-9: Single threaded (1)
174+ # Run 10: Random (1-4 threads)
175+ if [ $RUN -le 3 ]; then
176+ XUNIT_MAX_PARALLEL_THREADS="2x"
177+ echo "Run $RUN: Using default parallelization (2x)"
178+ elif [ $RUN -le 6 ]; then
179+ XUNIT_MAX_PARALLEL_THREADS="unlimited"
180+ echo "Run $RUN: Using maximum parallelization (unlimited)"
181+ elif [ $RUN -le 9 ]; then
182+ XUNIT_MAX_PARALLEL_THREADS="1"
183+ echo "Run $RUN: Using single-threaded execution"
184+ else
185+ # Random parallelization based on seed
186+ PROC_COUNT=$(( ($SEED % 4) + 1 ))
187+ XUNIT_MAX_PARALLEL_THREADS="$PROC_COUNT"
188+ echo "Run $RUN: Using random parallelization with $PROC_COUNT threads"
189+ fi
190+
191+ # Run tests with or without coverage based on OS and run number
192+ if [ "${{ runner.os }}" == "Linux" ] && [ $RUN -eq 1 ]; then
193+ echo "Run $RUN: Running with coverage collection"
194+ dotnet test Tests/UnitTestsParallelizable \
195+ --no-build \
196+ --verbosity normal \
197+ --collect:"XPlat Code Coverage" \
198+ --settings Tests/UnitTests/runsettings.coverage.xml \
199+ --diag:logs/UnitTestsParallelizable/${{ runner.os }}/run${RUN}-logs.txt \
200+ --blame \
201+ --blame-crash \
202+ --blame-hang \
203+ --blame-hang-timeout 60s \
204+ --blame-crash-collect-always \
205+ -- xUnit.MaxParallelThreads=${XUNIT_MAX_PARALLEL_THREADS}
206+ else
207+ dotnet test Tests/UnitTestsParallelizable \
208+ --no-build \
209+ --verbosity normal \
210+ --settings Tests/UnitTestsParallelizable/runsettings.xml \
211+ --diag:logs/UnitTestsParallelizable/${{ runner.os }}/run${RUN}-logs.txt \
212+ --blame \
213+ --blame-crash \
214+ --blame-hang \
215+ --blame-hang-timeout 60s \
216+ --blame-crash-collect-always \
217+ -- xUnit.MaxParallelThreads=${XUNIT_MAX_PARALLEL_THREADS}
218+ fi
219+
220+ if [ $? -ne 0 ]; then
221+ echo "ERROR: Test run $RUN failed!"
222+ exit 1
223+ fi
224+
225+ echo "Test run $RUN completed successfully"
226+ echo ""
227+ done
228+
229+ echo "============================================"
230+ echo "All 10 test runs completed successfully!"
231+ echo "============================================"
186232
187233 - name : Upload UnitTestsParallelizable Logs
188234 if : always()
0 commit comments