[PATCH 2/5] uefirtvariable: Add new test for UEFI runtime SetVariable, subtest 2
Keng-Yu Lin
kengyu at canonical.com
Mon Dec 10 08:02:03 UTC 2012
On Wed, Dec 5, 2012 at 6:59 PM, Ivan Hu <ivan.hu at canonical.com> wrote:
> This test tests the UEFI runtime service SetVariable interface.
> SetVariable when the variable exist, test with the same and different
> variable data.
>
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
> src/uefi/uefirtvariable/uefirtvariable.c | 60 ++++++++++++++++++++++++++++++
> 1 file changed, 60 insertions(+)
>
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index ff81e11..5f07aa0 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -406,6 +406,61 @@ static int setvariable_test1(fwts_framework *fw, uint32_t attributes, uint64_t d
> return FWTS_OK;
> }
>
> +static int setvariable_test2(fwts_framework *fw, uint32_t attributes, uint16_t *varname)
> +{
> + uint64_t datasize = 10;
> + uint8_t datadiff1 = 0, datadiff2 = 2, datadiff3 = 4;
> +
> + if (setvariable_insertvariable(fw, attributes, datasize, varname,
> + >estguid1, datadiff1) == FWTS_ERROR)
> + return FWTS_ERROR;
> +
> + /* insert the same data */
> + if (setvariable_insertvariable(fw, attributes, datasize, varname,
> + >estguid1, datadiff1) == FWTS_ERROR)
> + return FWTS_ERROR;
> +
> + if (setvariable_checkvariable(fw, attributes, datasize, varname,
> + >estguid1, datadiff1) == FWTS_ERROR)
> + return FWTS_ERROR;
> +
> + if (setvariable_insertvariable(fw, attributes, 0, varname,
> + >estguid1, datadiff1) == FWTS_ERROR)
> + return FWTS_ERROR;
> +
> +
> + /* insert different data */
> + datasize = 20;
> +
> + if (setvariable_insertvariable(fw, attributes, datasize, varname,
> + >estguid1, datadiff2) == FWTS_ERROR)
> + return FWTS_ERROR;
> +
> + if (setvariable_checkvariable(fw, attributes, datasize, varname,
> + >estguid1, datadiff2) == FWTS_ERROR)
> + return FWTS_ERROR;
> +
> + if (setvariable_insertvariable(fw, attributes, 0, varname,
> + >estguid1, datadiff2) == FWTS_ERROR)
> + return FWTS_ERROR;
> +
> + datasize = 5;
> +
> + if (setvariable_insertvariable(fw, attributes, datasize, varname,
> + >estguid1, datadiff3) == FWTS_ERROR)
> + return FWTS_ERROR;
> +
> + if (setvariable_checkvariable(fw, attributes, datasize, varname,
> + >estguid1, datadiff3) == FWTS_ERROR)
> + return FWTS_ERROR;
> +
> + if (setvariable_insertvariable(fw, attributes, 0, varname,
> + >estguid1, datadiff3) == FWTS_ERROR)
> + return FWTS_ERROR;
> +
> + return FWTS_OK;
> +}
> +
> static int uefirtvariable_test1(fwts_framework *fw)
> {
> uint64_t index;
> @@ -446,6 +501,11 @@ static int uefirtvariable_test3(fwts_framework *fw)
> return FWTS_ERROR;
> }
>
> + for (index = 0; index < (sizeof(attributesarray)/(sizeof attributesarray[0])); index++) {
> + if (setvariable_test2(fw, attributesarray[index], variablenametest) == 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 at canonical.com>
More information about the fwts-devel
mailing list