Patchwork kernel: version: make test infoonly rather than pass/fail tests

login
register
mail settings
Submitter Colin King
Date Dec. 7, 2012, 6:33 p.m.
Message ID <1354905233-29857-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/204596/
State Accepted
Headers show

Comments

Colin King - Dec. 7, 2012, 6:33 p.m.
From: Colin Ian King <colin.king@canonical.com>

Make these infoonly tests rather than pass or fail.  This is more
friendly for non-x86 or non-ACPI systems or non-Ubuntu kernel systems.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/kernel/version/version.c | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)
Keng-Yu Lin - Dec. 12, 2012, 3:26 a.m.
On Sat, Dec 8, 2012 at 2:33 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Make these infoonly tests rather than pass or fail.  This is more
> friendly for non-x86 or non-ACPI systems or non-Ubuntu kernel systems.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/kernel/version/version.c | 30 +++++++++++++++++++-----------
>  1 file changed, 19 insertions(+), 11 deletions(-)
>
> diff --git a/src/kernel/version/version.c b/src/kernel/version/version.c
> index 14f24a2..087937e 100644
> --- a/src/kernel/version/version.c
> +++ b/src/kernel/version/version.c
> @@ -25,13 +25,18 @@ static int version_test1(fwts_framework *fw)
>
>         /* Following is Ubuntu specific, so don't fail */
>         if ((str = fwts_get("/proc/version_signature")) == NULL)
> -               fwts_warning(fw,
> -                       "Cannot get version signature info from /proc/version_signature (This is Ubuntu specific, and not necessarily a failure).");
> +               fwts_log_info(fw,
> +                       "Cannot get version signature info from "
> +                       "/proc/version_signature (This is Ubuntu "
> +                       "specific, and is not necessarily a failure).");
>         else {
>                 fwts_chop_newline(str);
> -               fwts_passed(fw, "Signature: %s", str);
> +               fwts_log_info(fw, "Signature: %s", str);
>                 free(str);
>         }
> +
> +       fwts_infoonly(fw);
> +
>         return FWTS_OK;
>  }
>
> @@ -41,14 +46,14 @@ static int version_test2(fwts_framework *fw)
>
>
>         if ((str = fwts_get("/proc/version")) == NULL)
> -               fwts_failed(fw, LOG_LEVEL_LOW,
> -                       "KernelProcVersion",
> -                       "Cannot get version info from /proc/version");
> +               fwts_log_info(fw, "Cannot get version info from /proc/version");
>         else {
>                 fwts_chop_newline(str);
> -               fwts_passed(fw, "Kernel Version: %s", str);
> +               fwts_log_info(fw, "Kernel Version: %s", str);
>                 free(str);
>         }
> +       fwts_infoonly(fw);
> +
>         return FWTS_OK;
>  }
>
> @@ -58,14 +63,17 @@ static int version_test3(fwts_framework *fw)
>
>          if (((str = fwts_get("/sys/module/acpi/parameters/acpica_version")) == NULL) &&
>             ((str = fwts_get("/proc/acpi/info")) == NULL))
> -               fwts_failed(fw, LOG_LEVEL_LOW,
> -                       "KernelACPIVersion",
> -                       "Cannot get ACPI version info from /sys/module/acpi/parameters/acpica_version or /proc/acpi/info");
> +               fwts_log_info(fw,
> +                       "Cannot get ACPI version info from "
> +                       "/sys/module/acpi/parameters/acpica_version "
> +                       "or /proc/acpi/info, system does not have ACPI.");
>         else {
>                 fwts_chop_newline(str);
> -               fwts_passed(fw, "ACPI Version: %s", str);
> +               fwts_log_info(fw, "ACPI Version: %s", str);
>                 free(str);
>         }
> +       fwts_infoonly(fw);
> +
>         return FWTS_OK;
>  }
>
> --
> 1.8.0
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Chris Van Hoof - Dec. 12, 2012, 5:21 a.m.
On 12/07/2012 01:33 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Make these infoonly tests rather than pass or fail.  This is more
> friendly for non-x86 or non-ACPI systems or non-Ubuntu kernel systems.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/kernel/version/version.c | 30 +++++++++++++++++++-----------
>  1 file changed, 19 insertions(+), 11 deletions(-)
> 
> diff --git a/src/kernel/version/version.c b/src/kernel/version/version.c
> index 14f24a2..087937e 100644
> --- a/src/kernel/version/version.c
> +++ b/src/kernel/version/version.c
> @@ -25,13 +25,18 @@ static int version_test1(fwts_framework *fw)
>  
>  	/* Following is Ubuntu specific, so don't fail */
>  	if ((str = fwts_get("/proc/version_signature")) == NULL)
> -		fwts_warning(fw,
> -			"Cannot get version signature info from /proc/version_signature (This is Ubuntu specific, and not necessarily a failure).");
> +		fwts_log_info(fw,
> +			"Cannot get version signature info from "
> +			"/proc/version_signature (This is Ubuntu "
> +			"specific, and is not necessarily a failure).");
>  	else {
>  		fwts_chop_newline(str);
> -		fwts_passed(fw, "Signature: %s", str);
> +		fwts_log_info(fw, "Signature: %s", str);
>  		free(str);
>  	}
> +
> +	fwts_infoonly(fw);
> +
>  	return FWTS_OK;
>  }
>  
> @@ -41,14 +46,14 @@ static int version_test2(fwts_framework *fw)
>  
>  
>  	if ((str = fwts_get("/proc/version")) == NULL)
> -		fwts_failed(fw, LOG_LEVEL_LOW,
> -			"KernelProcVersion",
> -			"Cannot get version info from /proc/version");
> +		fwts_log_info(fw, "Cannot get version info from /proc/version");
>  	else {
>  		fwts_chop_newline(str);
> -		fwts_passed(fw, "Kernel Version: %s", str);
> +		fwts_log_info(fw, "Kernel Version: %s", str);
>  		free(str);
>  	}
> +	fwts_infoonly(fw);
> +
>  	return FWTS_OK;
>  }
>  
> @@ -58,14 +63,17 @@ static int version_test3(fwts_framework *fw)
>  
>          if (((str = fwts_get("/sys/module/acpi/parameters/acpica_version")) == NULL) &&
>  	    ((str = fwts_get("/proc/acpi/info")) == NULL))
> -		fwts_failed(fw, LOG_LEVEL_LOW,
> -			"KernelACPIVersion",
> -			"Cannot get ACPI version info from /sys/module/acpi/parameters/acpica_version or /proc/acpi/info");
> +		fwts_log_info(fw,
> +			"Cannot get ACPI version info from "
> +			"/sys/module/acpi/parameters/acpica_version "
> +			"or /proc/acpi/info, system does not have ACPI.");
>  	else {
>  		fwts_chop_newline(str);
> -		fwts_passed(fw, "ACPI Version: %s", str);
> +		fwts_log_info(fw, "ACPI Version: %s", str);
>  		free(str);
>  	}
> +	fwts_infoonly(fw);
> +
>  	return FWTS_OK;
>  }

Acked-by: Chris Van Hoof <vanhoof@canonical.com>

Patch

diff --git a/src/kernel/version/version.c b/src/kernel/version/version.c
index 14f24a2..087937e 100644
--- a/src/kernel/version/version.c
+++ b/src/kernel/version/version.c
@@ -25,13 +25,18 @@  static int version_test1(fwts_framework *fw)
 
 	/* Following is Ubuntu specific, so don't fail */
 	if ((str = fwts_get("/proc/version_signature")) == NULL)
-		fwts_warning(fw,
-			"Cannot get version signature info from /proc/version_signature (This is Ubuntu specific, and not necessarily a failure).");
+		fwts_log_info(fw,
+			"Cannot get version signature info from "
+			"/proc/version_signature (This is Ubuntu "
+			"specific, and is not necessarily a failure).");
 	else {
 		fwts_chop_newline(str);
-		fwts_passed(fw, "Signature: %s", str);
+		fwts_log_info(fw, "Signature: %s", str);
 		free(str);
 	}
+
+	fwts_infoonly(fw);
+
 	return FWTS_OK;
 }
 
@@ -41,14 +46,14 @@  static int version_test2(fwts_framework *fw)
 
 
 	if ((str = fwts_get("/proc/version")) == NULL)
-		fwts_failed(fw, LOG_LEVEL_LOW,
-			"KernelProcVersion",
-			"Cannot get version info from /proc/version");
+		fwts_log_info(fw, "Cannot get version info from /proc/version");
 	else {
 		fwts_chop_newline(str);
-		fwts_passed(fw, "Kernel Version: %s", str);
+		fwts_log_info(fw, "Kernel Version: %s", str);
 		free(str);
 	}
+	fwts_infoonly(fw);
+
 	return FWTS_OK;
 }
 
@@ -58,14 +63,17 @@  static int version_test3(fwts_framework *fw)
 
         if (((str = fwts_get("/sys/module/acpi/parameters/acpica_version")) == NULL) &&
 	    ((str = fwts_get("/proc/acpi/info")) == NULL))
-		fwts_failed(fw, LOG_LEVEL_LOW,
-			"KernelACPIVersion",
-			"Cannot get ACPI version info from /sys/module/acpi/parameters/acpica_version or /proc/acpi/info");
+		fwts_log_info(fw,
+			"Cannot get ACPI version info from "
+			"/sys/module/acpi/parameters/acpica_version "
+			"or /proc/acpi/info, system does not have ACPI.");
 	else {
 		fwts_chop_newline(str);
-		fwts_passed(fw, "ACPI Version: %s", str);
+		fwts_log_info(fw, "ACPI Version: %s", str);
 		free(str);
 	}
+	fwts_infoonly(fw);
+
 	return FWTS_OK;
 }