From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: KP Singh <kpsingh@kernel.org>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Florent Revest <revest@chromium.org>,
Brendan Jackman <jackmanb@chromium.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: Better error messages for ima_setup.sh failures
Date: Thu, 25 Mar 2021 21:49:55 -0700 [thread overview]
Message-ID: <CAEf4BzbqJkTDhUUb+7roJ8a_Ek-mUagx95dYeu8H6HpC_-siXw@mail.gmail.com> (raw)
In-Reply-To: <20210322170720.2926715-1-kpsingh@kernel.org>
On Mon, Mar 22, 2021 at 10:07 AM KP Singh <kpsingh@kernel.org> wrote:
>
> The current implementation uses the CHECK_FAIL macro which does not
> provide useful error messages when the script fails. Use the CHECK macro
> instead and provide more descriptive messages to aid debugging.
>
> Signed-off-by: KP Singh <kpsingh@kernel.org>
> ---
This was applied to bpf-next, but commit bot doesn't seem very
attentive at the moment :) Thanks for improvements!
> tools/testing/selftests/bpf/prog_tests/test_ima.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/test_ima.c b/tools/testing/selftests/bpf/prog_tests/test_ima.c
> index b54bc0c351b7..0252f61d611a 100644
> --- a/tools/testing/selftests/bpf/prog_tests/test_ima.c
> +++ b/tools/testing/selftests/bpf/prog_tests/test_ima.c
> @@ -68,7 +68,8 @@ void test_test_ima(void)
> goto close_prog;
>
> snprintf(cmd, sizeof(cmd), "./ima_setup.sh setup %s", measured_dir);
> - if (CHECK_FAIL(system(cmd)))
> + err = system(cmd);
> + if (CHECK(err, "failed to run command", "%s, errno = %d\n", cmd, errno))
> goto close_clean;
>
> err = run_measured_process(measured_dir, &skel->bss->monitored_pid);
> @@ -81,7 +82,8 @@ void test_test_ima(void)
>
> close_clean:
> snprintf(cmd, sizeof(cmd), "./ima_setup.sh cleanup %s", measured_dir);
> - CHECK_FAIL(system(cmd));
> + err = system(cmd);
> + CHECK(err, "failed to run command", "%s, errno = %d\n", cmd, errno);
> close_prog:
> ima__destroy(skel);
> }
> --
> 2.31.0.rc2.261.g7f71774620-goog
>
prev parent reply other threads:[~2021-03-26 4:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-22 17:07 [PATCH bpf-next] selftests/bpf: Better error messages for ima_setup.sh failures KP Singh
2021-03-26 4:49 ` Andrii Nakryiko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAEf4BzbqJkTDhUUb+7roJ8a_Ek-mUagx95dYeu8H6HpC_-siXw@mail.gmail.com \
--to=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jackmanb@chromium.org \
--cc=kpsingh@kernel.org \
--cc=revest@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).