ACK: [PATCH 2/4] uefirtmisc: check misc runtime services supported before testing (LP: #1913351)

Colin Ian King colin.king at canonical.com
Thu May 13 21:48:17 UTC 2021


On 13/05/2021 11:01, Ivan Hu wrote:
> UEFI runtime tests are being done without checking RTPROT table which
> intruduced after UEFI 2.8a. This might lead to false alarm for those
> unsupported runtime service platforms. Add checking the miscellaneous services
> supported status before runing the related tests.
> 
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
>  src/uefi/uefirtmisc/uefirtmisc.c | 54 +++++++++++++++++++++++++-------
>  1 file changed, 43 insertions(+), 11 deletions(-)
> 
> diff --git a/src/uefi/uefirtmisc/uefirtmisc.c b/src/uefi/uefirtmisc/uefirtmisc.c
> index 580f92ac..bddff487 100644
> --- a/src/uefi/uefirtmisc/uefirtmisc.c
> +++ b/src/uefi/uefirtmisc/uefirtmisc.c
> @@ -72,6 +72,12 @@ static int getnexthighmonotoniccount_test(fwts_framework *fw, uint32_t multitest
>  	uint32_t highcount;
>  	uint32_t i;
>  
> +	if (!(runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT)) {
> +		fwts_skipped(fw, "Skipping test, GetNextHighMonotonicCount "
> +			"runtime service is not supported on this platform.");
> +		return FWTS_SKIP;
> +	}
> +
>  	getnexthighmonotoniccount.HighCount = &highcount;
>  	getnexthighmonotoniccount.status = &status;
>  
> @@ -107,6 +113,12 @@ static int querycapsulecapabilities_test(fwts_framework *fw, uint32_t multitestt
>  	uint64_t maxcapsulesize;
>  	uint64_t capsulecount;
>  
> +	if (!(runtimeservicessupported & EFI_RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES)) {
> +		fwts_skipped(fw, "Skipping test, QueryCapsuleCapabilities "
> +			"runtime service is not supported on this platform.");
> +		return FWTS_SKIP;
> +	}
> +
>  	memset(&capsuleheader, 0, sizeof(capsuleheader));
>  
>  	pcapsuleheaderarray[0] = &capsuleheader;
> @@ -162,10 +174,9 @@ static int uefirtmisc_test1(fwts_framework *fw)
>  
>  	fwts_log_info(fw, "Testing UEFI runtime service GetNextHighMonotonicCount interface.");
>  	ret = getnexthighmonotoniccount_test(fw, multitesttime);
> -	if (ret != FWTS_OK)
> -		return ret;
> -
> -	fwts_passed(fw, "UEFI runtime service GetNextHighMonotonicCount interface test passed.");
> +	if (ret == FWTS_OK)
> +		fwts_passed(fw, "UEFI runtime service GetNextHighMonotonicCount"
> +			" interface test passed.");
>  
>  	fwts_log_info(fw, "Testing UEFI runtime service QueryCapsuleCapabilities interface.");
>  	for (i = 0; i < (sizeof(flag)/(sizeof flag[0])); i++) {
> @@ -175,10 +186,12 @@ static int uefirtmisc_test1(fwts_framework *fw)
>  		if (ret != FWTS_OK)
>  			return ret;
>  
> -		fwts_passed(fw, "UEFI runtime service QueryCapsuleCapabilities interface test with flag value 0x%"PRIx32 " passed.", flag[i]);
> +		fwts_passed(fw, "UEFI runtime service QueryCapsuleCapabilities"
> +			" interface test with flag value 0x%"PRIx32 " passed.",
> +			flag[i]);
>  	}
>  
> -	return FWTS_OK;
> +	return ret;
>  }
>  
>  static int uefirtmisc_test2(fwts_framework *fw)
> @@ -195,12 +208,23 @@ static int uefirtmisc_test2(fwts_framework *fw)
>  		CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE | CAPSULE_FLAGS_INITIATE_RESET
>  	};
>  
> +	if (!(runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT)) {
> +		fwts_skipped(fw, "Skipping test, GetNextHighMonotonicCount "
> +			"runtime service is not supported on this platform.");
> +		return FWTS_SKIP;
> +	}
> +
>  	fwts_log_info(fw, "Stress testing for UEFI runtime service GetNextHighMonotonicCount interface.");
>  	ret = getnexthighmonotoniccount_test(fw, multitesttime);
> -	if (ret != FWTS_OK)
> -		return ret;
> +	if (ret == FWTS_OK)
> +		fwts_passed(fw, "UEFI runtime service GetNextHighMonotonicCount"
> +			" interface test passed.");
>  
> -	fwts_passed(fw, "UEFI runtime service GetNextHighMonotonicCount interface stress test passed.");
> +	if (!(runtimeservicessupported & EFI_RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES)) {
> +		fwts_skipped(fw, "Skipping test, QueryCapsuleCapabilities "
> +			"runtime service is not supported on this platform.");
> +		return FWTS_SKIP;
> +	}
>  
>  	fwts_log_info(fw, "Stress testing UEFI runtime service QueryCapsuleCapabilities interface.");
>  	for (i = 0; i < (sizeof(flag)/(sizeof flag[0])); i++) {
> @@ -209,11 +233,13 @@ static int uefirtmisc_test2(fwts_framework *fw)
>  			continue;
>  		if (ret != FWTS_OK)
>  			return ret;
> -		fwts_passed(fw, "UEFI runtime service QueryCapsuleCapabilities interface stress test with flag value 0x%" PRIx32 " passed.", flag[i]);
>  
> +		fwts_passed(fw, "UEFI runtime service QueryCapsuleCapabilities"
> +			" interface test with flag value 0x%"PRIx32 " passed.",
> +			flag[i]);
>  	}
>  
> -	return FWTS_OK;
> +	return ret;
>  }
>  
>  static int uefirtmisc_test3(fwts_framework *fw)
> @@ -222,6 +248,12 @@ static int uefirtmisc_test3(fwts_framework *fw)
>  	long ioret;
>  	struct efi_getnexthighmonotoniccount getnexthighmonotoniccount;
>  
> +	if (!(runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT)) {
> +		fwts_skipped(fw, "Skipping test, GetNextHighMonotonicCount "
> +			"runtime service is not supported on this platform.");
> +		return FWTS_SKIP;
> +	}
> +
>  	getnexthighmonotoniccount.HighCount = NULL;
>  	getnexthighmonotoniccount.status = &status;
>  
> 

Acked-by: Colin Ian King <colin.king at canonical.com>



More information about the fwts-devel mailing list