diff mbox

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

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

Commit Message

Ivan Hu Dec. 5, 2012, 11 a.m. UTC
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@canonical.com>
---
 src/uefi/uefirtvariable/uefirtvariable.c |   51 ++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

Comments

Colin Ian King Dec. 5, 2012, 11:34 a.m. UTC | #1
On 05/12/12 11:00, Ivan Hu 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@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;
>
Acked-by: Colin King <colin.king@canonical.com>
Keng-Yu Lin Dec. 10, 2012, 8:02 a.m. UTC | #2
On Wed, Dec 5, 2012 at 7:00 PM, Ivan Hu <ivan.hu@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@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@canonical.com>
diff mbox

Patch

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;