diff mbox

uefirtvariable: setvariable without deleting the original variable (LP: #1354301)

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

Commit Message

Ivan Hu Aug. 8, 2014, 9:59 a.m. UTC
The setvariable_test2 tests the UEFI setvariable runtime service with the
same and different variable data. When doing the test, it should exist the
original variable on the system, the original variable should not be deleted.

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

Comments

Alex Hung Aug. 11, 2014, 2:26 a.m. UTC | #1
On 08/08/2014 05:59 PM, Ivan Hu wrote:
> The setvariable_test2 tests the UEFI setvariable runtime service with the
> same and different variable data. When doing the test, it should exist the
> original variable on the system, the original variable should not be deleted.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/uefi/uefirtvariable/uefirtvariable.c |   14 ++------------
>  1 file changed, 2 insertions(+), 12 deletions(-)
> 
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index 21a8cbc..6a22c80 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -1012,35 +1012,25 @@ static int setvariable_test2(fwts_framework *fw, uint16_t *varname)
>  	if (ret != FWTS_OK)
>  		goto err_restore_env1;
>  
> -	ret = setvariable_insertvariable(fw, attributes, 0,
> -		varname, &gtestguid1, datadiff1);
> -	if (ret != FWTS_OK)
> -		return ret;
> -
>  	/* insert different data */
>  	datasize = 20;
>  
>  	ret = setvariable_insertvariable(fw, attributes, datasize,
>  		varname, &gtestguid1, datadiff2);
>  	if (ret != FWTS_OK)
> -		return ret;
> +		goto err_restore_env1;
>  
>  	ret = setvariable_checkvariable(fw, datasize, varname,
>  		&gtestguid1, datadiff2);
>  	if (ret != FWTS_OK)
>  		goto err_restore_env2;
>  
> -	ret = setvariable_insertvariable(fw, attributes, 0,
> -		varname, &gtestguid1, datadiff2);
> -	if (ret != FWTS_OK)
> -		return ret;
> -
>  	datasize = 5;
>  
>  	ret = setvariable_insertvariable(fw, attributes, datasize,
>  		varname, &gtestguid1, datadiff3);
>  	if (ret != FWTS_OK)
> -		return ret;
> +		goto err_restore_env2;
>  
>  	ret = setvariable_checkvariable(fw, datasize, varname,
>  		&gtestguid1, datadiff3);
> 


Acked-by: Alex Hung <alex.hung@canonical.com>
Keng-Yu Lin Aug. 13, 2014, 6:46 a.m. UTC | #2
On Mon, Aug 11, 2014 at 10:26 AM, Alex Hung <alex.hung@canonical.com> wrote:
> On 08/08/2014 05:59 PM, Ivan Hu wrote:
>> The setvariable_test2 tests the UEFI setvariable runtime service with the
>> same and different variable data. When doing the test, it should exist the
>> original variable on the system, the original variable should not be deleted.
>>
>> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
>> ---
>>  src/uefi/uefirtvariable/uefirtvariable.c |   14 ++------------
>>  1 file changed, 2 insertions(+), 12 deletions(-)
>>
>> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
>> index 21a8cbc..6a22c80 100644
>> --- a/src/uefi/uefirtvariable/uefirtvariable.c
>> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
>> @@ -1012,35 +1012,25 @@ static int setvariable_test2(fwts_framework *fw, uint16_t *varname)
>>       if (ret != FWTS_OK)
>>               goto err_restore_env1;
>>
>> -     ret = setvariable_insertvariable(fw, attributes, 0,
>> -             varname, &gtestguid1, datadiff1);
>> -     if (ret != FWTS_OK)
>> -             return ret;
>> -
>>       /* insert different data */
>>       datasize = 20;
>>
>>       ret = setvariable_insertvariable(fw, attributes, datasize,
>>               varname, &gtestguid1, datadiff2);
>>       if (ret != FWTS_OK)
>> -             return ret;
>> +             goto err_restore_env1;
>>
>>       ret = setvariable_checkvariable(fw, datasize, varname,
>>               &gtestguid1, datadiff2);
>>       if (ret != FWTS_OK)
>>               goto err_restore_env2;
>>
>> -     ret = setvariable_insertvariable(fw, attributes, 0,
>> -             varname, &gtestguid1, datadiff2);
>> -     if (ret != FWTS_OK)
>> -             return ret;
>> -
>>       datasize = 5;
>>
>>       ret = setvariable_insertvariable(fw, attributes, datasize,
>>               varname, &gtestguid1, datadiff3);
>>       if (ret != FWTS_OK)
>> -             return ret;
>> +             goto err_restore_env2;
>>
>>       ret = setvariable_checkvariable(fw, datasize, varname,
>>               &gtestguid1, datadiff3);
>>
>
>
> Acked-by: Alex Hung <alex.hung@canonical.com>
>

Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Kun Yang Aug. 14, 2014, 5:38 a.m. UTC | #3

diff mbox

Patch

diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
index 21a8cbc..6a22c80 100644
--- a/src/uefi/uefirtvariable/uefirtvariable.c
+++ b/src/uefi/uefirtvariable/uefirtvariable.c
@@ -1012,35 +1012,25 @@  static int setvariable_test2(fwts_framework *fw, uint16_t *varname)
 	if (ret != FWTS_OK)
 		goto err_restore_env1;
 
-	ret = setvariable_insertvariable(fw, attributes, 0,
-		varname, &gtestguid1, datadiff1);
-	if (ret != FWTS_OK)
-		return ret;
-
 	/* insert different data */
 	datasize = 20;
 
 	ret = setvariable_insertvariable(fw, attributes, datasize,
 		varname, &gtestguid1, datadiff2);
 	if (ret != FWTS_OK)
-		return ret;
+		goto err_restore_env1;
 
 	ret = setvariable_checkvariable(fw, datasize, varname,
 		&gtestguid1, datadiff2);
 	if (ret != FWTS_OK)
 		goto err_restore_env2;
 
-	ret = setvariable_insertvariable(fw, attributes, 0,
-		varname, &gtestguid1, datadiff2);
-	if (ret != FWTS_OK)
-		return ret;
-
 	datasize = 5;
 
 	ret = setvariable_insertvariable(fw, attributes, datasize,
 		varname, &gtestguid1, datadiff3);
 	if (ret != FWTS_OK)
-		return ret;
+		goto err_restore_env2;
 
 	ret = setvariable_checkvariable(fw, datasize, varname,
 		&gtestguid1, datadiff3);