runRunnerWorkersForBenchmark function

Future<ProcessResult> runRunnerWorkersForBenchmark({
  1. required String appDir,
  2. required int workers,
  3. required String testsDir,
  4. required String testEntry,
})

Internal benchmark adapter to the actual CLI worker launch/merge pipeline. It cannot be used without an active standalone benchmark collector.

Implementation

Future<ProcessResult> runRunnerWorkersForBenchmark({
  required String appDir,
  required int workers,
  required String testsDir,
  required String testEntry,
}) {
  if (RunnerBenchmark.collector == null) {
    throw StateError('Worker benchmarks require the standalone benchmark tool');
  }
  return _runParallelFlutterTests(
    const [],
    appDir: appDir,
    flutterExecutable: resolveFlutterExecutable(appDir),
    patcher: TestAppPatcher(appDir,
        testsDirRelative: testsDir, testEntryRelativePath: testEntry),
    timerRewritePlan: TestTimerRewritePlan.forApp(
      appDir: appDir,
      testsDirRelative: testsDir,
    ),
    jobs: workers,
    reportMode: 'json',
    reportFile: p.join(appDir, 'merged.json'),
    timeoutSeconds: 120,
    quiet: true,
    machineReport: true,
    suiteConfig: const EnsembleTestConfig(),
  );
}