diff options
author | 2021-03-22 17:07:20 +0000 | |
---|---|---|
committer | 2021-03-25 18:39:51 -0700 | |
commit | cff908463d91a6b2fb8c8ab6c41d9c308c29fd42 (patch) | |
tree | 8410dd0da0f87b884a926aaa55b54c4c0ce85181 /tools/testing/selftests/bpf/prog_tests/test_ima.c | |
parent | bpf: Fix NULL pointer dereference in bpf_get_local_storage() helper (diff) | |
download | linux-cff908463d91a6b2fb8c8ab6c41d9c308c29fd42.tar.gz linux-cff908463d91a6b2fb8c8ab6c41d9c308c29fd42.tar.bz2 linux-cff908463d91a6b2fb8c8ab6c41d9c308c29fd42.zip |
selftests/bpf: Better error messages for ima_setup.sh failures
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>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210322170720.2926715-1-kpsingh@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/test_ima.c')
-rw-r--r-- | tools/testing/selftests/bpf/prog_tests/test_ima.c | 6 |
1 files 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); } |