Unverified Commit 9228b87e authored by Nate Bosch's avatar Nate Bosch Committed by GitHub

Don't use a default test randomize ordering seed (#51018)

Fixes #51010

The test package differentiates between passing and not passing this
argument. A previous version had a bug that treated passing `0`
identically to not passing the argument, and the flutter test runner
relied on this bug by always passing a value and using a default of `0`.

- Remove the argument defaults throughout to make it clear that `null`
  is a valid value and the default.
- Remove the argument defaulting on the argument parser.
- Update the wording of the usage for this argument, this will also be
  updated on the `package:test` side.
parent d73dd6b3
...@@ -54,8 +54,6 @@ Future<int> runTest({bool coverage = false}) async { ...@@ -54,8 +54,6 @@ Future<int> runTest({bool coverage = false}) async {
if (step == TestStep.starting && entry == 'Building flutter tool...') { if (step == TestStep.starting && entry == 'Building flutter tool...') {
// ignore this line // ignore this line
step = TestStep.buildingFlutterTool; step = TestStep.buildingFlutterTool;
} else if (step == TestStep.starting && entry.contains('Shuffling test order')) {
// ignore this line
} else if (step == TestStep.testPassed && entry.contains('Collecting coverage information...')) { } else if (step == TestStep.testPassed && entry.contains('Collecting coverage information...')) {
// ignore this line // ignore this line
} else if (step.index < TestStep.runningPubGet.index && entry == 'Running "flutter pub get" in automated_tests...') { } else if (step.index < TestStep.runningPubGet.index && entry == 'Running "flutter pub get" in automated_tests...') {
......
...@@ -106,11 +106,10 @@ class TestCommand extends FlutterCommand { ...@@ -106,11 +106,10 @@ class TestCommand extends FlutterCommand {
help: 'The platform to run the unit tests on. Defaults to "tester".', help: 'The platform to run the unit tests on. Defaults to "tester".',
) )
..addOption('test-randomize-ordering-seed', ..addOption('test-randomize-ordering-seed',
defaultsTo: '0', help: 'The seed to randomize the execution order of test cases.\n'
help: 'If positive, use this as a seed to randomize the execution of ' 'Must be a 32bit unsigned integer or "random".\n'
'test cases (must be a 32bit unsigned integer).\n'
'If "random", pick a random seed to use.\n' 'If "random", pick a random seed to use.\n'
'If 0 or not set, do not randomize test case execution order.', 'If not passed, do not randomize test case execution order.',
) )
..addFlag('enable-vmservice', ..addFlag('enable-vmservice',
defaultsTo: false, defaultsTo: false,
......
...@@ -48,7 +48,7 @@ abstract class FlutterTestRunner { ...@@ -48,7 +48,7 @@ abstract class FlutterTestRunner {
String icudtlPath, String icudtlPath,
Directory coverageDirectory, Directory coverageDirectory,
bool web = false, bool web = false,
String randomSeed = '0', String randomSeed,
}); });
} }
...@@ -79,7 +79,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner { ...@@ -79,7 +79,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
String icudtlPath, String icudtlPath,
Directory coverageDirectory, Directory coverageDirectory,
bool web = false, bool web = false,
String randomSeed = '0', String randomSeed,
}) async { }) async {
// Configure package:test to use the Flutter engine for child processes. // Configure package:test to use the Flutter engine for child processes.
final String shellPath = globals.artifacts.getArtifactPath(Artifact.flutterTester); final String shellPath = globals.artifacts.getArtifactPath(Artifact.flutterTester);
...@@ -102,7 +102,8 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner { ...@@ -102,7 +102,8 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
...<String>['--name', name], ...<String>['--name', name],
for (final String plainName in plainNames) for (final String plainName in plainNames)
...<String>['--plain-name', plainName], ...<String>['--plain-name', plainName],
'--test-randomize-ordering-seed=$randomSeed', if (randomSeed != null)
'--test-randomize-ordering-seed=$randomSeed',
]; ];
if (web) { if (web) {
final String tempBuildDir = globals.fs.systemTempDirectory final String tempBuildDir = globals.fs.systemTempDirectory
......
...@@ -158,7 +158,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner { ...@@ -158,7 +158,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
String icudtlPath, String icudtlPath,
Directory coverageDirectory, Directory coverageDirectory,
bool web = false, bool web = false,
String randomSeed = '0', String randomSeed,
}) async { }) async {
lastEnableObservatoryValue = enableObservatory; lastEnableObservatoryValue = enableObservatory;
return exitCode; return exitCode;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment