diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 5bd9a8981d8cae..1c0f1af6ab790b 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -25,7 +25,7 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/diagnostic-logs-provider-delegate-impl.cpp", + "${chip_root}/examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/dishwasher-alarm-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp", diff --git a/examples/all-clusters-app/all-clusters-common/src/diagnostic-logs-provider-delegate-impl.cpp b/examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp similarity index 100% rename from examples/all-clusters-app/all-clusters-common/src/diagnostic-logs-provider-delegate-impl.cpp rename to examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp diff --git a/examples/all-clusters-app/all-clusters-common/include/diagnostic-logs-provider-delegate-impl.h b/examples/all-clusters-app/linux/include/diagnostic-logs-provider-delegate-impl.h similarity index 100% rename from examples/all-clusters-app/all-clusters-common/include/diagnostic-logs-provider-delegate-impl.h rename to examples/all-clusters-app/linux/include/diagnostic-logs-provider-delegate-impl.h diff --git a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m index 9698b95a0d595f..9a4cb543ffc799 100644 --- a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m +++ b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m @@ -38,7 +38,7 @@ #import static const uint16_t kPairingTimeoutInSeconds = 10; -static const uint16_t kDownloadLogTimeoutInSeconds = 50; +static const uint16_t kDownloadLogTimeoutInSeconds = 30; static const uint16_t kTimeoutInSeconds = 3; static const uint64_t kDeviceId = 0x12344321; static NSString * kOnboardingPayload = @"MT:-24J0AFN00KA0648G00"; @@ -2631,20 +2631,33 @@ - (NSTask *)createTaskForPath:(NSString *)path } - (NSError *)generateLogFile:(NSString *)outFile + size:(unsigned long long)size { - NSTask * appTask = [self createTaskForPath:@"out/debug/chip-all-clusters-app"]; - // Remove the file if one exists [[NSFileManager defaultManager] removeItemAtPath:outFile error:nil]; // Create the file [[NSFileManager defaultManager] createFileAtPath:outFile contents:nil attributes:nil]; - NSFileHandle * handle = [NSFileHandle fileHandleForUpdatingAtPath:outFile]; - appTask.standardOutput = handle; + NSString * content = @"The quick brown fox jumps over the lazy dog"; + NSFileHandle * handle = [NSFileHandle fileHandleForWritingAtPath:outFile]; + if (handle == nil) + { + NSLog(@"Failed to generate the log file %@", outFile); + } + NSError * error = nil; + unsigned long long offset = 0; + + while (offset < size - content.length && error == nil) + { + if ([handle getOffset:&offset error:nil]) + { + [handle writeData:[content dataUsingEncoding:NSUTF8StringEncoding] error:&error]; + } + } - [appTask launchAndReturnError:&error]; + [handle closeFile]; return error; } @@ -2661,7 +2674,7 @@ - (void)test029_DownloadEndUserSupportLog_NoTimeout XCTAssertNotNil(device); NSString * outFile = [NSString stringWithFormat:@"/tmp/endusersupportlog.txt"]; - NSError * error = [self generateLogFile:outFile]; + NSError * error = [self generateLogFile:outFile size:(10 * 1024)]; if (error != nil) { NSLog(@"Failed to generate log file"); @@ -2696,7 +2709,7 @@ - (void)test030_DownloadNetworkDiagnosticsLog_NoTimeout XCTAssertNotNil(device); NSString * outFile = [NSString stringWithFormat:@"/tmp/networkdiagnosticslog.txt"]; - NSError * error = [self generateLogFile:outFile]; + NSError * error = [self generateLogFile:outFile size:(4 * 1024)]; if (error != nil) { NSLog(@"Failed to generate log file"); @@ -2731,7 +2744,7 @@ - (void)test031_DownloadCrashLog_NoTimeout XCTAssertNotNil(device); NSString * outFile = [NSString stringWithFormat:@"/tmp/crashlog.txt"]; - NSError * error = [self generateLogFile:outFile]; + NSError * error = [self generateLogFile:outFile size:(3 * 1024)]; if (error != nil) { NSLog(@"Failed to generate log file");