Patchwork hpet: hpet_check: skip test3 if HPET address was not found (LP: #1257825)

login
register
mail settings
Submitter Colin King
Date Dec. 4, 2013, 4:48 p.m.
Message ID <1386175710-24124-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/296583/
State Rejected
Headers show

Comments

Colin King - Dec. 4, 2013, 4:48 p.m.
From: Colin Ian King <colin.king@canonical.com>

It makes no sense to run hpet_check test3 if the hpet base address could
not be found. So skip this and inform the user why.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/hpet/hpet_check/hpet_check.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
Colin King - Dec. 4, 2013, 10:54 p.m.
On 04/12/13 16:48, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> It makes no sense to run hpet_check test3 if the hpet base address could
> not be found. So skip this and inform the user why.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/hpet/hpet_check/hpet_check.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/src/hpet/hpet_check/hpet_check.c b/src/hpet/hpet_check/hpet_check.c
> index 14afbd7..485a400 100644
> --- a/src/hpet/hpet_check/hpet_check.c
> +++ b/src/hpet/hpet_check/hpet_check.c
> @@ -72,6 +72,8 @@ static void hpet_parse_device_hpet(fwts_framework *fw,
>  	for (;item != NULL; item = item->next) {
>  		const char *str = fwts_text_list_text(item);
>  
> +		printf(">>%s\n", str);
> +
>  		if ((strstr(str, "Name") != NULL) &&
>  		    (strstr(str, "ResourceTemplate") != NULL)) {
>  			fwts_list_link *tmp_item = item->next;
> @@ -180,7 +182,7 @@ static int hpet_check_test1(fwts_framework *fw)
>  	}
>  
>  	if (hpet_base_p == 0) {
> -		fwts_log_info(fw, "No base address found for HPET.");
> +		fwts_log_info(fw, "No base address found for HPET in the kernel log.");
>  		return FWTS_ERROR;
>  	}
>  
> @@ -357,11 +359,16 @@ static int hpet_check_test3(fwts_framework *fw)
>  {
>  	int i;
>  
> +	if (hpet_base_p == 0) {
> +		fwts_log_info(fw, "Test skipped because HPET address was not found.");
> +		return FWTS_SKIP;
> +	}
> +
>  	hpet_check_base_acpi_table(fw, "DSDT", 0);
>  
> -	for (i=0;i<11;i++) {
> +	for (i = 0; i< 11; i++)
>  		hpet_check_base_acpi_table(fw, "SSDT", i);
> -	}
> +
>  	return FWTS_OK;
>  }
>  
> @@ -373,7 +380,7 @@ static int hpet_check_test4(fwts_framework *fw)
>  	uint32_t clk_period;
>  
>  	if (hpet_base_p == 0) {
> -		fwts_log_info(fw, "Test skipped because previous test failed.");
> +		fwts_log_info(fw, "Test skipped because HPET address was not found.");
>  		return FWTS_SKIP;
>  	}
>  
> 
Oops, some debug slipped in. Will resend this.
Alex Hung - Dec. 9, 2013, 3:36 a.m.
On 12/05/2013 12:48 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> It makes no sense to run hpet_check test3 if the hpet base address could
> not be found. So skip this and inform the user why.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/hpet/hpet_check/hpet_check.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/src/hpet/hpet_check/hpet_check.c b/src/hpet/hpet_check/hpet_check.c
> index 14afbd7..485a400 100644
> --- a/src/hpet/hpet_check/hpet_check.c
> +++ b/src/hpet/hpet_check/hpet_check.c
> @@ -72,6 +72,8 @@ static void hpet_parse_device_hpet(fwts_framework *fw,
>  	for (;item != NULL; item = item->next) {
>  		const char *str = fwts_text_list_text(item);
>  
> +		printf(">>%s\n", str);
> +
>  		if ((strstr(str, "Name") != NULL) &&
>  		    (strstr(str, "ResourceTemplate") != NULL)) {
>  			fwts_list_link *tmp_item = item->next;
> @@ -180,7 +182,7 @@ static int hpet_check_test1(fwts_framework *fw)
>  	}
>  
>  	if (hpet_base_p == 0) {
> -		fwts_log_info(fw, "No base address found for HPET.");
> +		fwts_log_info(fw, "No base address found for HPET in the kernel log.");
>  		return FWTS_ERROR;
>  	}
>  
> @@ -357,11 +359,16 @@ static int hpet_check_test3(fwts_framework *fw)
>  {
>  	int i;
>  
> +	if (hpet_base_p == 0) {
> +		fwts_log_info(fw, "Test skipped because HPET address was not found.");
> +		return FWTS_SKIP;
> +	}
> +
>  	hpet_check_base_acpi_table(fw, "DSDT", 0);
>  
> -	for (i=0;i<11;i++) {
> +	for (i = 0; i< 11; i++)
>  		hpet_check_base_acpi_table(fw, "SSDT", i);
> -	}
> +
>  	return FWTS_OK;
>  }
>  
> @@ -373,7 +380,7 @@ static int hpet_check_test4(fwts_framework *fw)
>  	uint32_t clk_period;
>  
>  	if (hpet_base_p == 0) {
> -		fwts_log_info(fw, "Test skipped because previous test failed.");
> +		fwts_log_info(fw, "Test skipped because HPET address was not found.");
>  		return FWTS_SKIP;
>  	}
>  
> 

Acked-by: Alex Hung <alex.hung@canonical.com>

Patch

diff --git a/src/hpet/hpet_check/hpet_check.c b/src/hpet/hpet_check/hpet_check.c
index 14afbd7..485a400 100644
--- a/src/hpet/hpet_check/hpet_check.c
+++ b/src/hpet/hpet_check/hpet_check.c
@@ -72,6 +72,8 @@  static void hpet_parse_device_hpet(fwts_framework *fw,
 	for (;item != NULL; item = item->next) {
 		const char *str = fwts_text_list_text(item);
 
+		printf(">>%s\n", str);
+
 		if ((strstr(str, "Name") != NULL) &&
 		    (strstr(str, "ResourceTemplate") != NULL)) {
 			fwts_list_link *tmp_item = item->next;
@@ -180,7 +182,7 @@  static int hpet_check_test1(fwts_framework *fw)
 	}
 
 	if (hpet_base_p == 0) {
-		fwts_log_info(fw, "No base address found for HPET.");
+		fwts_log_info(fw, "No base address found for HPET in the kernel log.");
 		return FWTS_ERROR;
 	}
 
@@ -357,11 +359,16 @@  static int hpet_check_test3(fwts_framework *fw)
 {
 	int i;
 
+	if (hpet_base_p == 0) {
+		fwts_log_info(fw, "Test skipped because HPET address was not found.");
+		return FWTS_SKIP;
+	}
+
 	hpet_check_base_acpi_table(fw, "DSDT", 0);
 
-	for (i=0;i<11;i++) {
+	for (i = 0; i< 11; i++)
 		hpet_check_base_acpi_table(fw, "SSDT", i);
-	}
+
 	return FWTS_OK;
 }
 
@@ -373,7 +380,7 @@  static int hpet_check_test4(fwts_framework *fw)
 	uint32_t clk_period;
 
 	if (hpet_base_p == 0) {
-		fwts_log_info(fw, "Test skipped because previous test failed.");
+		fwts_log_info(fw, "Test skipped because HPET address was not found.");
 		return FWTS_SKIP;
 	}