@@ -154,80 +154,48 @@ jobs:
154154 shell : bash
155155 run : echo "VSTEST_DUMP_PATH=logs/UnitTestsParallelizable/${{ runner.os }}/" >> $GITHUB_ENV
156156
157- - name : Run UnitTestsParallelizable (10 iterations with varying parallelization)
157+ - name : Run UnitTestsParallelizable
158158 shell : bash
159159 run : |
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
160+ # Run tests once for regular workflow runs (stress tests will run multiple iterations)
161+ echo "============================================"
162+ echo "Starting parallel unit tests"
163+ echo "============================================"
164+
165+ # Use default parallelization (2x CPU cores)
166+ echo "Using default parallelization (2x)"
167+
168+ # Run tests with or without coverage based on OS
169+ if [ "${{ runner.os }}" == "Linux" ]; then
170+ echo "Running with coverage collection on Linux"
171+ dotnet test Tests/UnitTestsParallelizable \
172+ --no-build \
173+ --verbosity normal \
174+ --collect:"XPlat Code Coverage" \
175+ --settings Tests/UnitTests/runsettings.coverage.xml \
176+ --diag:logs/UnitTestsParallelizable/${{ runner.os }}/logs.txt \
177+ --blame \
178+ --blame-crash \
179+ --blame-hang \
180+ --blame-hang-timeout 60s \
181+ --blame-crash-collect-always \
182+ -- xUnit.MaxParallelThreads=2x
183+ else
184+ dotnet test Tests/UnitTestsParallelizable \
185+ --no-build \
186+ --verbosity normal \
187+ --settings Tests/UnitTestsParallelizable/runsettings.xml \
188+ --diag:logs/UnitTestsParallelizable/${{ runner.os }}/logs.txt \
189+ --blame \
190+ --blame-crash \
191+ --blame-hang \
192+ --blame-hang-timeout 60s \
193+ --blame-crash-collect-always \
194+ -- xUnit.MaxParallelThreads=2x
195+ fi
228196
229197 echo "============================================"
230- echo "All 10 test runs completed successfully!"
198+ echo "Parallel unit tests completed successfully!"
231199 echo "============================================"
232200
233201 - name : Upload UnitTestsParallelizable Logs
0 commit comments