Unverified Commit be8d29ff authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Run native_ui_tests_macos in correct directory (#90829)

parent 3a6c18da
......@@ -7,6 +7,7 @@ import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/ios.dart';
import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:path/path.dart' as path;
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.ios;
......@@ -35,7 +36,7 @@ Future<void> main() async {
section('Run platform unit tests');
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');
}
......
......@@ -6,6 +6,7 @@ import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/ios.dart';
import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:path/path.dart' as path;
Future<void> main() async {
await task(() async {
......@@ -26,7 +27,7 @@ Future<void> main() async {
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');
}
......
......@@ -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;
// If not running on CI, inject the Flutter team code signing properties.
final String developmentTeam = environment['FLUTTER_XCODE_DEVELOPMENT_TEAM'] ?? 'S8QB4VV633';
......@@ -159,7 +159,7 @@ Future<bool> runXcodeTests(String projectDirectory, String deviceId, String test
'-configuration',
'Release',
'-destination',
'id=$deviceId',
destination,
'-resultBundlePath',
resultBundlePath,
'test',
......@@ -170,27 +170,32 @@ Future<bool> runXcodeTests(String projectDirectory, String deviceId, String test
if (provisioningProfile != null)
'PROVISIONING_PROFILE_SPECIFIER=$provisioningProfile',
],
workingDirectory: path.join(projectDirectory, 'ios'),
workingDirectory: platformDirectory,
canFail: true,
);
if (testResultExit != 0) {
final Directory? dumpDirectory = hostAgent.dumpDirectory;
final Directory xcresultBundle = Directory(path.join(resultBundleTemp, 'result.xcresult'));
if (dumpDirectory != null) {
// Zip the test results to the artifacts directory for upload.
final String zipPath = path.join(dumpDirectory.path,
'$testName-${DateTime.now().toLocal().toIso8601String()}.zip');
await exec(
'zip',
<String>[
'-r',
'-9',
zipPath,
'result.xcresult',
],
workingDirectory: resultBundleTemp,
canFail: true, // Best effort to get the logs.
);
if (xcresultBundle.existsSync()) {
// Zip the test results to the artifacts directory for upload.
final String zipPath = path.join(dumpDirectory.path,
'$testName-${DateTime.now().toLocal().toIso8601String()}.zip');
await exec(
'zip',
<String>[
'-r',
'-9',
zipPath,
path.basename(xcresultBundle.path),
],
workingDirectory: resultBundleTemp,
canFail: true, // Best effort to get the logs.
);
} else {
print('xcresult bundle ${xcresultBundle.path} does not exist, skipping upload');
}
}
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment