Skip to content

Commit 0776656

Browse files
Start the helper apps for the MTRDevice pool test as part of the test.
We're actually hitting random failures where the apps get started, but over 15 minutes pass before the test tries to commission them, which causes them to close their commissioning windows, which makes the test fail. The fix is to just start the apps right when we're about to need them.
1 parent 3e93ba6 commit 0776656

File tree

3 files changed

+24
-17
lines changed

3 files changed

+24
-17
lines changed

.github/workflows/darwin.yaml

-5
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,6 @@ jobs:
115115
echo "This is a simple log" > /tmp/darwin/framework-tests/end_user_support_log.txt
116116
../../../out/debug/chip-all-clusters-app --interface-id -1 --end_user_support_log /tmp/darwin/framework-tests/end_user_support_log.txt > >(tee /tmp/darwin/framework-tests/all-cluster-app.log) 2> >(tee /tmp/darwin/framework-tests/all-cluster-app-err.log >&2) &
117117
../../../out/debug/chip-all-clusters-app --interface-id -1 --dac_provider ../../../credentials/development/commissioner_dut/struct_cd_origin_pid_vid_correct/test_case_vector.json --product-id 32768 --discriminator 3839 --secured-device-port 5539 --KVS /tmp/chip-all-clusters-app-kvs2 > >(tee /tmp/darwin/framework-tests/all-cluster-app-origin-vid.log) 2> >(tee /tmp/darwin/framework-tests/all-cluster-app-origin-vid-err.log >&2) &
118-
../../../out/debug/chip-all-clusters-app --interface-id -1 --discriminator 101 --passcode 1001 --KVS /tmp/chip-all-clusters-app-kvs101 --secured-device-port 5531 &
119-
../../../out/debug/chip-all-clusters-app --interface-id -1 --discriminator 102 --passcode 1002 --KVS /tmp/chip-all-clusters-app-kvs102 --secured-device-port 5532 &
120-
../../../out/debug/chip-all-clusters-app --interface-id -1 --discriminator 103 --passcode 1003 --KVS /tmp/chip-all-clusters-app-kvs103 --secured-device-port 5533 &
121-
../../../out/debug/chip-all-clusters-app --interface-id -1 --discriminator 104 --passcode 1004 --KVS /tmp/chip-all-clusters-app-kvs104 --secured-device-port 5534 &
122-
../../../out/debug/chip-all-clusters-app --interface-id -1 --discriminator 105 --passcode 1005 --KVS /tmp/chip-all-clusters-app-kvs105 --secured-device-port 5535 &
123118
124119
export TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1
125120

src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m

+23-11
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#import "MTRTestKeys.h"
3030
#import "MTRTestPerControllerStorage.h"
3131
#import "MTRTestResetCommissioneeHelper.h"
32+
#import "MTRTestServerAppRunner.h"
3233

3334
static const uint16_t kPairingTimeoutInSeconds = 10;
3435
static const uint16_t kTimeoutInSeconds = 3;
@@ -2147,7 +2148,7 @@ - (void)testSetMRPParametersWithRunningController
21472148
}
21482149

21492150
// TODO: This might also want to go in a separate test file, with some shared setup for commissioning devices per test
2150-
- (void)doTestSubscriptionPoolWithSize:(NSInteger)subscriptionPoolSize
2151+
- (void)doTestSubscriptionPoolWithSize:(NSInteger)subscriptionPoolSize deviceOnboardingPayloads:(NSDictionary<NSNumber *, NSString *> *)deviceOnboardingPayloads
21512152
{
21522153
__auto_type * factory = [MTRDeviceControllerFactory sharedInstance];
21532154
XCTAssertNotNil(factory);
@@ -2183,15 +2184,7 @@ - (void)doTestSubscriptionPoolWithSize:(NSInteger)subscriptionPoolSize
21832184

21842185
XCTAssertEqualObjects(controller.controllerNodeID, nodeID);
21852186

2186-
// QRCodes generated for discriminators 101~105 and passcodes 1001~1005
21872187
NSArray<NSNumber *> * orderedDeviceIDs = @[ @(101), @(102), @(103), @(104), @(105) ];
2188-
NSDictionary<NSNumber *, NSString *> * deviceOnboardingPayloads = @{
2189-
@(101) : @"MT:00000EBQ15IZC900000",
2190-
@(102) : @"MT:00000MNY16-AD900000",
2191-
@(103) : @"MT:00000UZ427GOD900000",
2192-
@(104) : @"MT:00000CQM00Z.D900000",
2193-
@(105) : @"MT:00000K0V01FDE900000",
2194-
};
21952188

21962189
// Commission 5 devices
21972190
for (NSNumber * deviceID in orderedDeviceIDs) {
@@ -2272,8 +2265,27 @@ - (void)doTestSubscriptionPoolWithSize:(NSInteger)subscriptionPoolSize
22722265

22732266
- (void)testSubscriptionPool
22742267
{
2275-
[self doTestSubscriptionPoolWithSize:1];
2276-
[self doTestSubscriptionPoolWithSize:2];
2268+
// QRCodes generated for discriminators 1111~1115 and passcodes 1001~1005
2269+
NSDictionary<NSNumber *, NSString *> * deviceOnboardingPayloads = @{
2270+
@(101) : @"MT:00000UZ427U0D900000",
2271+
@(102) : @"MT:00000CQM00BED900000",
2272+
@(103) : @"MT:00000K0V01TRD900000",
2273+
@(104) : @"MT:00000SC11293E900000",
2274+
@(105) : @"MT:00000-O913RGE900000",
2275+
};
2276+
2277+
// Start our helper apps.
2278+
__auto_type * sortedKeys = [[deviceOnboardingPayloads allKeys] sortedArrayUsingSelector:@selector(compare:)];
2279+
for (NSNumber * deviceID in sortedKeys) {
2280+
__auto_type * appRunner = [[MTRTestServerAppRunner alloc] initWithAppName:@"all-clusters"
2281+
arguments:@[]
2282+
payload:deviceOnboardingPayloads[deviceID]
2283+
testcase:self];
2284+
XCTAssertNotNil(appRunner);
2285+
}
2286+
2287+
[self doTestSubscriptionPoolWithSize:1 deviceOnboardingPayloads:deviceOnboardingPayloads];
2288+
[self doTestSubscriptionPoolWithSize:2 deviceOnboardingPayloads:deviceOnboardingPayloads];
22772289
}
22782290

22792291
@end

src/darwin/Framework/CHIPTests/TestHelpers/MTRTestServerAppRunner.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ - (instancetype)initWithAppName:(NSString *)name arguments:(NSArray<NSString *>
9090

9191
[testcase launchTask:_appTask];
9292

93-
NSLog(@"Started %@ with arguments %@ stdout=%@ and stderr=%@", name, allArguments, outFile, errorFile);
93+
NSLog(@"Started chip-%@-app with arguments %@ stdout=%@ and stderr=%@", name, allArguments, outFile, errorFile);
9494

9595
return self;
9696
#endif // HAVE_NSTASK

0 commit comments

Comments
 (0)