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
This commit is contained in:
committed by
Alexei Starovoitov
parent
b910eaaaa4
commit
cff908463d
@@ -68,7 +68,8 @@ void test_test_ima(void)
|
|||||||
goto close_prog;
|
goto close_prog;
|
||||||
|
|
||||||
snprintf(cmd, sizeof(cmd), "./ima_setup.sh setup %s", measured_dir);
|
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;
|
goto close_clean;
|
||||||
|
|
||||||
err = run_measured_process(measured_dir, &skel->bss->monitored_pid);
|
err = run_measured_process(measured_dir, &skel->bss->monitored_pid);
|
||||||
@@ -81,7 +82,8 @@ void test_test_ima(void)
|
|||||||
|
|
||||||
close_clean:
|
close_clean:
|
||||||
snprintf(cmd, sizeof(cmd), "./ima_setup.sh cleanup %s", measured_dir);
|
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:
|
close_prog:
|
||||||
ima__destroy(skel);
|
ima__destroy(skel);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user