ACK: [PATCH 2/2] fwts: uefi: clean up all test variable before doing the uefirtvariable test (LP: #1313554)
Alex Hung
alex.hung at canonical.com
Mon May 5 08:25:41 UTC 2014
On 04/28/2014 04:07 PM, Ivan Hu wrote:
> Try to delete all the test variables that used by the uefirtvariable test,
> before doing the uefirtvariable tests. Make sure there are no preexisting
> test variables that cause the the uefirtvariable test fail, when the
> variable tests accidentally stopped, terminated by the buggy firmware, power
> fail etc.
>
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
> src/uefi/uefirtvariable/uefirtvariable.c | 31 ++++++++++++++++++++++++++++--
> 1 file changed, 29 insertions(+), 2 deletions(-)
>
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index 6e40542..7ddfeb1 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -59,6 +59,33 @@ static uint32_t attributes =
> FWTS_UEFI_VAR_BOOTSERVICE_ACCESS |
> FWTS_UEFI_VAR_RUNTIME_ACCESS;
> static uint16_t variablenametest[] = {'T', 'e', 's', 't', 'v', 'a', 'r', '\0'};
> +static uint16_t variablenametest2[] = {'T', 'e', 's', 't', 'v', 'a', 'r', ' ', '\0'};
> +static uint16_t variablenametest3[] = {'T', 'e', 's', 't', 'v', 'a', '\0'};
> +
> +static void uefirtvariable_env_cleanup(void)
> +{
> + struct efi_setvariable setvariable;
> + uint64_t status;
> + uint8_t data = 0;
> +
> + setvariable.VariableName = variablenametest;
> + setvariable.VendorGuid = >estguid1;
> + setvariable.Attributes = 0;
> + setvariable.DataSize = 0;
> + setvariable.Data = &data;
> + setvariable.status = &status;
> + ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable);
> +
> + setvariable.VariableName = variablenametest2;
> + ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable);
> +
> + setvariable.VariableName = variablenametest3;
> + ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable);
> +
> + setvariable.VariableName = variablenametest;
> + setvariable.VendorGuid = >estguid2;
> + ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable);
> +}
>
> static int uefirtvariable_init(fwts_framework *fw)
> {
> @@ -78,6 +105,8 @@ static int uefirtvariable_init(fwts_framework *fw)
> return FWTS_ABORTED;
> }
>
> + uefirtvariable_env_cleanup();
> +
> return FWTS_OK;
> }
>
> @@ -1044,8 +1073,6 @@ static int setvariable_test3(fwts_framework *fw)
> int ret;
> uint64_t datasize = 10;
> uint8_t datadiff1 = 0, datadiff2 = 1, datadiff3 = 2;
> - uint16_t variablenametest2[] = {'T', 'e', 's', 't', 'v', 'a', 'r', ' ', '\0'};
> - uint16_t variablenametest3[] = {'T', 'e', 's', 't', 'v', 'a', '\0'};
>
> ret = setvariable_insertvariable(fw, attributes, datasize,
> variablenametest2, >estguid1, datadiff2);
>
Acked-by: Alex Hung <alex.hung at canonical.com>
--
Cheers,
Alex Hung
More information about the fwts-devel
mailing list