Separate blkid in the Linux library checks (#63810)
This commit is contained in:
@@ -55,26 +55,31 @@ FakeCommand _pkgConfigPresentCommand(String version) {
|
||||
);
|
||||
}
|
||||
|
||||
// Commands that give positive replies for all the library pkg-config queries.
|
||||
List<FakeCommand> _librariesPresentCommands() {
|
||||
return const <FakeCommand>[
|
||||
FakeCommand(command: <String>['pkg-config', '--exists', 'gtk+-3.0']),
|
||||
FakeCommand(command: <String>['pkg-config', '--exists', 'glib-2.0']),
|
||||
FakeCommand(command: <String>['pkg-config', '--exists', 'gio-2.0']),
|
||||
FakeCommand(command: <String>['pkg-config', '--exists', 'blkid']),
|
||||
/// A command that returns either success or failure for a pkg-config query
|
||||
/// for [library], depending on [exists].
|
||||
FakeCommand _libraryCheckCommand(String library, {bool exists = true}) {
|
||||
return FakeCommand(
|
||||
command: <String>['pkg-config', '--exists', library],
|
||||
exitCode: exists ? 0 : 1,
|
||||
);
|
||||
}
|
||||
|
||||
// Commands that give positive replies for all the GTK library pkg-config queries.
|
||||
List<FakeCommand> _gtkLibrariesPresentCommands() {
|
||||
return <FakeCommand>[
|
||||
_libraryCheckCommand('gtk+-3.0'),
|
||||
_libraryCheckCommand('glib-2.0'),
|
||||
_libraryCheckCommand('gio-2.0'),
|
||||
];
|
||||
}
|
||||
|
||||
// Commands that give some failures for the library pkg-config queries.
|
||||
List<FakeCommand> _librariesMissingCommands() {
|
||||
return const <FakeCommand>[
|
||||
FakeCommand(command: <String>['pkg-config', '--exists', 'gtk+-3.0']),
|
||||
FakeCommand(
|
||||
command: <String>['pkg-config', '--exists', 'glib-2.0'],
|
||||
exitCode: 1,
|
||||
),
|
||||
FakeCommand(command: <String>['pkg-config', '--exists', 'gio-2.0']),
|
||||
FakeCommand(command: <String>['pkg-config', '--exists', 'blkid']),
|
||||
// Commands that give some failures for the GTK library pkg-config queries.
|
||||
List<FakeCommand> _gtkLibrariesMissingCommands() {
|
||||
return <FakeCommand>[
|
||||
_libraryCheckCommand('gtk+-3.0'),
|
||||
_libraryCheckCommand('glib-2.0', exists: false),
|
||||
// No more entries, since the first missing GTK library stops the
|
||||
// checks.
|
||||
];
|
||||
}
|
||||
|
||||
@@ -93,7 +98,8 @@ void main() {
|
||||
_cmakePresentCommand('3.16.3'),
|
||||
_ninjaPresentCommand('1.10.0'),
|
||||
_pkgConfigPresentCommand('0.29'),
|
||||
..._librariesPresentCommands(),
|
||||
..._gtkLibrariesPresentCommands(),
|
||||
_libraryCheckCommand('blkid'),
|
||||
]);
|
||||
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
|
||||
processManager: processManager,
|
||||
@@ -116,7 +122,8 @@ void main() {
|
||||
_cmakePresentCommand('3.16.3'),
|
||||
_ninjaPresentCommand('1.10.0'),
|
||||
_pkgConfigPresentCommand('0.29'),
|
||||
..._librariesPresentCommands(),
|
||||
..._gtkLibrariesPresentCommands(),
|
||||
_libraryCheckCommand('blkid'),
|
||||
]);
|
||||
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
|
||||
processManager: processManager,
|
||||
@@ -140,7 +147,8 @@ void main() {
|
||||
_cmakePresentCommand('3.2.0'),
|
||||
_ninjaPresentCommand('1.10.0'),
|
||||
_pkgConfigPresentCommand('0.29'),
|
||||
..._librariesPresentCommands(),
|
||||
..._gtkLibrariesPresentCommands(),
|
||||
_libraryCheckCommand('blkid'),
|
||||
]);
|
||||
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
|
||||
processManager: processManager,
|
||||
@@ -164,7 +172,8 @@ void main() {
|
||||
_cmakePresentCommand('3.16.3'),
|
||||
_ninjaPresentCommand('0.8.1'),
|
||||
_pkgConfigPresentCommand('0.29'),
|
||||
..._librariesPresentCommands(),
|
||||
..._gtkLibrariesPresentCommands(),
|
||||
_libraryCheckCommand('blkid'),
|
||||
]);
|
||||
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
|
||||
processManager: processManager,
|
||||
@@ -188,7 +197,8 @@ void main() {
|
||||
_cmakePresentCommand('3.16.3'),
|
||||
_ninjaPresentCommand('1.10.0'),
|
||||
_pkgConfigPresentCommand('0.27.0'),
|
||||
..._librariesPresentCommands(),
|
||||
..._gtkLibrariesPresentCommands(),
|
||||
_libraryCheckCommand('blkid'),
|
||||
]);
|
||||
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
|
||||
processManager: processManager,
|
||||
@@ -212,7 +222,8 @@ void main() {
|
||||
_missingBinaryCommand('cmake'),
|
||||
_ninjaPresentCommand('1.10.0'),
|
||||
_pkgConfigPresentCommand('0.29'),
|
||||
..._librariesPresentCommands(),
|
||||
..._gtkLibrariesPresentCommands(),
|
||||
_libraryCheckCommand('blkid'),
|
||||
]);
|
||||
final UserMessages userMessages = UserMessages();
|
||||
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
|
||||
@@ -236,7 +247,8 @@ void main() {
|
||||
_cmakePresentCommand('3.16.3'),
|
||||
_ninjaPresentCommand('1.10.0'),
|
||||
_pkgConfigPresentCommand('0.29'),
|
||||
..._librariesPresentCommands(),
|
||||
..._gtkLibrariesPresentCommands(),
|
||||
_libraryCheckCommand('blkid'),
|
||||
]);
|
||||
final UserMessages userMessages = UserMessages();
|
||||
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
|
||||
@@ -260,7 +272,8 @@ void main() {
|
||||
_cmakePresentCommand('3.16.3'),
|
||||
_missingBinaryCommand('ninja'),
|
||||
_pkgConfigPresentCommand('0.29'),
|
||||
..._librariesPresentCommands(),
|
||||
..._gtkLibrariesPresentCommands(),
|
||||
_libraryCheckCommand('blkid'),
|
||||
]);
|
||||
final UserMessages userMessages = UserMessages();
|
||||
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
|
||||
@@ -284,7 +297,8 @@ void main() {
|
||||
_cmakePresentCommand('3.16.3'),
|
||||
_ninjaPresentCommand('1.10.0'),
|
||||
_missingBinaryCommand('pkg-config'),
|
||||
..._librariesPresentCommands(),
|
||||
..._gtkLibrariesPresentCommands(),
|
||||
_libraryCheckCommand('blkid'),
|
||||
]);
|
||||
final UserMessages userMessages = UserMessages();
|
||||
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
|
||||
@@ -302,13 +316,14 @@ void main() {
|
||||
]);
|
||||
});
|
||||
|
||||
testWithoutContext('Missing validation when libraries are not available', () async {
|
||||
testWithoutContext('Missing validation when GTK libraries are not available', () async {
|
||||
final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
_clangPresentCommand('4.0.1'),
|
||||
_cmakePresentCommand('3.16.3'),
|
||||
_ninjaPresentCommand('1.10.0'),
|
||||
_pkgConfigPresentCommand('0.29'),
|
||||
..._librariesMissingCommands(),
|
||||
..._gtkLibrariesMissingCommands(),
|
||||
_libraryCheckCommand('blkid'),
|
||||
]);
|
||||
final UserMessages userMessages = UserMessages();
|
||||
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
|
||||
@@ -327,13 +342,40 @@ void main() {
|
||||
]);
|
||||
});
|
||||
|
||||
testWithoutContext('Missing validation when libraries are not available', () async {
|
||||
final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
_clangPresentCommand('4.0.1'),
|
||||
_cmakePresentCommand('3.16.3'),
|
||||
_ninjaPresentCommand('1.10.0'),
|
||||
_pkgConfigPresentCommand('0.29'),
|
||||
..._gtkLibrariesPresentCommands(),
|
||||
_libraryCheckCommand('blkid', exists: false),
|
||||
]);
|
||||
final UserMessages userMessages = UserMessages();
|
||||
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
|
||||
processManager: processManager,
|
||||
userMessages: userMessages,
|
||||
);
|
||||
final ValidationResult result = await linuxDoctorValidator.validate();
|
||||
|
||||
expect(result.type, ValidationType.missing);
|
||||
expect(result.messages, <ValidationMessage>[
|
||||
const ValidationMessage('clang version 4.0.1-6+build1'),
|
||||
const ValidationMessage('cmake version 3.16.3'),
|
||||
const ValidationMessage('ninja version 1.10.0'),
|
||||
const ValidationMessage('pkg-config version 0.29'),
|
||||
ValidationMessage.error(userMessages.blkidLibraryMissing),
|
||||
]);
|
||||
});
|
||||
|
||||
testWithoutContext('Missing validation when multiple dependencies are not available', () async {
|
||||
final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
_missingBinaryCommand('clang++'),
|
||||
_missingBinaryCommand('cmake'),
|
||||
_ninjaPresentCommand('1.10.0'),
|
||||
_pkgConfigPresentCommand('0.29'),
|
||||
..._librariesPresentCommands(),
|
||||
..._gtkLibrariesPresentCommands(),
|
||||
_libraryCheckCommand('blkid'),
|
||||
]);
|
||||
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
|
||||
processManager: processManager,
|
||||
|
||||
Reference in New Issue
Block a user