Patchwork [3/4] uefirtvariable: add stress test for UEFI runtime interface SetVariable with different name

login
register
mail settings
Submitter Ivan Hu
Date Jan. 4, 2013, 9:06 a.m.
Message ID <1357290365-4300-1-git-send-email-ivan.hu@canonical.com>
Download mbox | patch
Permalink /patch/209402/
State Accepted
Headers show

Comments

Ivan Hu - Jan. 4, 2013, 9:06 a.m.
This stress test tests the UEFI runtime interface SetVariable by
calling with different name multiple times.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/uefi/uefirtvariable/uefirtvariable.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
Colin King - Jan. 4, 2013, 11:38 a.m.
On 04/01/13 09:06, Ivan Hu wrote:
> This stress test tests the UEFI runtime interface SetVariable by
> calling with different name multiple times.
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>   src/uefi/uefirtvariable/uefirtvariable.c |   15 +++++++++++++++
>   1 file changed, 15 insertions(+)
>
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index bbe6f3f..d2927d0 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -907,6 +907,8 @@ static int uefirtvariable_test6(fwts_framework *fw)
>   	uint64_t datasize = 10;
>   	uint8_t datadiff = 0;
>   	uint32_t i;
> +	uint8_t variablenamelength = 32;
> +	uint16_t variablenametest4[variablenamelength+1];
>
>   	fwts_log_info(fw, "Testing SetVariable on setting the variable with the same data multiple times.");
>   	for (i = 0; i < multitesttime; i++) {
> @@ -934,6 +936,19 @@ static int uefirtvariable_test6(fwts_framework *fw)
>   	}
>   	fwts_passed(fw, "Testing SetVariable on setting the variable with different data multiple times passed.");
>
> +	fwts_log_info(fw, "Testing SetVariable on setting the variable with different name multiple times.");
> +	for (i = 0; i < variablenamelength; i++) {
> +		variablenametest4[i] = 'a';
> +		variablenametest4[i+1] = '\0';
> +		if (setvariable_insertvariable(fw, attributes, datasize, variablenametest4,
> +							&gtestguid1, datadiff) == FWTS_ERROR)
> +			return FWTS_ERROR;
> +		if (setvariable_insertvariable(fw, attributes, 0, variablenametest4,
> +							&gtestguid1, datadiff) == FWTS_ERROR)
> +			return FWTS_ERROR;
> +	}
> +	fwts_passed(fw, "Testing SetVariable on setting the variable with different name multiple times passed.");
> +
>   	return FWTS_OK;
>   }
>
>
Acked-by: Colin Ian King <colin.king@canonical.com>
Keng-Yu Lin - Jan. 14, 2013, 6:33 a.m.
On Fri, Jan 4, 2013 at 5:06 PM, Ivan Hu <ivan.hu@canonical.com> wrote:
> This stress test tests the UEFI runtime interface SetVariable by
> calling with different name multiple times.
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/uefi/uefirtvariable/uefirtvariable.c |   15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index bbe6f3f..d2927d0 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -907,6 +907,8 @@ static int uefirtvariable_test6(fwts_framework *fw)
>         uint64_t datasize = 10;
>         uint8_t datadiff = 0;
>         uint32_t i;
> +       uint8_t variablenamelength = 32;
> +       uint16_t variablenametest4[variablenamelength+1];
>
>         fwts_log_info(fw, "Testing SetVariable on setting the variable with the same data multiple times.");
>         for (i = 0; i < multitesttime; i++) {
> @@ -934,6 +936,19 @@ static int uefirtvariable_test6(fwts_framework *fw)
>         }
>         fwts_passed(fw, "Testing SetVariable on setting the variable with different data multiple times passed.");
>
> +       fwts_log_info(fw, "Testing SetVariable on setting the variable with different name multiple times.");
> +       for (i = 0; i < variablenamelength; i++) {
> +               variablenametest4[i] = 'a';
> +               variablenametest4[i+1] = '\0';
> +               if (setvariable_insertvariable(fw, attributes, datasize, variablenametest4,
> +                                                       &gtestguid1, datadiff) == FWTS_ERROR)
> +                       return FWTS_ERROR;
> +               if (setvariable_insertvariable(fw, attributes, 0, variablenametest4,
> +                                                       &gtestguid1, datadiff) == FWTS_ERROR)
> +                       return FWTS_ERROR;
> +       }
> +       fwts_passed(fw, "Testing SetVariable on setting the variable with different name multiple times passed.");
> +
>         return FWTS_OK;
>  }
>
> --
> 1.7.9.5
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>

Patch

diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
index bbe6f3f..d2927d0 100644
--- a/src/uefi/uefirtvariable/uefirtvariable.c
+++ b/src/uefi/uefirtvariable/uefirtvariable.c
@@ -907,6 +907,8 @@  static int uefirtvariable_test6(fwts_framework *fw)
 	uint64_t datasize = 10;
 	uint8_t datadiff = 0;
 	uint32_t i;
+	uint8_t variablenamelength = 32;
+	uint16_t variablenametest4[variablenamelength+1];
 
 	fwts_log_info(fw, "Testing SetVariable on setting the variable with the same data multiple times.");
 	for (i = 0; i < multitesttime; i++) {
@@ -934,6 +936,19 @@  static int uefirtvariable_test6(fwts_framework *fw)
 	}
 	fwts_passed(fw, "Testing SetVariable on setting the variable with different data multiple times passed.");
 
+	fwts_log_info(fw, "Testing SetVariable on setting the variable with different name multiple times.");
+	for (i = 0; i < variablenamelength; i++) {
+		variablenametest4[i] = 'a';
+		variablenametest4[i+1] = '\0';
+		if (setvariable_insertvariable(fw, attributes, datasize, variablenametest4,
+							&gtestguid1, datadiff) == FWTS_ERROR)
+			return FWTS_ERROR;
+		if (setvariable_insertvariable(fw, attributes, 0, variablenametest4,
+							&gtestguid1, datadiff) == FWTS_ERROR)
+			return FWTS_ERROR;
+	}
+	fwts_passed(fw, "Testing SetVariable on setting the variable with different name multiple times passed.");
+
 	return FWTS_OK;
 }