ACK: [PATCH 2/3] uefirtauthvar: dependency checking for existence of test data (LP: #1434408)
Colin Ian King
colin.king at canonical.com
Fri Mar 20 10:24:19 UTC 2015
On 20/03/15 07:08, Ivan Hu wrote:
> Some subtests need the test data exist. Checking existence of the test data
> and skip the subtest if not exist.
>
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
> src/uefi/uefirtauthvar/uefirtauthvar.c | 42 ++++++++++++++++++++++++++++++++++
> 1 file changed, 42 insertions(+)
>
> diff --git a/src/uefi/uefirtauthvar/uefirtauthvar.c b/src/uefi/uefirtauthvar/uefirtauthvar.c
> index d5dc53b..7c5dbf1 100644
> --- a/src/uefi/uefirtauthvar/uefirtauthvar.c
> +++ b/src/uefi/uefirtauthvar/uefirtauthvar.c
> @@ -36,6 +36,12 @@ static int fd;
>
> #define getvar_buf_size 100
>
> +#define E_AUTHVARCREATE 1
> +#define E_AUTHVARAPPEND (1 << 1)
> +#define E_AUTHVARUPDATE (1 << 2)
> +
> +static uint8_t data_exist = 0;
> +
> static EFI_GUID gtestguid = TEST_GUID;
>
> static const uint32_t attributes =
> @@ -223,6 +229,8 @@ static int uefirtauthvar_test1(fwts_framework *fw)
> }
> }
>
> + data_exist |= E_AUTHVARCREATE;
> +
> fwts_passed(fw, "Create authenticated variable test passed.");
>
> return FWTS_OK;
> @@ -237,6 +245,11 @@ static int uefirtauthvar_test2(fwts_framework *fw)
> long ioret;
> uint64_t status;
>
> + if (!(data_exist & E_AUTHVARCREATE)) {
> + fwts_skipped(fw,"The test variable, AuthVarCreate, doesn't exist, skip the test.");
> + return FWTS_SKIP;
> + }
> +
> ioret = setvar(>estguid, attributes, sizeof(AuthVarCreate), AuthVarCreate, &status);
>
> if (ioret == -1) {
> @@ -272,6 +285,11 @@ static int uefirtauthvar_test3(fwts_framework *fw)
> long ioret;
> uint64_t status;
>
> + if (!(data_exist & E_AUTHVARCREATE)) {
> + fwts_skipped(fw,"The test variable, AuthVarCreate, doesn't exist, skip the test.");
> + return FWTS_SKIP;
> + }
> +
> ioret = setvar(>estguid, attributes, sizeof(AuthVarCreateDiff), AuthVarCreateDiff, &status);
>
> if (ioret == -1) {
> @@ -312,6 +330,11 @@ static int uefirtauthvar_test4(fwts_framework *fw)
> size_t i;
> uint32_t attribappend = attributes | FWTS_UEFI_VARIABLE_APPEND_WRITE;
>
> + if (!(data_exist & E_AUTHVARCREATE)) {
> + fwts_skipped(fw,"The test variable, AuthVarCreate, doesn't exist, skip the test.");
> + return FWTS_SKIP;
> + }
> +
> ioret = setvar(>estguid, attribappend, sizeof(AuthVarAppend), AuthVarAppend, &status);
>
> if (ioret == -1) {
> @@ -367,6 +390,8 @@ static int uefirtauthvar_test4(fwts_framework *fw)
> }
> }
>
> + data_exist |= E_AUTHVARAPPEND;
> +
> fwts_passed(fw, "Append authenticated variable tests passed.");
>
> return FWTS_OK;
> @@ -386,6 +411,11 @@ static int uefirtauthvar_test5(fwts_framework *fw)
> uint32_t attributestest;
> size_t i;
>
> + if (!(data_exist & E_AUTHVARAPPEND)) {
> + fwts_skipped(fw,"The test data, AuthVarAppend, doesn't exist, skip the test.");
> + return FWTS_SKIP;
> + }
> +
> ioret = setvar(>estguid, attributes, sizeof(AuthVarUpdate), AuthVarUpdate, &status);
>
> if (ioret == -1) {
> @@ -431,6 +461,8 @@ static int uefirtauthvar_test5(fwts_framework *fw)
> }
> }
>
> + data_exist |= E_AUTHVARUPDATE;
> +
> fwts_passed(fw, "Update authenticated variable tests passed.");
>
> return FWTS_OK;
> @@ -445,6 +477,11 @@ static int uefirtauthvar_test6(fwts_framework *fw)
> long ioret;
> uint64_t status;
>
> + if (!(data_exist & E_AUTHVARUPDATE)) {
> + fwts_skipped(fw,"The test variable, AuthVarUpdate, doesn't exist, skip the test.");
> + return FWTS_SKIP;
> + }
> +
> ioret = setvar(>estguid, attributes, sizeof(AuthVarCreate), AuthVarCreate, &status);
>
> if (ioret == -1) {
> @@ -483,6 +520,11 @@ static int uefirtauthvar_test7(fwts_framework *fw)
> uint64_t status;
> uint32_t attributestest;
>
> + if (!(data_exist & E_AUTHVARCREATE)) {
> + fwts_skipped(fw,"The test data, AuthVarCreate, doesn't exist, skip the test.");
> + return FWTS_SKIP;
> + }
> +
> ioret = setvar(>estguid, attributes, sizeof(AuthVarDel), AuthVarDel, &status);
>
> if (ioret == -1) {
>
Acked-by: Colin Ian King <colin.king at canonical.com>
More information about the fwts-devel
mailing list