[PATCH] fwts: attempt to make fwts less Ubuntu specific, (LP: #1246653)

Colin King colin.king at canonical.com
Tue Jan 7 16:01:25 UTC 2014


From: Colin Ian King <colin.king at canonical.com>

Where possible, conditionally skip over Ubuntu specific tests and
also try to reduce the number of Ubuntu references in the tests
to make it more disto friendly.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/kernel/version/version.c             | 20 ++++++++++++++++----
 src/uefi/securebootcert/securebootcert.c |  8 ++++----
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/kernel/version/version.c b/src/kernel/version/version.c
index 60728b1..846da38 100644
--- a/src/kernel/version/version.c
+++ b/src/kernel/version/version.c
@@ -16,19 +16,31 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  */
+#include <stdbool.h>
 
 #include "fwts.h"
 
 static int version_test1(fwts_framework *fw)
 {
 	char *str;
+	fwts_release *release;
+
+	release = fwts_release_get();
+        if (release) {
+		bool not_ubuntu = strcmp(release->distributor, "Ubuntu");
+
+		fwts_release_free(release);
+		/* Following is Ubuntu specific, so don't fail */
+		if (not_ubuntu) {
+			fwts_skipped(fw, "Information not available with this kernel.");
+			return FWTS_OK;
+		}
+        }
 
-	/* Following is Ubuntu specific, so don't fail */
 	if ((str = fwts_get("/proc/version_signature")) == NULL)
-		fwts_log_info(fw,
+		fwts_skipped(fw,
 			"Cannot get version signature info from "
-			"/proc/version_signature (This is Ubuntu "
-			"specific, and is not necessarily a failure).");
+			"/proc/version_signature");
 	else {
 		fwts_chop_newline(str);
 		fwts_log_info(fw, "Signature: %s", str);
diff --git a/src/uefi/securebootcert/securebootcert.c b/src/uefi/securebootcert/securebootcert.c
index ca5da61..8929c44 100644
--- a/src/uefi/securebootcert/securebootcert.c
+++ b/src/uefi/securebootcert/securebootcert.c
@@ -267,12 +267,12 @@ static void securebootcert_key_ex_key(fwts_framework *fw, fwts_uefi_var *var, ch
 
 	fwts_release *release = fwts_release_get();
 	if (release == NULL) {
-		fwts_skipped(fw, "Cannot determine system, stop checking the Ubuntu Master CA certificate.");
+		fwts_skipped(fw, "Cannot determine system, stop checking the Master CA certificate.");
 		return;
 	}
 
 	if (strcmp(release->distributor, "Ubuntu") != 0) {
-		fwts_skipped(fw, "Not a Ubuntu system, it's not necessary checking the Ubuntu Master CA certificate.");
+		fwts_skipped(fw, "Not a Ubuntu system, skipping the Ubuntu Master CA certificate check.");
 		fwts_release_free(release);
 		return;
 	}
@@ -372,12 +372,12 @@ static int securebootcert_test1(fwts_framework *fw)
 }
 
 static fwts_framework_minor_test securebootcert_tests[] = {
-	{ securebootcert_test1, "Ubuntu UEFI secure boot test." },
+	{ securebootcert_test1, "UEFI secure boot test." },
 	{ NULL, NULL }
 };
 
 static fwts_framework_ops securebootcert_ops = {
-	.description = "Ubuntu UEFI secure boot test.",
+	.description = "UEFI secure boot test.",
 	.init        = securebootcert_init,
 	.minor_tests = securebootcert_tests
 };
-- 
1.8.5.2




More information about the fwts-devel mailing list