From 42b284d2df0d9a91c0bd56943912131f0988f117 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Tue, 25 Jun 2024 10:26:47 -0400 Subject: [PATCH] [pigeon] Update testing and docs Minor improvements for contributors: - Explicitly log failure of a test suite. Depeending on the generator and the failure, it may not be obvious (e.g., gtest crashes, which just don't have any output). - Clarify `test.dart` vs `run_tests.dart`, and mention the `-t` and `-l` flags. - Add newer generators to the source list. --- packages/pigeon/CONTRIBUTING.md | 7 +++++++ packages/pigeon/tool/shared/test_runner.dart | 1 + 2 files changed, 8 insertions(+) diff --git a/packages/pigeon/CONTRIBUTING.md b/packages/pigeon/CONTRIBUTING.md index 0caf41ec42d..e19f6958623 100644 --- a/packages/pigeon/CONTRIBUTING.md +++ b/packages/pigeon/CONTRIBUTING.md @@ -21,8 +21,10 @@ generators with that AST. * [ast.dart](./lib/ast.dart) - The data structure for representing the Abstract Syntax Tree. * [dart_generator.dart](./lib/dart_generator.dart) - The Dart code generator. * [java_generator.dart](./lib/java_generator.dart) - The Java code generator. +* [kotlin_generator.dart](./lib/kotlin_generator.dart) - The Kotlin code generator. * [objc_generator.dart](./lib/objc_generator.dart) - The Objective-C code generator (header and source files). +* [swift_generator.dart](./lib/swift_generator.dart) - The Swift code generator. * [cpp_generator.dart](./lib/cpp_generator.dart) - The C++ code generator. * [generator_tools.dart](./lib/generator_tools.dart) - Shared code between generators. * [pigeon_cl.dart](./lib/pigeon_cl.dart) - The top-level function executed by @@ -49,6 +51,11 @@ Pigeon has 3 types of tests, you'll find them all in code, then execute the generated code. It can be thought of as unit-tests run against the generated code. Examples: [platform_tests](./platform_tests) +For local testing, always use `test.dart` rather than `run_tests.dart`, as +`run_tests.dart` is specifically a CI entrypoint. When iterating on a specific +generator, you will likely want to use the `-t` flag to specific only the +relevant tests. Pass `-l` to get a list of available tests for the `-t` flag. + ## Generated Source Code Example This is what the temporary generated code that the _PigeonIsolate_ executes diff --git a/packages/pigeon/tool/shared/test_runner.dart b/packages/pigeon/tool/shared/test_runner.dart index c2df4b58f06..01f12cb26fd 100644 --- a/packages/pigeon/tool/shared/test_runner.dart +++ b/packages/pigeon/tool/shared/test_runner.dart @@ -49,6 +49,7 @@ Future runTests( print('# Running $test'); final int testCode = await info.function(); if (testCode != 0) { + print('# Failed, exit code: $testCode'); exit(testCode); } print('');