diff mbox

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

Message ID 1357290322-4170-1-git-send-email-ivan.hu@canonical.com
State Accepted
Headers show

Commit Message

Ivan Hu Jan. 4, 2013, 9:05 a.m. UTC
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@canonical.com>
---
 src/uefi/uefirtvariable/uefirtvariable.c |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

Comments

Colin Ian King Jan. 4, 2013, 11:37 a.m. UTC | #1
On 04/01/13 09:05, Ivan Hu 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@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 }
>   };
>
>
Looks fine to me.

Acked-by: Colin Ian King <colin.king@canonical.com>
Keng-Yu Lin Jan. 14, 2013, 6:29 a.m. UTC | #2
On Fri, Jan 4, 2013 at 5:05 PM, Ivan Hu <ivan.hu@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@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@canonical.com>
diff mbox

Patch

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 }
 };