[PATCH 1/4] uefirtvariable: add stress test for UEFI runtime interface SetVariable with the same data

Keng-Yu Lin kengyu at canonical.com
Mon Jan 14 06:29:53 UTC 2013


On Fri, Jan 4, 2013 at 5:05 PM, Ivan Hu <ivan.hu at canonical.com> wrote:
> This stress test tests the UEFI runtime interface SetVariable by
> calling with the same data multiple times.
>
> All bios implementations have a limit of how much flash nvram space
> they have (ie win8 logo requirements is 64k min). When doing repeated
> setnvram and delete nvram variables will eventually hit the end of the
> 64k nvram limit (deletes just mark the variable as deleted in the link
> list but it still writes into new nvram space in flash), bios will do
> the reclaim after reboot.
>
> Since this series setvariable stress tests cannot reboot the system,
> consider the tests multiple times of setvariable on this test, decide
> to use double times from UEFI SCT tests, i.e. 40. To safe some nvram
> space for the coming setvariable stress tests.
>
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
>  src/uefi/uefirtvariable/uefirtvariable.c |   26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
>
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index 73d1049..e88d26e 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -901,12 +901,38 @@ static int uefirtvariable_test5(fwts_framework *fw)
>
>  }
>
> +static int uefirtvariable_test6(fwts_framework *fw)
> +{
> +       uint32_t multitesttime = 40;
> +       uint64_t datasize = 10;
> +       uint8_t datadiff = 0;
> +       uint32_t i;
> +
> +       fwts_log_info(fw, "Testing SetVariable on setting the variable with the same data multiple times.");
> +       for (i = 0; i < multitesttime; i++) {
> +               if (setvariable_insertvariable(fw, attributes, datasize, variablenametest,
> +                                                       &gtestguid1, datadiff) == FWTS_ERROR) {
> +                       if (i > 0)
> +                               setvariable_insertvariable(fw, attributes, 0, variablenametest,
> +                                                                               &gtestguid1, datadiff);
> +                       return FWTS_ERROR;
> +               }
> +       }
> +       if (setvariable_insertvariable(fw, attributes, 0, variablenametest,
> +                                               &gtestguid1, datadiff) == FWTS_ERROR)
> +               return FWTS_ERROR;
> +       fwts_passed(fw, "SetVariable on setting the variable with the same data multiple times passed.");
> +
> +       return FWTS_OK;
> +}
> +
>  static fwts_framework_minor_test uefirtvariable_tests[] = {
>         { uefirtvariable_test1, "Test UEFI RT service get variable interface." },
>         { uefirtvariable_test2, "Test UEFI RT service get next variable name interface." },
>         { uefirtvariable_test3, "Test UEFI RT service set variable interface." },
>         { uefirtvariable_test4, "Test UEFI RT service query variable info interface." },
>         { uefirtvariable_test5, "Test UEFI RT service variable interface stress test." },
> +       { uefirtvariable_test6, "Test UEFI RT service set variable interface stress test." },
>         { NULL, NULL }
>  };
>
> --
> 1.7.9.5
>
Acked-by: Keng-Yu Lin <kengyu at canonical.com>



More information about the fwts-devel mailing list