KernelInfo: better error.
Previous error message:
No kernel entry found for kernel version x.y
Add more information to the error message.
Test: pass
Change-Id: Iee20fadd700d6db406cded6dd6790518c85ec60f
diff --git a/KernelInfo.cpp b/KernelInfo.cpp
index 6c8c1b6..98dc6c3 100644
--- a/KernelInfo.cpp
+++ b/KernelInfo.cpp
@@ -107,7 +107,17 @@
if (kernelsForLevel.empty()) {
if (error) {
- *error = "No kernel entry found for kernel version " + to_string(mVersion.dropMinor());
+ std::stringstream ss;
+ ss << "No kernel entry found for kernel version " << mVersion.dropMinor()
+ << " at kernel FCM version "
+ << (kernelLevel == Level::UNSPECIFIED ? "unspecified" : to_string(kernelLevel))
+ << ". The following kernel requirements are checked:";
+ for (const MatrixKernel& matrixKernel : kernels) {
+ ss << "\n Minimum LTS: " << matrixKernel.minLts()
+ << ", kernel FCM version: " << matrixKernel.getSourceMatrixLevel()
+ << (matrixKernel.conditions().empty() ? "" : ", with conditionals");
+ };
+ *error = ss.str();
}
return {};
}
@@ -136,7 +146,7 @@
msg.mLevel = Level::R;
*error = "Kernel FCM version is not specified, but kernel version " +
to_string(mVersion) +
- " is found. Fix by specifying kernel FCM version in device manifest."
+ " is found. Fix by specifying kernel FCM version in device manifest. "
"For example, for a *-r kernel:\n" +
gKernelInfoConverter(msg);
}
@@ -213,7 +223,7 @@
for (const MatrixKernel* matrixKernel : kernels) {
ss << "\n Minimum LTS: " << matrixKernel->minLts()
<< ", kernel FCM version: " << matrixKernel->getSourceMatrixLevel()
- << (matrixKernel->conditions().empty() ? "\n" : ", with conditionals");
+ << (matrixKernel->conditions().empty() ? "" : ", with conditionals");
};
*error = ss.str();
}