[tools,pigeon] Update tooling to handle Windows build output changes (#4826)

Updates the tooling that builds and runs Windows unit tests to handle the build output path changes in https://github.com/flutter/flutter/pull/131843
This commit is contained in:
stuartmorgan
2023-09-01 06:57:55 -07:00
committed by GitHub
parent cd94db1f08
commit b8b84b2304
4 changed files with 332 additions and 45 deletions

View File

@ -313,9 +313,30 @@ Future<int> _runWindowsUnitTests() async {
return compileCode; return compileCode;
} }
return runProcess( // Depending on the Flutter version, the build output path is different. To
'$examplePath/build/windows/plugins/test_plugin/Debug/test_plugin_test.exe', // handle both master and stable, and to future-proof against the changes
<String>[]); // that will happen in https://github.com/flutter/flutter/issues/129807
// - Try arm64, to future-proof against arm64 support.
// - Try x64, to cover pre-arm64 support on arm64 hosts, as well as x64 hosts
// running newer versions of Flutter.
// - Fall back to the pre-arch path, to support running against stable.
// TODO(stuartmorgan): Remove all this when these tests no longer need to
// support a version of Flutter without
// https://github.com/flutter/flutter/issues/129807, and just construct the
// version of the path with the current architecture.
const String buildDirBase = '$examplePath/build/windows';
const String buildRelativeBinaryPath =
'plugins/test_plugin/Debug/test_plugin_test.exe';
const String arm64Path = '$buildDirBase/arm64/$buildRelativeBinaryPath';
const String x64Path = '$buildDirBase/x64/$buildRelativeBinaryPath';
const String oldPath = '$buildDirBase/$buildRelativeBinaryPath';
if (File(arm64Path).existsSync()) {
return runProcess(arm64Path, <String>[]);
} else if (File(x64Path).existsSync()) {
return runProcess(x64Path, <String>[]);
} else {
return runProcess(oldPath, <String>[]);
}
} }
Future<int> _runWindowsIntegrationTests() async { Future<int> _runWindowsIntegrationTests() async {

View File

@ -20,6 +20,7 @@ class CMakeProject {
required this.buildMode, required this.buildMode,
this.processRunner = const ProcessRunner(), this.processRunner = const ProcessRunner(),
this.platform = const LocalPlatform(), this.platform = const LocalPlatform(),
this.arch,
}); });
/// The directory of a Flutter project to run Gradle commands in. /// The directory of a Flutter project to run Gradle commands in.
@ -31,6 +32,11 @@ class CMakeProject {
/// The platform that commands are being run on. /// The platform that commands are being run on.
final Platform platform; final Platform platform;
/// The architecture subdirectory of the build.
// TODO(stuartmorgan): Make this non-nullable once Flutter 3.13 is no longer
// supported, since at that point there will always be a subdirectory.
final String? arch;
/// The build mode (e.g., Debug, Release). /// The build mode (e.g., Debug, Release).
/// ///
/// This is a constructor paramater because on Linux many properties depend /// This is a constructor paramater because on Linux many properties depend
@ -46,14 +52,13 @@ class CMakeProject {
Directory get buildDirectory { Directory get buildDirectory {
Directory buildDir = Directory buildDir =
flutterProject.childDirectory('build').childDirectory(_platformDirName); flutterProject.childDirectory('build').childDirectory(_platformDirName);
if (arch != null) {
buildDir = buildDir.childDirectory(arch!);
}
if (platform.isLinux) { if (platform.isLinux) {
buildDir = buildDir // Linux uses a single-config generator, so the base build directory
// TODO(stuartmorgan): Support arm64 if that ever becomes a supported // includes the configuration.
// CI configuration for the repository. buildDir = buildDir.childDirectory(buildMode.toLowerCase());
.childDirectory('x64')
// Linux uses a single-config generator, so the base build directory
// includes the configuration.
.childDirectory(buildMode.toLowerCase());
} }
return buildDir; return buildDir;
} }

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ffi';
import 'package:file/file.dart'; import 'package:file/file.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
@ -41,7 +43,9 @@ class NativeTestCommand extends PackageLoopingCommand {
super.packagesDir, { super.packagesDir, {
super.processRunner, super.processRunner,
super.platform, super.platform,
}) : _xcode = Xcode(processRunner: processRunner, log: true) { Abi? abi,
}) : _abi = abi ?? Abi.current(),
_xcode = Xcode(processRunner: processRunner, log: true) {
argParser.addOption( argParser.addOption(
_iOSDestinationFlag, _iOSDestinationFlag,
help: 'Specify the destination when running iOS tests.\n' help: 'Specify the destination when running iOS tests.\n'
@ -63,6 +67,9 @@ class NativeTestCommand extends PackageLoopingCommand {
help: 'Runs native integration (UI) tests', defaultsTo: true); help: 'Runs native integration (UI) tests', defaultsTo: true);
} }
// The ABI of the host.
final Abi _abi;
// The device destination flags for iOS tests. // The device destination flags for iOS tests.
List<String> _iOSDestinationFlags = <String>[]; List<String> _iOSDestinationFlags = <String>[];
@ -548,9 +555,10 @@ this command.
isTestBinary: isTestBinary); isTestBinary: isTestBinary);
} }
/// Finds every file in the [buildDirectoryName] subdirectory of [plugin]'s /// Finds every file in the relevant (based on [platformName], [buildMode],
/// build directory for which [isTestBinary] is true, and runs all of them, /// and [arch]) subdirectory of [plugin]'s build directory for which
/// returning the overall result. /// [isTestBinary] is true, and runs all of them, returning the overall
/// result.
/// ///
/// The binaries are assumed to be Google Test test binaries, thus returning /// The binaries are assumed to be Google Test test binaries, thus returning
/// zero for success and non-zero for failure. /// zero for success and non-zero for failure.
@ -563,11 +571,45 @@ this command.
final List<File> testBinaries = <File>[]; final List<File> testBinaries = <File>[];
bool hasMissingBuild = false; bool hasMissingBuild = false;
bool buildFailed = false; bool buildFailed = false;
String? arch;
const String x64DirName = 'x64';
const String arm64DirName = 'arm64';
if (platform.isWindows) {
arch = _abi == Abi.windowsX64 ? x64DirName : arm64DirName;
} else if (platform.isLinux) {
// TODO(stuartmorgan): Support arm64 if that ever becomes a supported
// CI configuration for the repository.
arch = 'x64';
}
for (final RepositoryPackage example in plugin.getExamples()) { for (final RepositoryPackage example in plugin.getExamples()) {
final CMakeProject project = CMakeProject(example.directory, CMakeProject project = CMakeProject(example.directory,
buildMode: buildMode, buildMode: buildMode,
processRunner: processRunner, processRunner: processRunner,
platform: platform); platform: platform,
arch: arch);
if (platform.isWindows) {
if (arch == arm64DirName && !project.isConfigured()) {
// Check for x64, to handle builds newer than 3.13, but that don't yet
// have https://github.com/flutter/flutter/issues/129807.
// TODO(stuartmorgan): Remove this when CI no longer supports a
// version of Flutter without the issue above fixed.
project = CMakeProject(example.directory,
buildMode: buildMode,
processRunner: processRunner,
platform: platform,
arch: x64DirName);
}
if (!project.isConfigured()) {
// Check again without the arch subdirectory, since 3.13 doesn't
// have it yet.
// TODO(stuartmorgan): Remove this when CI no longer supports Flutter
// 3.13.
project = CMakeProject(example.directory,
buildMode: buildMode,
processRunner: processRunner,
platform: platform);
}
}
if (!project.isConfigured()) { if (!project.isConfigured()) {
printError('ERROR: Run "flutter build" on ${example.displayName}, ' printError('ERROR: Run "flutter build" on ${example.displayName}, '
'or run this tool\'s "build-examples" command, for the target ' 'or run this tool\'s "build-examples" command, for the target '

View File

@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:convert'; import 'dart:convert';
import 'dart:ffi';
import 'package:args/command_runner.dart'; import 'package:args/command_runner.dart';
import 'package:file/file.dart'; import 'package:file/file.dart';
@ -56,10 +57,13 @@ final Map<String, dynamic> _kDeviceListMap = <String, dynamic>{
}; };
const String _fakeCmakeCommand = 'path/to/cmake'; const String _fakeCmakeCommand = 'path/to/cmake';
const String _archDirX64 = 'x64';
const String _archDirArm64 = 'arm64';
void _createFakeCMakeCache(RepositoryPackage plugin, Platform platform) { void _createFakeCMakeCache(
RepositoryPackage plugin, Platform platform, String? archDir) {
final CMakeProject project = CMakeProject(getExampleDir(plugin), final CMakeProject project = CMakeProject(getExampleDir(plugin),
platform: platform, buildMode: 'Release'); platform: platform, buildMode: 'Release', arch: archDir);
final File cache = project.buildDirectory.childFile('CMakeCache.txt'); final File cache = project.buildDirectory.childFile('CMakeCache.txt');
cache.createSync(recursive: true); cache.createSync(recursive: true);
cache.writeAsStringSync('CMAKE_COMMAND:INTERNAL=$_fakeCmakeCommand'); cache.writeAsStringSync('CMAKE_COMMAND:INTERNAL=$_fakeCmakeCommand');
@ -1060,7 +1064,7 @@ public class FlutterActivityTest {
], platformSupport: <String, PlatformDetails>{ ], platformSupport: <String, PlatformDetails>{
platformLinux: const PlatformDetails(PlatformSupport.inline), platformLinux: const PlatformDetails(PlatformSupport.inline),
}); });
_createFakeCMakeCache(plugin, mockPlatform); _createFakeCMakeCache(plugin, mockPlatform, _archDirX64);
final File testBinary = childFileWithSubcomponents(plugin.directory, final File testBinary = childFileWithSubcomponents(plugin.directory,
<String>['example', ...testBinaryRelativePath.split('/')]); <String>['example', ...testBinaryRelativePath.split('/')]);
@ -1099,7 +1103,7 @@ public class FlutterActivityTest {
], platformSupport: <String, PlatformDetails>{ ], platformSupport: <String, PlatformDetails>{
platformLinux: const PlatformDetails(PlatformSupport.inline), platformLinux: const PlatformDetails(PlatformSupport.inline),
}); });
_createFakeCMakeCache(plugin, mockPlatform); _createFakeCMakeCache(plugin, mockPlatform, _archDirX64);
final File releaseTestBinary = childFileWithSubcomponents( final File releaseTestBinary = childFileWithSubcomponents(
plugin.directory, plugin.directory,
@ -1159,7 +1163,7 @@ public class FlutterActivityTest {
platformSupport: <String, PlatformDetails>{ platformSupport: <String, PlatformDetails>{
platformLinux: const PlatformDetails(PlatformSupport.inline), platformLinux: const PlatformDetails(PlatformSupport.inline),
}); });
_createFakeCMakeCache(plugin, mockPlatform); _createFakeCMakeCache(plugin, mockPlatform, _archDirX64);
Error? commandError; Error? commandError;
final List<String> output = await runCapturingPrint(runner, <String>[ final List<String> output = await runCapturingPrint(runner, <String>[
@ -1194,7 +1198,7 @@ public class FlutterActivityTest {
], platformSupport: <String, PlatformDetails>{ ], platformSupport: <String, PlatformDetails>{
platformLinux: const PlatformDetails(PlatformSupport.inline), platformLinux: const PlatformDetails(PlatformSupport.inline),
}); });
_createFakeCMakeCache(plugin, mockPlatform); _createFakeCMakeCache(plugin, mockPlatform, _archDirX64);
final File testBinary = childFileWithSubcomponents(plugin.directory, final File testBinary = childFileWithSubcomponents(plugin.directory,
<String>['example', ...testBinaryRelativePath.split('/')]); <String>['example', ...testBinaryRelativePath.split('/')]);
@ -1760,25 +1764,22 @@ public class FlutterActivityTest {
mockPlatform = MockPlatform(isWindows: true); mockPlatform = MockPlatform(isWindows: true);
packagesDir = createPackagesDirectory(fileSystem: fileSystem); packagesDir = createPackagesDirectory(fileSystem: fileSystem);
processRunner = RecordingProcessRunner(); processRunner = RecordingProcessRunner();
final NativeTestCommand command = NativeTestCommand(packagesDir,
processRunner: processRunner, platform: mockPlatform);
runner = CommandRunner<void>(
'native_test_command', 'Test for native_test_command');
runner.addCommand(command);
}); });
// Returns the ProcessCall to expect for build the Windows unit tests for // Returns the ProcessCall to expect for build the Windows unit tests for
// the given plugin. // the given plugin.
ProcessCall getWindowsBuildCall(RepositoryPackage plugin) { ProcessCall getWindowsBuildCall(RepositoryPackage plugin, String? arch) {
Directory projectDir = getExampleDir(plugin)
.childDirectory('build')
.childDirectory('windows');
if (arch != null) {
projectDir = projectDir.childDirectory(arch);
}
return ProcessCall( return ProcessCall(
_fakeCmakeCommand, _fakeCmakeCommand,
<String>[ <String>[
'--build', '--build',
getExampleDir(plugin) projectDir.path,
.childDirectory('build')
.childDirectory('windows')
.path,
'--target', '--target',
'unit_tests', 'unit_tests',
'--config', '--config',
@ -1787,8 +1788,58 @@ public class FlutterActivityTest {
null); null);
} }
group('Windows', () { group('Windows x64', () {
setUp(() {
final NativeTestCommand command = NativeTestCommand(packagesDir,
processRunner: processRunner,
platform: mockPlatform,
abi: Abi.windowsX64);
runner = CommandRunner<void>(
'native_test_command', 'Test for native_test_command');
runner.addCommand(command);
});
test('runs unit tests', () async { test('runs unit tests', () async {
const String x64TestBinaryRelativePath =
'build/windows/x64/Debug/bar/plugin_test.exe';
const String arm64TestBinaryRelativePath =
'build/windows/arm64/Debug/bar/plugin_test.exe';
final RepositoryPackage plugin =
createFakePlugin('plugin', packagesDir, extraFiles: <String>[
'example/$x64TestBinaryRelativePath',
'example/$arm64TestBinaryRelativePath',
], platformSupport: <String, PlatformDetails>{
platformWindows: const PlatformDetails(PlatformSupport.inline),
});
_createFakeCMakeCache(plugin, mockPlatform, _archDirX64);
final File testBinary = childFileWithSubcomponents(plugin.directory,
<String>['example', ...x64TestBinaryRelativePath.split('/')]);
final List<String> output = await runCapturingPrint(runner, <String>[
'native-test',
'--windows',
'--no-integration',
]);
expect(
output,
containsAllInOrder(<Matcher>[
contains('Running plugin_test.exe...'),
contains('No issues found!'),
]),
);
expect(
processRunner.recordedCalls,
orderedEquals(<ProcessCall>[
getWindowsBuildCall(plugin, _archDirX64),
ProcessCall(testBinary.path, const <String>[], null),
]));
});
test('runs unit tests with legacy build output', () async {
const String testBinaryRelativePath = const String testBinaryRelativePath =
'build/windows/Debug/bar/plugin_test.exe'; 'build/windows/Debug/bar/plugin_test.exe';
final RepositoryPackage plugin = final RepositoryPackage plugin =
@ -1797,7 +1848,7 @@ public class FlutterActivityTest {
], platformSupport: <String, PlatformDetails>{ ], platformSupport: <String, PlatformDetails>{
platformWindows: const PlatformDetails(PlatformSupport.inline), platformWindows: const PlatformDetails(PlatformSupport.inline),
}); });
_createFakeCMakeCache(plugin, mockPlatform); _createFakeCMakeCache(plugin, mockPlatform, null);
final File testBinary = childFileWithSubcomponents(plugin.directory, final File testBinary = childFileWithSubcomponents(plugin.directory,
<String>['example', ...testBinaryRelativePath.split('/')]); <String>['example', ...testBinaryRelativePath.split('/')]);
@ -1819,16 +1870,16 @@ public class FlutterActivityTest {
expect( expect(
processRunner.recordedCalls, processRunner.recordedCalls,
orderedEquals(<ProcessCall>[ orderedEquals(<ProcessCall>[
getWindowsBuildCall(plugin), getWindowsBuildCall(plugin, null),
ProcessCall(testBinary.path, const <String>[], null), ProcessCall(testBinary.path, const <String>[], null),
])); ]));
}); });
test('only runs debug unit tests', () async { test('only runs debug unit tests', () async {
const String debugTestBinaryRelativePath = const String debugTestBinaryRelativePath =
'build/windows/Debug/bar/plugin_test.exe'; 'build/windows/x64/Debug/bar/plugin_test.exe';
const String releaseTestBinaryRelativePath = const String releaseTestBinaryRelativePath =
'build/windows/Release/bar/plugin_test.exe'; 'build/windows/x64/Release/bar/plugin_test.exe';
final RepositoryPackage plugin = final RepositoryPackage plugin =
createFakePlugin('plugin', packagesDir, extraFiles: <String>[ createFakePlugin('plugin', packagesDir, extraFiles: <String>[
'example/$debugTestBinaryRelativePath', 'example/$debugTestBinaryRelativePath',
@ -1836,7 +1887,7 @@ public class FlutterActivityTest {
], platformSupport: <String, PlatformDetails>{ ], platformSupport: <String, PlatformDetails>{
platformWindows: const PlatformDetails(PlatformSupport.inline), platformWindows: const PlatformDetails(PlatformSupport.inline),
}); });
_createFakeCMakeCache(plugin, mockPlatform); _createFakeCMakeCache(plugin, mockPlatform, _archDirX64);
final File debugTestBinary = childFileWithSubcomponents( final File debugTestBinary = childFileWithSubcomponents(
plugin.directory, plugin.directory,
@ -1859,7 +1910,47 @@ public class FlutterActivityTest {
expect( expect(
processRunner.recordedCalls, processRunner.recordedCalls,
orderedEquals(<ProcessCall>[ orderedEquals(<ProcessCall>[
getWindowsBuildCall(plugin), getWindowsBuildCall(plugin, _archDirX64),
ProcessCall(debugTestBinary.path, const <String>[], null),
]));
});
test('only runs debug unit tests with legacy build output', () async {
const String debugTestBinaryRelativePath =
'build/windows/Debug/bar/plugin_test.exe';
const String releaseTestBinaryRelativePath =
'build/windows/Release/bar/plugin_test.exe';
final RepositoryPackage plugin =
createFakePlugin('plugin', packagesDir, extraFiles: <String>[
'example/$debugTestBinaryRelativePath',
'example/$releaseTestBinaryRelativePath'
], platformSupport: <String, PlatformDetails>{
platformWindows: const PlatformDetails(PlatformSupport.inline),
});
_createFakeCMakeCache(plugin, mockPlatform, null);
final File debugTestBinary = childFileWithSubcomponents(
plugin.directory,
<String>['example', ...debugTestBinaryRelativePath.split('/')]);
final List<String> output = await runCapturingPrint(runner, <String>[
'native-test',
'--windows',
'--no-integration',
]);
expect(
output,
containsAllInOrder(<Matcher>[
contains('Running plugin_test.exe...'),
contains('No issues found!'),
]),
);
expect(
processRunner.recordedCalls,
orderedEquals(<ProcessCall>[
getWindowsBuildCall(plugin, null),
ProcessCall(debugTestBinary.path, const <String>[], null), ProcessCall(debugTestBinary.path, const <String>[], null),
])); ]));
}); });
@ -1896,7 +1987,7 @@ public class FlutterActivityTest {
platformSupport: <String, PlatformDetails>{ platformSupport: <String, PlatformDetails>{
platformWindows: const PlatformDetails(PlatformSupport.inline), platformWindows: const PlatformDetails(PlatformSupport.inline),
}); });
_createFakeCMakeCache(plugin, mockPlatform); _createFakeCMakeCache(plugin, mockPlatform, _archDirX64);
Error? commandError; Error? commandError;
final List<String> output = await runCapturingPrint(runner, <String>[ final List<String> output = await runCapturingPrint(runner, <String>[
@ -1918,20 +2009,20 @@ public class FlutterActivityTest {
expect( expect(
processRunner.recordedCalls, processRunner.recordedCalls,
orderedEquals(<ProcessCall>[ orderedEquals(<ProcessCall>[
getWindowsBuildCall(plugin), getWindowsBuildCall(plugin, _archDirX64),
])); ]));
}); });
test('fails if a unit test fails', () async { test('fails if a unit test fails', () async {
const String testBinaryRelativePath = const String testBinaryRelativePath =
'build/windows/Debug/bar/plugin_test.exe'; 'build/windows/x64/Debug/bar/plugin_test.exe';
final RepositoryPackage plugin = final RepositoryPackage plugin =
createFakePlugin('plugin', packagesDir, extraFiles: <String>[ createFakePlugin('plugin', packagesDir, extraFiles: <String>[
'example/$testBinaryRelativePath' 'example/$testBinaryRelativePath'
], platformSupport: <String, PlatformDetails>{ ], platformSupport: <String, PlatformDetails>{
platformWindows: const PlatformDetails(PlatformSupport.inline), platformWindows: const PlatformDetails(PlatformSupport.inline),
}); });
_createFakeCMakeCache(plugin, mockPlatform); _createFakeCMakeCache(plugin, mockPlatform, _archDirX64);
final File testBinary = childFileWithSubcomponents(plugin.directory, final File testBinary = childFileWithSubcomponents(plugin.directory,
<String>['example', ...testBinaryRelativePath.split('/')]); <String>['example', ...testBinaryRelativePath.split('/')]);
@ -1961,10 +2052,138 @@ public class FlutterActivityTest {
expect( expect(
processRunner.recordedCalls, processRunner.recordedCalls,
orderedEquals(<ProcessCall>[ orderedEquals(<ProcessCall>[
getWindowsBuildCall(plugin), getWindowsBuildCall(plugin, _archDirX64),
ProcessCall(testBinary.path, const <String>[], null), ProcessCall(testBinary.path, const <String>[], null),
])); ]));
}); });
}); });
group('Windows arm64', () {
setUp(() {
final NativeTestCommand command = NativeTestCommand(packagesDir,
processRunner: processRunner,
platform: mockPlatform,
abi: Abi.windowsArm64);
runner = CommandRunner<void>(
'native_test_command', 'Test for native_test_command');
runner.addCommand(command);
});
test('runs unit tests', () async {
const String x64TestBinaryRelativePath =
'build/windows/x64/Debug/bar/plugin_test.exe';
const String arm64TestBinaryRelativePath =
'build/windows/arm64/Debug/bar/plugin_test.exe';
final RepositoryPackage plugin =
createFakePlugin('plugin', packagesDir, extraFiles: <String>[
'example/$x64TestBinaryRelativePath',
'example/$arm64TestBinaryRelativePath',
], platformSupport: <String, PlatformDetails>{
platformWindows: const PlatformDetails(PlatformSupport.inline),
});
_createFakeCMakeCache(plugin, mockPlatform, _archDirArm64);
final File testBinary = childFileWithSubcomponents(plugin.directory,
<String>['example', ...arm64TestBinaryRelativePath.split('/')]);
final List<String> output = await runCapturingPrint(runner, <String>[
'native-test',
'--windows',
'--no-integration',
]);
expect(
output,
containsAllInOrder(<Matcher>[
contains('Running plugin_test.exe...'),
contains('No issues found!'),
]),
);
expect(
processRunner.recordedCalls,
orderedEquals(<ProcessCall>[
getWindowsBuildCall(plugin, _archDirArm64),
ProcessCall(testBinary.path, const <String>[], null),
]));
});
test('falls back to x64 unit tests if arm64 is not built', () async {
const String x64TestBinaryRelativePath =
'build/windows/x64/Debug/bar/plugin_test.exe';
final RepositoryPackage plugin =
createFakePlugin('plugin', packagesDir, extraFiles: <String>[
'example/$x64TestBinaryRelativePath',
], platformSupport: <String, PlatformDetails>{
platformWindows: const PlatformDetails(PlatformSupport.inline),
});
_createFakeCMakeCache(plugin, mockPlatform, _archDirX64);
final File testBinary = childFileWithSubcomponents(plugin.directory,
<String>['example', ...x64TestBinaryRelativePath.split('/')]);
final List<String> output = await runCapturingPrint(runner, <String>[
'native-test',
'--windows',
'--no-integration',
]);
expect(
output,
containsAllInOrder(<Matcher>[
contains('Running plugin_test.exe...'),
contains('No issues found!'),
]),
);
expect(
processRunner.recordedCalls,
orderedEquals(<ProcessCall>[
getWindowsBuildCall(plugin, _archDirX64),
ProcessCall(testBinary.path, const <String>[], null),
]));
});
test('only runs debug unit tests', () async {
const String debugTestBinaryRelativePath =
'build/windows/arm64/Debug/bar/plugin_test.exe';
const String releaseTestBinaryRelativePath =
'build/windows/arm64/Release/bar/plugin_test.exe';
final RepositoryPackage plugin =
createFakePlugin('plugin', packagesDir, extraFiles: <String>[
'example/$debugTestBinaryRelativePath',
'example/$releaseTestBinaryRelativePath'
], platformSupport: <String, PlatformDetails>{
platformWindows: const PlatformDetails(PlatformSupport.inline),
});
_createFakeCMakeCache(plugin, mockPlatform, _archDirArm64);
final File debugTestBinary = childFileWithSubcomponents(
plugin.directory,
<String>['example', ...debugTestBinaryRelativePath.split('/')]);
final List<String> output = await runCapturingPrint(runner, <String>[
'native-test',
'--windows',
'--no-integration',
]);
expect(
output,
containsAllInOrder(<Matcher>[
contains('Running plugin_test.exe...'),
contains('No issues found!'),
]),
);
expect(
processRunner.recordedCalls,
orderedEquals(<ProcessCall>[
getWindowsBuildCall(plugin, _archDirArm64),
ProcessCall(debugTestBinary.path, const <String>[], null),
]));
});
});
}); });
} }