Unverified Commit 4c417884 authored by Christopher Fujino's avatar Christopher Fujino Committed by GitHub

[flutter_tools] ensure linux doctor validator finishes when pkg-config is not installed (#103755)

parent 4f964196
......@@ -127,6 +127,8 @@ class LinuxDoctorValidator extends DoctorValidator {
final _VersionInfo? version = installedVersions[kPkgConfigBinary];
if (version == null || version.number == null) {
messages.add(ValidationMessage.error(_userMessages.pkgConfigMissing));
// Exit early because we cannot validate libraries without pkg-config.
return ValidationResult(validationType, messages);
} else {
assert(_requiredBinaryVersions.containsKey(kPkgConfigBinary));
// The full version description is just the number, so add context.
......
......@@ -219,6 +219,30 @@ void main() {
]);
});
testWithoutContext('Missing validation when pkg-config is missing', () async {
final UserMessages userMessages = UserMessages();
final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
_clangPresentCommand('4.0.1'),
_cmakePresentCommand('3.16.3'),
_ninjaPresentCommand('1.10.0'),
_missingBinaryException('pkg-config'),
// We never check libraries because pkg-config is not present
]);
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'),
ValidationMessage.error(userMessages.pkgConfigMissing),
]);
});
testWithoutContext('Missing validation when CMake is not available', () async {
final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
_clangPresentCommand('4.0.1'),
......
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