Skip to content

Commit 9134c12

Browse files
[pigeon] Use a shared generation step for platform_tests/ (#2823)
* Reorganize process helpers to reduce duplicate code * Add wrappers for common process commands * WIP generation consolidation * Re-add the Java special casing that the bash version did * Fix gradlew check * Add ignores for Dart for now * Update README * Typo fix * Autoformat * Fix Windows * Windows command fix * Try returning to runInShell:true to see if that fixes the CI hang * Revert more of _runWindowsUnitTests for CI debugging * Add missed early return for failure * Verbose build, and disable Dart generation to further reduce differences * Revert "Verbose build, and disable Dart generation to further reduce differences" This reverts commit ddfbf8b. * Revert "Revert more of _runWindowsUnitTests for CI debugging" This reverts commit e4e867c. * Revert "Try returning to runInShell:true to see if that fixes the CI hang" This reverts commit a124e08. * Fix Windows includes
1 parent 0df1569 commit 9134c12

28 files changed

+632
-562
lines changed

packages/pigeon/platform_tests/README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ of Pigeon-generated code. The [test script](../tool/run_tests.dart) generates
55
native code from [pigeons/](../pigeons/) into the native test scaffolding, and
66
then drives the tests there.
77

8-
To run these tests, use [`run_tests.dart`](../tool/run_tests.dart)
8+
To run these tests, use [`run_tests.dart`](../tool/run_tests.dart).
9+
10+
Alternately, if you are running them directly (e.g., from within a platform
11+
IDE), you can use [`generate.dart`](../tool/generate.dart) to generate the
12+
necessary Pigeon output.
913

1014
## test\_plugin
1115

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# TODO(stuartmorgan): Remove this, so that review will show the effects of
2+
# changes on generated files. This will need a way to avoid unnecessary churn,
3+
# such as a flag to suppress version stamp generation.
4+
*.gen.dart
5+
# TODO(stuartmorgan): Add exceptions for specific files that are used in
6+
# integration tests, as they will need to be checked in to avoid analysis
7+
# failures. The exclusion of other files is to prevent having multiple
8+
# copies of all of the Dart output until more tests are restructured to
9+
# minimize duplication.

packages/pigeon/platform_tests/ios_unit_tests/ios/Runner.xcodeproj/project.pbxproj

+102-102
Large diffs are not rendered by default.

packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/AllDatatypesTest.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
#import <Flutter/Flutter.h>
66
#import <XCTest/XCTest.h>
7+
#import "AllDatatypes.gen.h"
78
#import "EchoMessenger.h"
8-
#import "all_datatypes.gen.h"
99

1010
///////////////////////////////////////////////////////////////////////////////////////////
1111
@interface AllDatatypesTest : XCTestCase

packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/AsyncHandlersTest.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
#import <Flutter/Flutter.h>
66
#import <XCTest/XCTest.h>
7+
#import "AsyncHandlers.gen.h"
78
#import "MockBinaryMessenger.h"
8-
#import "async_handlers.gen.h"
99

1010
///////////////////////////////////////////////////////////////////////////////////////////
1111
@interface Value ()

packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/EnumTest.m

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#import <Flutter/Flutter.h>
66
#import <XCTest/XCTest.h>
77
#import "EchoMessenger.h"
8-
#import "enum.gen.h"
8+
#import "Enum.gen.h"
99

1010
///////////////////////////////////////////////////////////////////////////////////////////
1111
@interface EnumTest : XCTestCase
@@ -15,14 +15,14 @@ @interface EnumTest : XCTestCase
1515
@implementation EnumTest
1616

1717
- (void)testEcho {
18-
ACDataWithEnum *data = [[ACDataWithEnum alloc] init];
19-
data.state = ACEnumStateError;
18+
DataWithEnum *data = [[DataWithEnum alloc] init];
19+
data.state = EnumStateError;
2020
EchoBinaryMessenger *binaryMessenger =
21-
[[EchoBinaryMessenger alloc] initWithCodec:ACEnumApi2HostGetCodec()];
22-
ACEnumApi2Flutter *api = [[ACEnumApi2Flutter alloc] initWithBinaryMessenger:binaryMessenger];
21+
[[EchoBinaryMessenger alloc] initWithCodec:EnumApi2HostGetCodec()];
22+
EnumApi2Flutter *api = [[EnumApi2Flutter alloc] initWithBinaryMessenger:binaryMessenger];
2323
XCTestExpectation *expectation = [self expectationWithDescription:@"callback"];
2424
[api echoData:data
25-
completion:^(ACDataWithEnum *_Nonnull result, NSError *_Nullable error) {
25+
completion:^(DataWithEnum *_Nonnull result, NSError *_Nullable error) {
2626
XCTAssertEqual(data.state, result.state);
2727
[expectation fulfill];
2828
}];

packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/ListTest.m

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#import <Flutter/Flutter.h>
66
#import <XCTest/XCTest.h>
77
#import "EchoMessenger.h"
8-
#import "list.gen.h"
8+
#import "List.gen.h"
99

1010
///////////////////////////////////////////////////////////////////////////////////////////
1111
@interface ListTest : XCTestCase
@@ -15,18 +15,18 @@ @interface ListTest : XCTestCase
1515
@implementation ListTest
1616

1717
- (void)testListInList {
18-
LSTTestMessage *top = [[LSTTestMessage alloc] init];
19-
LSTTestMessage *inside = [[LSTTestMessage alloc] init];
18+
TestMessage *top = [[TestMessage alloc] init];
19+
TestMessage *inside = [[TestMessage alloc] init];
2020
inside.testList = @[ @1, @2, @3 ];
2121
top.testList = @[ inside ];
2222
EchoBinaryMessenger *binaryMessenger =
23-
[[EchoBinaryMessenger alloc] initWithCodec:LSTEchoApiGetCodec()];
24-
LSTEchoApi *api = [[LSTEchoApi alloc] initWithBinaryMessenger:binaryMessenger];
23+
[[EchoBinaryMessenger alloc] initWithCodec:EchoApiGetCodec()];
24+
EchoApi *api = [[EchoApi alloc] initWithBinaryMessenger:binaryMessenger];
2525
XCTestExpectation *expectation = [self expectationWithDescription:@"callback"];
2626
[api echoMsg:top
27-
completion:^(LSTTestMessage *_Nonnull result, NSError *_Nullable err) {
27+
completion:^(TestMessage *_Nonnull result, NSError *_Nullable err) {
2828
XCTAssertEqual(1u, result.testList.count);
29-
XCTAssertTrue([result.testList[0] isKindOfClass:[LSTTestMessage class]]);
29+
XCTAssertTrue([result.testList[0] isKindOfClass:[TestMessage class]]);
3030
XCTAssertEqualObjects(inside.testList, [result.testList[0] testList]);
3131
[expectation fulfill];
3232
}];

packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/MultipleArityTest.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#import <Flutter/Flutter.h>
66
#import <XCTest/XCTest.h>
77
#import "HandlerBinaryMessenger.h"
8-
#import "multiple_arity.gen.h"
8+
#import "MultipleArity.gen.h"
99

1010
///////////////////////////////////////////////////////////////////////////////////////////
1111
@interface MultipleAritytest : XCTestCase

packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/NonNullFieldsTest.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#import <Flutter/Flutter.h>
77
#import <XCTest/XCTest.h>
88
#import "EchoMessenger.h"
9-
#import "non_null_fields.gen.h"
9+
#import "NonNullFields.gen.h"
1010

1111
///////////////////////////////////////////////////////////////////////////////////////////
1212
@interface NonNullFieldsTest : XCTestCase
@@ -16,7 +16,7 @@ @interface NonNullFieldsTest : XCTestCase
1616
@implementation NonNullFieldsTest
1717

1818
- (void)testMake {
19-
NNFNonNullFieldSearchRequest *request = [NNFNonNullFieldSearchRequest makeWithQuery:@"hello"];
19+
NonNullFieldSearchRequest *request = [NonNullFieldSearchRequest makeWithQuery:@"hello"];
2020
XCTAssertEqualObjects(@"hello", request.query);
2121
}
2222

packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/NullFieldsTest.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#import <Flutter/Flutter.h>
66
#import <XCTest/XCTest.h>
77
#import "EchoMessenger.h"
8-
#import "null_fields.gen.h"
8+
#import "NullFields.gen.h"
99

1010
///////////////////////////////////////////////////////////////////////////////////////////
1111
@interface NullFieldsSearchRequest ()

packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/NullableReturnsTest.m

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
#import <XCTest/XCTest.h>
66
#import "EchoMessenger.h"
77
#import "MockBinaryMessenger.h"
8-
#import "nullable_returns.gen.h"
8+
#import "NullableReturns.gen.h"
99

1010
///////////////////////////////////////////////////////////////////////////////////////////
11-
@interface MockNullableArgHostApi : NSObject <NRNullableArgHostApi>
11+
@interface MockNullableArgHostApi : NSObject <NullableArgHostApi>
1212
@property(nonatomic, assign) BOOL didCall;
1313
@property(nonatomic, copy) NSNumber *x;
1414
@end
@@ -33,9 +33,9 @@ @implementation NullableReturnsTest
3333

3434
- (void)testNullableParameterWithFlutterApi {
3535
EchoBinaryMessenger *binaryMessenger =
36-
[[EchoBinaryMessenger alloc] initWithCodec:NRNullableArgHostApiGetCodec()];
37-
NRNullableArgFlutterApi *api =
38-
[[NRNullableArgFlutterApi alloc] initWithBinaryMessenger:binaryMessenger];
36+
[[EchoBinaryMessenger alloc] initWithCodec:NullableArgHostApiGetCodec()];
37+
NullableArgFlutterApi *api =
38+
[[NullableArgFlutterApi alloc] initWithBinaryMessenger:binaryMessenger];
3939
XCTestExpectation *expectation = [self expectationWithDescription:@"callback"];
4040
[api doitX:nil
4141
completion:^(NSNumber *_Nonnull result, NSError *_Nullable error) {
@@ -48,12 +48,12 @@ - (void)testNullableParameterWithFlutterApi {
4848
- (void)testNullableParameterWithHostApi {
4949
MockNullableArgHostApi *api = [[MockNullableArgHostApi alloc] init];
5050
MockBinaryMessenger *binaryMessenger =
51-
[[MockBinaryMessenger alloc] initWithCodec:NRNullableArgHostApiGetCodec()];
51+
[[MockBinaryMessenger alloc] initWithCodec:NullableArgHostApiGetCodec()];
5252
NSString *channel = @"dev.flutter.pigeon.NullableArgHostApi.doit";
53-
NRNullableArgHostApiSetup(binaryMessenger, api);
53+
NullableArgHostApiSetup(binaryMessenger, api);
5454
XCTAssertNotNil(binaryMessenger.handlers[channel]);
5555
XCTestExpectation *expectation = [self expectationWithDescription:@"callback"];
56-
NSData *arguments = [NRNullableArgHostApiGetCodec() encode:@[ [NSNull null] ]];
56+
NSData *arguments = [NullableArgHostApiGetCodec() encode:@[ [NSNull null] ]];
5757
binaryMessenger.handlers[channel](arguments, ^(NSData *data) {
5858
[expectation fulfill];
5959
});

packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/PrimitiveTest.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#import <Flutter/Flutter.h>
66
#import <XCTest/XCTest.h>
77
#import "EchoMessenger.h"
8-
#import "primitive.gen.h"
8+
#import "Primitive.gen.h"
99

1010
///////////////////////////////////////////////////////////////////////////////////////////
1111
@interface PrimitiveTest : XCTestCase

packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/RunnerTests.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// found in the LICENSE file.
44

55
#import <XCTest/XCTest.h>
6-
#import "message.gen.h"
6+
#import "Message.gen.h"
77

88
@interface ACMessageSearchReply ()
99
+ (ACMessageSearchReply *)fromMap:(NSDictionary *)dict;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# TODO(stuartmorgan): Remove this, so that review will show the effects of
2+
# changes on generated files. This will need a way to avoid unnecessary churn,
3+
# such as a flag to suppress version stamp generation.
4+
*.gen.dart
5+
# TODO(stuartmorgan): Add exceptions for specific files that are used in
6+
# integration tests, as they will need to be checked in to avoid analysis
7+
# failures. The exclusion of other files is to prevent having multiple
8+
# copies of all of the Dart output until more tests are restructured to
9+
# minimize duplication.

packages/pigeon/platform_tests/test_plugin/windows/CMakeLists.txt

+32-32
Original file line numberDiff line numberDiff line change
@@ -83,38 +83,38 @@ add_executable(${TEST_RUNNER}
8383
test/pigeon_test.cpp
8484
test/primitive_test.cpp
8585
# Generated sources.
86-
test/all_datatypes.g.cpp
87-
test/all_datatypes.g.h
88-
test/all_void.g.cpp
89-
test/all_void.g.h
90-
test/async_handlers.g.cpp
91-
test/async_handlers.g.h
92-
test/enum.g.cpp
93-
test/enum.g.h
94-
test/host2flutter.g.cpp
95-
test/host2flutter.g.h
96-
test/list.g.cpp
97-
test/list.g.h
98-
test/message.g.cpp
99-
test/message.g.h
100-
test/multiple_arity.g.cpp
101-
test/multiple_arity.g.h
102-
test/non_null_fields.g.cpp
103-
test/non_null_fields.g.h
104-
test/null_fields.g.cpp
105-
test/null_fields.g.h
106-
test/nullable_returns.g.cpp
107-
test/nullable_returns.g.h
108-
test/primitive.g.cpp
109-
test/primitive.g.h
110-
test/void_arg_flutter.g.cpp
111-
test/void_arg_flutter.g.h
112-
test/void_arg_host.g.cpp
113-
test/void_arg_host.g.h
114-
test/voidflutter.g.cpp
115-
test/voidflutter.g.h
116-
test/voidhost.g.cpp
117-
test/voidhost.g.h
86+
test/all_datatypes.gen.cpp
87+
test/all_datatypes.gen.h
88+
test/all_void.gen.cpp
89+
test/all_void.gen.h
90+
test/async_handlers.gen.cpp
91+
test/async_handlers.gen.h
92+
test/enum.gen.cpp
93+
test/enum.gen.h
94+
test/host2flutter.gen.cpp
95+
test/host2flutter.gen.h
96+
test/list.gen.cpp
97+
test/list.gen.h
98+
test/message.gen.cpp
99+
test/message.gen.h
100+
test/multiple_arity.gen.cpp
101+
test/multiple_arity.gen.h
102+
test/non_null_fields.gen.cpp
103+
test/non_null_fields.gen.h
104+
test/null_fields.gen.cpp
105+
test/null_fields.gen.h
106+
test/nullable_returns.gen.cpp
107+
test/nullable_returns.gen.h
108+
test/primitive.gen.cpp
109+
test/primitive.gen.h
110+
test/void_arg_flutter.gen.cpp
111+
test/void_arg_flutter.gen.h
112+
test/void_arg_host.gen.cpp
113+
test/void_arg_host.gen.h
114+
test/voidflutter.gen.cpp
115+
test/voidflutter.gen.h
116+
test/voidhost.gen.cpp
117+
test/voidhost.gen.h
118118
# Test utilities.
119119
test/utils/echo_messenger.cpp
120120
test/utils/echo_messenger.h
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# TODO(stuartmorgan): Remove this, so that review will show the effects of
22
# changes on generated files. This will need a way to avoid unnecessary churn,
33
# such as a flag to suppress version stamp generation.
4-
*.g.h
5-
*.g.cpp
4+
*.gen.h
5+
*.gen.cpp

packages/pigeon/platform_tests/test_plugin/windows/test/multiple_arity_test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include <gtest/gtest.h>
66

7-
#include "test/multiple_arity.g.h"
7+
#include "test/multiple_arity.gen.h"
88
#include "test/utils/fake_host_messenger.h"
99

1010
namespace multiple_arity_pigeontest {

packages/pigeon/platform_tests/test_plugin/windows/test/non_null_fields_test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include <gtest/gtest.h>
66

7-
#include "non_null_fields.g.h"
7+
#include "non_null_fields.gen.h"
88

99
namespace non_null_fields_pigeontest {
1010

packages/pigeon/platform_tests/test_plugin/windows/test/null_fields_test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <flutter/encodable_value.h>
66
#include <gtest/gtest.h>
77

8-
#include "null_fields.g.h"
8+
#include "null_fields.gen.h"
99

1010
namespace null_fields_pigeontest {
1111

packages/pigeon/platform_tests/test_plugin/windows/test/nullable_returns_test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include <optional>
88

9-
#include "test/nullable_returns.g.h"
9+
#include "test/nullable_returns.gen.h"
1010
#include "test/utils/fake_host_messenger.h"
1111

1212
namespace nullable_returns_pigeontest {

packages/pigeon/platform_tests/test_plugin/windows/test/pigeon_test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <memory>
1111
#include <string>
1212

13-
#include "message.g.h"
13+
#include "message.gen.h"
1414

1515
namespace test_plugin {
1616
namespace test {

packages/pigeon/platform_tests/test_plugin/windows/test/primitive_test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include <gtest/gtest.h>
66

7-
#include "test/primitive.g.h"
7+
#include "test/primitive.gen.h"
88
#include "test/utils/fake_host_messenger.h"
99

1010
namespace primitive_pigeontest {

0 commit comments

Comments
 (0)