ACK: [PATCH 1/3] uefitime: add checking the EFI_UNSUPPORTED return code

Alex Hung alex.hung at canonical.com
Tue Jun 11 16:41:36 UTC 2019


On 2019-06-11 3:18 a.m., Ivan Hu wrote:
> The UEFI spec 2.8(Matis 1961) adds EFI_UNSUPPORTED as a return code to most
> UEFI runtime services for those embeded devices such as specified by the
> ARM EBBR specification which are impractical or impossible to implement
> in such a way that they can be used at runtime.
> 
> Add checking the EFI_UNSUPPORTED return code and skip the test for those
> unsupported runtime services.
> 
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
>  src/uefi/uefirttime/uefirttime.c | 90 +++++++++++++++++++++++++++++++++-------
>  1 file changed, 76 insertions(+), 14 deletions(-)
> 
> diff --git a/src/uefi/uefirttime/uefirttime.c b/src/uefi/uefirttime/uefirttime.c
> index 7626f06..c0ff61d 100644
> --- a/src/uefi/uefirttime/uefirttime.c
> +++ b/src/uefi/uefirttime/uefirttime.c
> @@ -215,6 +215,11 @@ static int uefirttime_test1(fwts_framework *fw)
>  	ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime);
>  
>  	if (ioret == -1) {
> +		if (status == EFI_UNSUPPORTED) {
> +			fwts_skipped(fw, "Skipping test, GetTime runtime "
> +				"service is not supported on this platform.");
> +			return FWTS_SKIP;
> +		}
>  		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetTime",
>  			"Failed to get time with UEFI runtime service.");
>  		fwts_uefi_print_status_info(fw, status);
> @@ -244,6 +249,11 @@ static int uefirttime_test_gettime_invalid(
>  
>  	ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime);
>  	if (ioret == -1) {
> +		if (status == EFI_UNSUPPORTED) {
> +			fwts_skipped(fw, "Skipping test, GetTime runtime "
> +				"service is not supported on this platform.");
> +			return FWTS_SKIP;
> +		}
>  		if (status == EFI_INVALID_PARAMETER) {
>  			fwts_passed(fw, "UEFI runtime service GetTime interface test "
>  				"passed, returned EFI_INVALID_PARAMETER as expected.");
> @@ -291,6 +301,11 @@ static int uefirttime_test4(fwts_framework *fw)
>  	ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime);
>  
>  	if (ioret == -1) {
> +		if (status == EFI_UNSUPPORTED) {
> +			fwts_skipped(fw, "Skipping test, GetTime runtime "
> +				"service is not supported on this platform.");
> +			return FWTS_SKIP;
> +		}
>  		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetTime",
>  			"Failed to get time with UEFI runtime service.");
>  		fwts_uefi_print_status_info(fw, status);
> @@ -330,6 +345,11 @@ static int uefirttime_test4(fwts_framework *fw)
>  
>  	ioret = ioctl(fd, EFI_RUNTIME_SET_TIME, &settime);
>  	if (ioret == -1) {
> +		if (status == EFI_UNSUPPORTED) {
> +			fwts_skipped(fw, "Skipping test, SetTime runtime "
> +				"service is not supported on this platform.");
> +			return FWTS_SKIP;
> +		}
>  		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetTime",
>  			"Failed to set time with UEFI runtime service.");
>  		fwts_uefi_print_status_info(fw, status);
> @@ -344,6 +364,11 @@ static int uefirttime_test4(fwts_framework *fw)
>  	ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime);
>  
>  	if (ioret == -1) {
> +		if (status == EFI_UNSUPPORTED) {
> +			fwts_skipped(fw, "Skipping test, GetTime runtime "
> +				"service is not supported on this platform.");
> +			return FWTS_SKIP;
> +		}
>  		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetTime",
>  			"Failed to get time with UEFI runtime service.");
>  		fwts_uefi_print_status_info(fw, status);
> @@ -385,6 +410,11 @@ static int uefirttime_test4(fwts_framework *fw)
>  	status = ~0ULL;
>  	ioret = ioctl(fd, EFI_RUNTIME_SET_TIME, &settime);
>  	if (ioret == -1) {
> +		if (status == EFI_UNSUPPORTED) {
> +			fwts_skipped(fw, "Skipping test, SetTime runtime "
> +				"service is not supported on this platform.");
> +			return FWTS_SKIP;
> +		}
>  		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetTime",
>  			"Failed to set time with UEFI runtime service.");
>  		fwts_uefi_print_status_info(fw, status);
> @@ -407,6 +437,11 @@ static int uefirttime_test_settime_invalid(
>  
>  	ioret = ioctl(fd, EFI_RUNTIME_SET_TIME, settime);
>  	if (ioret == -1) {
> +		if (status == EFI_UNSUPPORTED) {
> +			fwts_skipped(fw, "Skipping test, SetTime runtime "
> +				"service is not supported on this platform.");
> +			return FWTS_SKIP;
> +		}
>  		if (status == EFI_INVALID_PARAMETER) {
>  			fwts_passed(fw, "UEFI runtime service SetTime interface test "
>  				"passed, returned EFI_INVALID_PARAMETER as expected.");
> @@ -439,6 +474,11 @@ static int uefirttime_test_settime_invalid_time(
>  
>  	ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime);
>  	if (ioret == -1) {
> +		if (status == EFI_UNSUPPORTED) {
> +			fwts_skipped(fw, "Skipping test, GetTime runtime "
> +				"service is not supported on this platform.");
> +			return FWTS_SKIP;
> +		}
>  		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetTime",
>  			"Failed to get wakeup time with UEFI runtime service.");
>  		fwts_uefi_print_status_info(fw, status);
> @@ -474,6 +514,11 @@ static int uefirttime_test_settime_invalid_time(
>  	settime.status = &status;
>  	ioret = ioctl(fd, EFI_RUNTIME_SET_TIME, &settime);
>  	if (ioret == -1) {
> +		if (status == EFI_UNSUPPORTED) {
> +			fwts_skipped(fw, "Skipping test, SetTime runtime "
> +				"service is not supported on this platform.");
> +			return FWTS_SKIP;
> +		}
>  		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetTime",
>  			"Failed to set wakeup time with UEFI runtime service.");
>  		fwts_uefi_print_status_info(fw, status);
> @@ -627,7 +672,7 @@ static int uefirttime_test18(fwts_framework *fw)
>  		if (status == EFI_UNSUPPORTED) {
>  			fwts_skipped(fw, "Skipping test, GetWakeupTime runtime "
>  				"service is not supported on this platform.");
> -			return FWTS_OK;
> +			return FWTS_SKIP;
>  		}
>  		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime",
>  			"Failed to get wakeup time with UEFI runtime service.");
> @@ -653,17 +698,19 @@ static int uefirttime_test_getwaketime_invalid(
>  
>  	ioret = ioctl(fd, EFI_RUNTIME_GET_WAKETIME, getwakeuptime);
>  	if (ioret == -1) {
> -		if (status == EFI_INVALID_PARAMETER ||
> -		    status == EFI_UNSUPPORTED) {
> +		if (status == EFI_UNSUPPORTED) {
> +			fwts_skipped(fw, "Skipping test, GetTimeWakeupTime runtime "
> +				"service is not supported on this platform.");
> +			return FWTS_SKIP;
> +		}
> +		if (status == EFI_INVALID_PARAMETER) {
>  			fwts_passed(fw, "UEFI runtime service GetTimeWakeupTime interface test "
> -				"passed, returned EFI_INVALID_PARAMETER or "
> -				"EFI_UNSUPPORTED as expected.");
> +				"passed, returned EFI_INVALID_PARAMETER as expected.");
>  			return FWTS_OK;
>  		} else {
>  			fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime",
>  				"Failed to get correct return status from UEFI "
> -				"runtime service, expecting EFI_INVALID_PARAMETER "
> -				"or EFI_UNSUPPORTED.");
> +				"runtime service, expecting EFI_INVALID_PARAMETER.");
>  			fwts_uefi_print_status_info(fw, status);
>  			return FWTS_ERROR;
>  		}
> @@ -743,6 +790,11 @@ static int uefirttime_test23(fwts_framework *fw)
>  	ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime);
>  
>  	if (ioret == -1) {
> +		if (status == EFI_UNSUPPORTED) {
> +			fwts_skipped(fw, "Skipping test, GetTime runtime "
> +				"service is not supported on this platform.");
> +			return FWTS_SKIP;
> +		}
>  		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetTime",
>  			"Failed to get time with UEFI runtime service.");
>  		fwts_uefi_print_status_info(fw, status);
> @@ -760,9 +812,9 @@ static int uefirttime_test23(fwts_framework *fw)
>  	ioret = ioctl(fd, EFI_RUNTIME_SET_WAKETIME, &setwakeuptime);
>  	if (ioret == -1) {
>  		if (status == EFI_UNSUPPORTED) {
> -			fwts_skipped(fw, "Skipping test, GetWakeupTime runtime "
> +			fwts_skipped(fw, "Skipping test, SetWakeupTime runtime "
>  				"service is not supported on this platform.");
> -			return FWTS_OK;
> +			return FWTS_SKIP;
>  		}
>  		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetWakeupTime",
>  			"Failed to set wakeup time with UEFI runtime service.");
> @@ -783,7 +835,7 @@ static int uefirttime_test23(fwts_framework *fw)
>  		if (status == EFI_UNSUPPORTED) {
>  			fwts_skipped(fw, "Skipping test, GetWakeupTime runtime "
>  				"service is not supported on this platform.");
> -			return FWTS_OK;
> +			return FWTS_SKIP;
>  		}
>  		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime",
>  			"Failed to get wakeup time with UEFI runtime service.");
> @@ -815,6 +867,11 @@ static int uefirttime_test23(fwts_framework *fw)
>  
>  	ioret = ioctl(fd, EFI_RUNTIME_SET_WAKETIME, &setwakeuptime);
>  	if (ioret == -1) {
> +		if (status == EFI_UNSUPPORTED) {
> +			fwts_skipped(fw, "Skipping test, SetWakeupTime runtime "
> +				"service is not supported on this platform.");
> +			return FWTS_SKIP;
> +		}
>  		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetWakeupTime",
>  			"Failed to set wakeup time with UEFI runtime service.");
>  		fwts_uefi_print_status_info(fw, status);
> @@ -829,7 +886,7 @@ static int uefirttime_test23(fwts_framework *fw)
>  		if (status == EFI_UNSUPPORTED) {
>  			fwts_skipped(fw, "Skipping test, GetWakeupTime runtime "
>  				"service is not supported on this platform.");
> -			return FWTS_OK;
> +			return FWTS_SKIP;
>  		}
>  		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime",
>  			"Failed to get wakeup time with UEFI runtime service.");
> @@ -861,9 +918,9 @@ static int uefirttime_test_setwakeuptime_invalid(
>  	ioret = ioctl(fd, EFI_RUNTIME_SET_WAKETIME, setwakeuptime);
>  	if (ioret == -1) {
>  		if (status == EFI_UNSUPPORTED) {
> -			fwts_skipped(fw, "Skipping test, GetWakeupTime runtime "
> +			fwts_skipped(fw, "Skipping test, SetWakeupTime runtime "
>  				"service is not supported on this platform.");
> -			return FWTS_OK;
> +			return FWTS_SKIP;
>  		}
>  		if (status == EFI_INVALID_PARAMETER) {
>  			fwts_passed(fw, "UEFI runtime service SetTimeWakeupTime interface test "
> @@ -912,7 +969,7 @@ static int uefirttime_test_setwakeuptime_invalid_time(
>  		if (status == EFI_UNSUPPORTED) {
>  			fwts_skipped(fw, "Skipping test, GetWakeupTime runtime "
>  				"service is not supported on this platform.");
> -			return FWTS_OK;
> +			return FWTS_SKIP;
>  		}
>  		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime",
>  			"Failed to get wakeup time with UEFI runtime service.");
> @@ -951,6 +1008,11 @@ static int uefirttime_test_setwakeuptime_invalid_time(
>  	setwakeuptime.Enabled = true;
>  	ioret = ioctl(fd, EFI_RUNTIME_SET_WAKETIME, &setwakeuptime);
>  	if (ioret == -1) {
> +		if (status == EFI_UNSUPPORTED) {
> +			fwts_skipped(fw, "Skipping test, SetWakeupTime runtime "
> +				"service is not supported on this platform.");
> +			return FWTS_SKIP;
> +		}
>  		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetWakeupTime",
>  			"Failed to set wakeup time with UEFI runtime service.");
>  		fwts_uefi_print_status_info(fw, status);
> 

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



More information about the fwts-devel mailing list