Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up test script
  • Loading branch information
stuartmorgan-g committed Aug 3, 2023
commit 463034f359e068af0a48681432fd44ca02aa2885
6 changes: 4 additions & 2 deletions packages/pigeon/tool/run_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ Future<List<String>> _modifiedFiles(
Future<void> main(List<String> args) async {
// Run most tests on Linux, since Linux tends to be the easiest and cheapest.
const List<String> linuxHostTests = <String>[
dartUnitTests,
flutterUnitTests,
mockHandlerTests,
commandLineTests,
androidJavaUnitTests,
Expand Down Expand Up @@ -198,6 +196,10 @@ Future<void> main(List<String> args) async {
// See comments in macOSHostTests:
iOSObjCIntegrationTests,
iOSSwiftIntegrationTests,
// These are Dart unit tests, which are already run by the normal
// test-dart repo tools command.
dartUnitTests,
flutterUnitTests,
],
]);

Expand Down
1 change: 1 addition & 0 deletions packages/pigeon/tool/shared/generation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Future<int> generateTestPigeons({required String baseDir}) async {
'background_platform_channels',
'core_tests',
'enum',
'flutter_unittests', // Only for Dart unit tests in shared_test_plugin_code
'message',
'multiple_arity',
'non_null_fields',
Expand Down
38 changes: 1 addition & 37 deletions packages/pigeon/tool/shared/test_suites.dart
Original file line number Diff line number Diff line change
Expand Up @@ -187,21 +187,6 @@ Future<int> _runDartUnitTests() async {
return exitCode;
}

/// Generates multiple dart files based on the jobs defined in [jobs] which is
/// in the format of (key: input pigeon file path, value: output dart file
/// path).
Future<int> _generateDart(Map<String, String> jobs) async {
for (final MapEntry<String, String> job in jobs.entries) {
// TODO(gaaclarke): Make this run the jobs in parallel. A bug in Dart
// blocked this (https://github.com/dart-lang/pub/pull/3285).
final int result = await runPigeon(input: job.key, dartOut: job.value);
if (result != 0) {
return result;
}
}
return 0;
}

Future<int> _analyzeFlutterUnitTests(String flutterUnitTestsPath) async {
final String messagePath = '$flutterUnitTestsPath/lib/message.gen.dart';
final String messageTestPath = '$flutterUnitTestsPath/test/message_test.dart';
Expand All @@ -227,28 +212,7 @@ Future<int> _analyzeFlutterUnitTests(String flutterUnitTestsPath) async {
}

Future<int> _runFlutterUnitTests() async {
// TODO(stuartmorgan): Migrate Dart unit tests to use the generated output in
// shared_test_plugin_code instead of having multiple copies of generation.
const String flutterUnitTestsPath =
'platform_tests/flutter_null_safe_unit_tests';
// Files from the pigeons/ directory to generate output for.
const List<String> inputPigeons = <String>[
'flutter_unittests',
'core_tests',
'primitive',
'multiple_arity',
'non_null_fields',
'null_fields',
'nullable_returns',
];
final int generateCode = await _generateDart(<String, String>{
for (final String name in inputPigeons)
'pigeons/$name.dart': '$flutterUnitTestsPath/lib/$name.gen.dart'
});
if (generateCode != 0) {
return generateCode;
}

const String flutterUnitTestsPath = 'platform_tests/shared_test_plugin_code';
final int analyzeCode = await _analyzeFlutterUnitTests(flutterUnitTestsPath);
if (analyzeCode != 0) {
return analyzeCode;
Expand Down