On Tue, Jun 10, 2025 at 09:20:48PM +0530, Sudhakar wrote:
> From: Daniel Axtens <d...@axtens.net>
>
> These tests are run through all_functional_test and test a range
> of commands and behaviours.
>
> Signed-off-by: Daniel Axtens <d...@axtens.net>
> Signed-off-by: Sudhakar Kuppusamy <sudha...@linux.ibm.com>
> Reviewed-by: Stefan Berger <stef...@linux.ibm.com>
> Reviewed-by: Avnish Chouhan <avn...@linux.ibm.com>

Reviewed-by: Daniel Kiper <daniel.ki...@oracle.com>

Though one nit below...

> ---
>  grub-core/Makefile.core.def               |   6 +
>  grub-core/tests/appended_signature_test.c | 250 ++++++
>  grub-core/tests/appended_signatures.h     | 975 ++++++++++++++++++++++
>  grub-core/tests/lib/functional_test.c     |   1 +
>  4 files changed, 1232 insertions(+)
>  create mode 100644 grub-core/tests/appended_signature_test.c
>  create mode 100644 grub-core/tests/appended_signatures.h
>
> diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
> index 232e97a37..ca11b3379 100644
> --- a/grub-core/Makefile.core.def
> +++ b/grub-core/Makefile.core.def
> @@ -2194,6 +2194,12 @@ module = {
>    common = tests/setjmp_test.c;
>  };
>
> +module = {
> +  name = appended_signature_test;
> +  common = tests/appended_signature_test.c;
> +  common = tests/appended_signatures.h;
> +};
> +
>  module = {
>    name = signature_test;
>    common = tests/signature_test.c;
> diff --git a/grub-core/tests/appended_signature_test.c 
> b/grub-core/tests/appended_signature_test.c
> new file mode 100644
> index 000000000..d43751bee
> --- /dev/null
> +++ b/grub-core/tests/appended_signature_test.c
> @@ -0,0 +1,250 @@
> +/*
> + *  GRUB  --  GRand Unified Bootloader
> + *  Copyright (C) 2020, 2022 Free Software Foundation, Inc.
> + *  Copyright (C) 2020, 2022, 2025 IBM Corporation
> + *
> + *  GRUB is free software: you can redistribute it and/or modify
> + *  it under the terms of the GNU General Public License as published by
> + *  the Free Software Foundation, either version 3 of the License, or
> + *  (at your option) any later version.
> + *
> + *  GRUB is distributed in the hope that it will be useful,
> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + *  GNU General Public License for more details.
> + *
> + *  You should have received a copy of the GNU General Public License
> + *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include <grub/time.h>
> +#include <grub/misc.h>
> +#include <grub/dl.h>
> +#include <grub/command.h>
> +#include <grub/env.h>
> +#include <grub/test.h>
> +#include <grub/mm.h>
> +#include <grub/procfs.h>
> +#include <grub/file.h>
> +
> +#include "appended_signatures.h"
> +
> +GRUB_MOD_LICENSE ("GPLv3+");
> +
> +#define PROC_FILE(identifier, file_name)                                    \
> +  static char *get_##identifier (grub_size_t *sz)                           \
> +  {                                                                         \
> +    char *ret;                                                              \
> +                                                                            \
> +    *sz = identifier##_len;                                                 \
> +    ret = grub_malloc (*sz);                                                \
> +    if (ret)                                                                \

if (ret != NULL)

> +      grub_memcpy (ret, identifier, *sz);                                   \
> +    return ret;                                                             \
> +  }                                                                         \
> +                                                                            \
> +  static struct grub_procfs_entry identifier##_entry = { .name = file_name, \
> +                                                         .get_contents = 
> get_##identifier };

Daniel

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to