Skip to content

Commit

Permalink
[pigeon] Update testing and docs (#6984)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stuartmorgan authored Jun 25, 2024
1 parent 71b2f68 commit eb0e54a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/pigeon/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions packages/pigeon/tool/shared/test_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Future<void> runTests(
print('# Running $test');
final int testCode = await info.function();
if (testCode != 0) {
print('# Failed, exit code: $testCode');
exit(testCode);
}
print('');
Expand Down

0 comments on commit eb0e54a

Please sign in to comment.