[PATCH 3/5] uefirtvariable: Add new test for UEFI runtime SetVariable, subtest 3

Keng-Yu Lin kengyu at canonical.com
Mon Dec 10 08:02:17 UTC 2012


On Wed, Dec 5, 2012 at 7:00 PM, Ivan Hu <ivan.hu at canonical.com> wrote:
> This test tests the UEFI runtime service SetVariable interface.
> SetVariable when the similar variable exists, test with the similar
> variable name.
>
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
>  src/uefi/uefirtvariable/uefirtvariable.c |   51 ++++++++++++++++++++++++++++++
>  1 file changed, 51 insertions(+)
>
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index 5f07aa0..b828ccc 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -461,6 +461,52 @@ static int setvariable_test2(fwts_framework *fw, uint32_t attributes, uint16_t *
>         return FWTS_OK;
>  }
>
> +static int setvariable_test3(fwts_framework *fw, uint32_t attributes)
> +{
> +       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'};
> +
> +       if (setvariable_insertvariable(fw, attributes, datasize, variablenametest2,
> +                                               &gtestguid1, datadiff2) == FWTS_ERROR)
> +               return FWTS_ERROR;
> +
> +       if (setvariable_insertvariable(fw, attributes, datasize, variablenametest3,
> +                                               &gtestguid1, datadiff3) == FWTS_ERROR)
> +               return FWTS_ERROR;
> +
> +       if (setvariable_insertvariable(fw, attributes, datasize, variablenametest,
> +                                               &gtestguid1, datadiff1) == FWTS_ERROR)
> +               return FWTS_ERROR;
> +
> +       if (setvariable_checkvariable(fw, attributes, datasize, variablenametest2,
> +                                               &gtestguid1, datadiff2) == FWTS_ERROR)
> +               return FWTS_ERROR;
> +
> +       if (setvariable_checkvariable(fw, attributes, datasize, variablenametest3,
> +                                               &gtestguid1, datadiff3) == FWTS_ERROR)
> +               return FWTS_ERROR;
> +
> +       if (setvariable_checkvariable(fw, attributes, datasize, variablenametest,
> +                                               &gtestguid1, datadiff1) == FWTS_ERROR)
> +               return FWTS_ERROR;
> +
> +       if (setvariable_insertvariable(fw, attributes, 0, variablenametest2,
> +                                               &gtestguid1, datadiff2) == FWTS_ERROR)
> +               return FWTS_ERROR;
> +
> +       if (setvariable_insertvariable(fw, attributes, 0, variablenametest3,
> +                                               &gtestguid1, datadiff3) == FWTS_ERROR)
> +               return FWTS_ERROR;
> +
> +       if (setvariable_insertvariable(fw, attributes, 0, variablenametest,
> +                                               &gtestguid1, datadiff1) == FWTS_ERROR)
> +               return FWTS_ERROR;
> +
> +       return FWTS_OK;
> +}
> +
>  static int uefirtvariable_test1(fwts_framework *fw)
>  {
>         uint64_t index;
> @@ -506,6 +552,11 @@ static int uefirtvariable_test3(fwts_framework *fw)
>                         return FWTS_ERROR;
>         }
>
> +       for (index = 0; index < (sizeof(attributesarray)/(sizeof attributesarray[0])); index++) {
> +               if (setvariable_test3(fw, attributesarray[index]) == FWTS_ERROR)
> +                       return FWTS_ERROR;
> +       }
> +
>         fwts_passed(fw, "UEFI runtime service SetVariable interface test passed.");
>
>         return FWTS_OK;
> --
> 1.7.10.4
>
>
Acked-by: Keng-Yu Lin <kengyu at canonical.com>



More information about the fwts-devel mailing list