Skip to content

Commit 5ec5620

Browse files
authored
Refactor skp_generator_tests (#145871)
Refactor skp_generator_tests suite in order to reduce testing logic in test.dart and allow for later implementing package:test onto the existing skp_generator_tests tests Part of flutter/flutter#145482
1 parent 67271f6 commit 5ec5620

2 files changed

Lines changed: 39 additions & 28 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'dart:io';
6+
7+
import 'package:path/path.dart' as path;
8+
9+
import '../run_command.dart';
10+
import '../utils.dart';
11+
12+
/// Runs the skp_generator from the flutter/tests repo.
13+
///
14+
/// See also the customer_tests shard.
15+
///
16+
/// Generated SKPs are ditched, this just verifies that it can run without failure.
17+
Future<void> skpGeneratorTestsRunner() async {
18+
printProgress('${green}Running skp_generator from flutter/tests$reset');
19+
final Directory checkout = Directory.systemTemp.createTempSync('flutter_skp_generator.');
20+
await runCommand(
21+
'git',
22+
<String>[
23+
'-c',
24+
'core.longPaths=true',
25+
'clone',
26+
'https://github.com/flutter/tests.git',
27+
'.',
28+
],
29+
workingDirectory: checkout.path,
30+
);
31+
await runCommand(
32+
'./build.sh',
33+
const <String>[],
34+
workingDirectory: path.join(checkout.path, 'skp_generator'),
35+
);
36+
}

dev/bots/test.dart

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
import 'dart:convert';
5151
import 'dart:core' as system show print;
5252
import 'dart:core' hide print;
53+
import 'dart:io' as io;
5354
import 'dart:io' as system show exit;
5455
import 'dart:io' hide exit;
55-
import 'dart:io' as io;
5656
import 'dart:math' as math;
5757
import 'dart:typed_data';
5858

@@ -65,6 +65,7 @@ import 'package:process/process.dart';
6565

6666
import 'run_command.dart';
6767
import 'suite_runners/run_add_to_app_life_cycle_tests.dart';
68+
import 'suite_runners/run_skp_generator_tests.dart';
6869
import 'suite_runners/run_web_long_running_tests.dart';
6970
import 'tool_subsharding.dart';
7071
import 'utils.dart';
@@ -248,7 +249,7 @@ Future<void> main(List<String> args) async {
248249
// All web integration tests
249250
'web_long_running_tests': () => webLongRunningTestsRunner(flutterRoot),
250251
'flutter_plugins': _runFlutterPackagesTests,
251-
'skp_generator': _runSkpGeneratorTests,
252+
'skp_generator': skpGeneratorTestsRunner,
252253
'realm_checker': _runRealmCheckerTest,
253254
'customer_testing': _runCustomerTesting,
254255
'analyze': _runAnalyze,
@@ -1735,32 +1736,6 @@ Future<bool> hasExpectedEntitlements(
17351736
return passes;
17361737
}
17371738

1738-
/// Runs the skp_generator from the flutter/tests repo.
1739-
///
1740-
/// See also the customer_tests shard.
1741-
///
1742-
/// Generated SKPs are ditched, this just verifies that it can run without failure.
1743-
Future<void> _runSkpGeneratorTests() async {
1744-
printProgress('${green}Running skp_generator from flutter/tests$reset');
1745-
final Directory checkout = Directory.systemTemp.createTempSync('flutter_skp_generator.');
1746-
await runCommand(
1747-
'git',
1748-
<String>[
1749-
'-c',
1750-
'core.longPaths=true',
1751-
'clone',
1752-
'https://github.com/flutter/tests.git',
1753-
'.',
1754-
],
1755-
workingDirectory: checkout.path,
1756-
);
1757-
await runCommand(
1758-
'./build.sh',
1759-
<String>[ ],
1760-
workingDirectory: path.join(checkout.path, 'skp_generator'),
1761-
);
1762-
}
1763-
17641739
Future<void> _runRealmCheckerTest() async {
17651740
final String engineRealm = File(engineRealmFile).readAsStringSync().trim();
17661741
if (engineRealm.isNotEmpty) {

0 commit comments

Comments
 (0)