Run native_ui_tests_macos in correct directory (#90829)
This commit is contained in:
parent
3a6c18daec
commit
be8d29ffc6
@ -7,6 +7,7 @@ import 'package:flutter_devicelab/framework/framework.dart';
|
|||||||
import 'package:flutter_devicelab/framework/ios.dart';
|
import 'package:flutter_devicelab/framework/ios.dart';
|
||||||
import 'package:flutter_devicelab/framework/task_result.dart';
|
import 'package:flutter_devicelab/framework/task_result.dart';
|
||||||
import 'package:flutter_devicelab/framework/utils.dart';
|
import 'package:flutter_devicelab/framework/utils.dart';
|
||||||
|
import 'package:path/path.dart' as path;
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
deviceOperatingSystem = DeviceOperatingSystem.ios;
|
deviceOperatingSystem = DeviceOperatingSystem.ios;
|
||||||
@ -35,7 +36,7 @@ Future<void> main() async {
|
|||||||
section('Run platform unit tests');
|
section('Run platform unit tests');
|
||||||
|
|
||||||
final Device device = await devices.workingDevice;
|
final Device device = await devices.workingDevice;
|
||||||
if (!await runXcodeTests(projectDirectory, device.deviceId, 'native_ui_tests_ios')) {
|
if (!await runXcodeTests(path.join(projectDirectory, 'ios'), 'id=${device.deviceId}', 'native_ui_tests_ios')) {
|
||||||
return TaskResult.failure('Platform unit tests failed');
|
return TaskResult.failure('Platform unit tests failed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import 'package:flutter_devicelab/framework/framework.dart';
|
|||||||
import 'package:flutter_devicelab/framework/ios.dart';
|
import 'package:flutter_devicelab/framework/ios.dart';
|
||||||
import 'package:flutter_devicelab/framework/task_result.dart';
|
import 'package:flutter_devicelab/framework/task_result.dart';
|
||||||
import 'package:flutter_devicelab/framework/utils.dart';
|
import 'package:flutter_devicelab/framework/utils.dart';
|
||||||
|
import 'package:path/path.dart' as path;
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
await task(() async {
|
await task(() async {
|
||||||
@ -26,7 +27,7 @@ Future<void> main() async {
|
|||||||
|
|
||||||
section('Run platform unit tests');
|
section('Run platform unit tests');
|
||||||
|
|
||||||
if (!await runXcodeTests(projectDirectory, 'platform=macOS', 'native_ui_tests_macos')) {
|
if (!await runXcodeTests(path.join(projectDirectory, 'macos'), 'platform=macOS', 'native_ui_tests_macos')) {
|
||||||
return TaskResult.failure('Platform unit tests failed');
|
return TaskResult.failure('Platform unit tests failed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ Future<void> removeIOSimulator(String deviceId) async {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> runXcodeTests(String projectDirectory, String deviceId, String testName) async {
|
Future<bool> runXcodeTests(String platformDirectory, String destination, String testName) async {
|
||||||
final Map<String, String> environment = Platform.environment;
|
final Map<String, String> environment = Platform.environment;
|
||||||
// If not running on CI, inject the Flutter team code signing properties.
|
// If not running on CI, inject the Flutter team code signing properties.
|
||||||
final String developmentTeam = environment['FLUTTER_XCODE_DEVELOPMENT_TEAM'] ?? 'S8QB4VV633';
|
final String developmentTeam = environment['FLUTTER_XCODE_DEVELOPMENT_TEAM'] ?? 'S8QB4VV633';
|
||||||
@ -159,7 +159,7 @@ Future<bool> runXcodeTests(String projectDirectory, String deviceId, String test
|
|||||||
'-configuration',
|
'-configuration',
|
||||||
'Release',
|
'Release',
|
||||||
'-destination',
|
'-destination',
|
||||||
'id=$deviceId',
|
destination,
|
||||||
'-resultBundlePath',
|
'-resultBundlePath',
|
||||||
resultBundlePath,
|
resultBundlePath,
|
||||||
'test',
|
'test',
|
||||||
@ -170,27 +170,32 @@ Future<bool> runXcodeTests(String projectDirectory, String deviceId, String test
|
|||||||
if (provisioningProfile != null)
|
if (provisioningProfile != null)
|
||||||
'PROVISIONING_PROFILE_SPECIFIER=$provisioningProfile',
|
'PROVISIONING_PROFILE_SPECIFIER=$provisioningProfile',
|
||||||
],
|
],
|
||||||
workingDirectory: path.join(projectDirectory, 'ios'),
|
workingDirectory: platformDirectory,
|
||||||
canFail: true,
|
canFail: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (testResultExit != 0) {
|
if (testResultExit != 0) {
|
||||||
final Directory? dumpDirectory = hostAgent.dumpDirectory;
|
final Directory? dumpDirectory = hostAgent.dumpDirectory;
|
||||||
|
final Directory xcresultBundle = Directory(path.join(resultBundleTemp, 'result.xcresult'));
|
||||||
if (dumpDirectory != null) {
|
if (dumpDirectory != null) {
|
||||||
// Zip the test results to the artifacts directory for upload.
|
if (xcresultBundle.existsSync()) {
|
||||||
final String zipPath = path.join(dumpDirectory.path,
|
// Zip the test results to the artifacts directory for upload.
|
||||||
'$testName-${DateTime.now().toLocal().toIso8601String()}.zip');
|
final String zipPath = path.join(dumpDirectory.path,
|
||||||
await exec(
|
'$testName-${DateTime.now().toLocal().toIso8601String()}.zip');
|
||||||
'zip',
|
await exec(
|
||||||
<String>[
|
'zip',
|
||||||
'-r',
|
<String>[
|
||||||
'-9',
|
'-r',
|
||||||
zipPath,
|
'-9',
|
||||||
'result.xcresult',
|
zipPath,
|
||||||
],
|
path.basename(xcresultBundle.path),
|
||||||
workingDirectory: resultBundleTemp,
|
],
|
||||||
canFail: true, // Best effort to get the logs.
|
workingDirectory: resultBundleTemp,
|
||||||
);
|
canFail: true, // Best effort to get the logs.
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
print('xcresult bundle ${xcresultBundle.path} does not exist, skipping upload');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user