Re: [PATCHv3 bpf-next 6/9] selftests/bpf: Load bpf_testmod for verifier test

David Vernet
2023-02-07T14:46:14Z

On Fri, Feb 03, 2023 at 05:23:33PM +0100, Jiri Olsa wrote:
> Loading bpf_testmod kernel module for verifier test. We will
> move all the tests kfuncs into bpf_testmod in following change.
>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>

Acked-by: David Vernet <void@manifault.com>

> ---
> tools/testing/selftests/bpf/test_verifier.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
> index 887c49dc5abd..14f11f2dfbce 100644
> --- a/tools/testing/selftests/bpf/test_verifier.c
> +++ b/tools/testing/selftests/bpf/test_verifier.c
> @@ -45,6 +45,7 @@
> #include "bpf_util.h"
> #include "test_btf.h"
> #include "../../../include/linux/filter.h"
> +#include "testing_helpers.h"
>
> #ifndef ENOTSUPP
> #define ENOTSUPP 524
> @@ -1705,6 +1706,12 @@ static int do_test(bool unpriv, unsigned int from, unsigned int to)
> {
> int i, passes = 0, errors = 0;
>
> + /* ensure previous instance of the module is unloaded */
> + unload_bpf_testmod(verbose);
> +
> + if (load_bpf_testmod(verbose))
> + return EXIT_FAILURE;
> +
> for (i = from; i < to; i++) {
> struct bpf_test *test = &tests[i];
>
> @@ -1732,6 +1739,8 @@ static int do_test(bool unpriv, unsigned int from, unsigned int to)
> }
> }
>
> + unload_bpf_testmod(verbose);
> +
> printf("Summary: %d PASSED, %d SKIPPED, %d FAILED\n", passes,
> skips, errors);
> return errors ? EXIT_FAILURE : EXIT_SUCCESS;
> --
> 2.39.1
>