diff mbox

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

Message ID 1354705253-9460-1-git-send-email-ivan.hu@canonical.com
State Rejected
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 Attributes is 0. The expected return status
is EFI_NOT_FOUND.

Signed-off-by: Ivan Hu <tvan.hu@canonical.com>
---
 src/uefi/uefirtvariable/uefirtvariable.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Ivan Hu Dec. 5, 2012, 11:08 a.m. UTC | #1
NACK, wrong mail typo

On 12/05/2012 07:00 PM, Ivan Hu wrote:
> This test tests the UEFI runtime service SetVariable interface.
> SetVariable when the Attributes is 0. The expected return status
> is EFI_NOT_FOUND.
>
> Signed-off-by: Ivan Hu <tvan.hu@canonical.com>
> ---
>   src/uefi/uefirtvariable/uefirtvariable.c |   24 ++++++++++++++++++++++++
>   1 file changed, 24 insertions(+)
>
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index 3c50059..1599c5b 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -556,6 +556,25 @@ static int setvariable_test4(fwts_framework *fw, uint32_t attributes)
>   	return FWTS_OK;
>   }
>
> +static int setvariable_test5(fwts_framework *fw, uint32_t attributes)
> +{
> +	uint64_t datasize = 10;
> +	uint8_t datadiff = 0;
> +
> +	if (setvariable_insertvariable(fw, attributes, datasize, variablenametest,
> +							&gtestguid1, datadiff) == FWTS_ERROR)
> +		return FWTS_ERROR;
> +
> +	if (setvariable_insertvariable(fw, 0, datasize, variablenametest,
> +							&gtestguid1, datadiff) == FWTS_ERROR)
> +		return FWTS_ERROR;
> +
> +	if (setvariable_checkvariable_notfound(fw, variablenametest, &gtestguid1) == FWTS_ERROR)
> +		return FWTS_ERROR;
> +
> +	return FWTS_OK;
> +}
> +
>   static int uefirtvariable_test1(fwts_framework *fw)
>   {
>   	uint64_t index;
> @@ -611,6 +630,11 @@ static int uefirtvariable_test3(fwts_framework *fw)
>   			return FWTS_ERROR;
>   	}
>
> +	for (index = 0; index < (sizeof(attributesarray)/(sizeof attributesarray[0])); index++) {
> +		if (setvariable_test5(fw, attributesarray[index]) == FWTS_ERROR)
> +			return FWTS_ERROR;
> +	}
> +
>   	fwts_passed(fw, "UEFI runtime service SetVariable interface test passed.");
>
>   	return FWTS_OK;
>
diff mbox

Patch

diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
index 3c50059..1599c5b 100644
--- a/src/uefi/uefirtvariable/uefirtvariable.c
+++ b/src/uefi/uefirtvariable/uefirtvariable.c
@@ -556,6 +556,25 @@  static int setvariable_test4(fwts_framework *fw, uint32_t attributes)
 	return FWTS_OK;
 }
 
+static int setvariable_test5(fwts_framework *fw, uint32_t attributes)
+{
+	uint64_t datasize = 10;
+	uint8_t datadiff = 0;
+
+	if (setvariable_insertvariable(fw, attributes, datasize, variablenametest,
+							&gtestguid1, datadiff) == FWTS_ERROR)
+		return FWTS_ERROR;
+
+	if (setvariable_insertvariable(fw, 0, datasize, variablenametest,
+							&gtestguid1, datadiff) == FWTS_ERROR)
+		return FWTS_ERROR;
+
+	if (setvariable_checkvariable_notfound(fw, variablenametest, &gtestguid1) == FWTS_ERROR)
+		return FWTS_ERROR;
+
+	return FWTS_OK;
+}
+
 static int uefirtvariable_test1(fwts_framework *fw)
 {
 	uint64_t index;
@@ -611,6 +630,11 @@  static int uefirtvariable_test3(fwts_framework *fw)
 			return FWTS_ERROR;
 	}
 
+	for (index = 0; index < (sizeof(attributesarray)/(sizeof attributesarray[0])); index++) {
+		if (setvariable_test5(fw, attributesarray[index]) == FWTS_ERROR)
+			return FWTS_ERROR;
+	}
+
 	fwts_passed(fw, "UEFI runtime service SetVariable interface test passed.");
 
 	return FWTS_OK;