summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/resctrl/cache.c
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2023-12-15 18:04:47 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-08-03 09:53:43 +0300
commit384dc568e3b2f835079293dfaa33ef5c539e97ca (patch)
treec7264aafedea7bd487104475c6ff0face0545fe9 /tools/testing/selftests/resctrl/cache.c
parentec204ab6c2a9ead9dedd430cdd02482dd3352abc (diff)
downloadlinux-384dc568e3b2f835079293dfaa33ef5c539e97ca.tar.xz
selftests/resctrl: Convert perror() to ksft_perror() or ksft_print_msg()
[ Upstream commit cc8ff7f5c85c076297b18fb9f6d45ec5569d3d44 ] The resctrl selftest code contains a number of perror() calls. Some of them come with hash character and some don't. The kselftest framework provides ksft_perror() that is compatible with test output formatting so it should be used instead of adding custom hash signs. Some perror() calls are too far away from anything that sets error. For those call sites, ksft_print_msg() must be used instead. Convert perror() to ksft_perror() or ksft_print_msg(). Other related changes: - Remove hash signs - Remove trailing stops & newlines from ksft_perror() - Add terminating newlines for converted ksft_print_msg() - Use consistent capitalization - Small fixes/tweaks to typos & grammar of the messages - Extract error printing out of PARENT_EXIT() to be able to differentiate Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Stable-dep-of: c44000b6535d ("selftests/resctrl: Fix closing IMC fds on error and open-code R+W instead of loops") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/testing/selftests/resctrl/cache.c')
-rw-r--r--tools/testing/selftests/resctrl/cache.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/testing/selftests/resctrl/cache.c b/tools/testing/selftests/resctrl/cache.c
index a0318bd3a63d..601ab78dbf42 100644
--- a/tools/testing/selftests/resctrl/cache.c
+++ b/tools/testing/selftests/resctrl/cache.c
@@ -40,7 +40,7 @@ static int perf_event_open_llc_miss(pid_t pid, int cpu_no)
fd_lm = perf_event_open(&pea_llc_miss, pid, cpu_no, -1,
PERF_FLAG_FD_CLOEXEC);
if (fd_lm == -1) {
- perror("Error opening leader");
+ ksft_perror("Error opening leader");
ctrlc_handler(0, NULL, NULL);
return -1;
}
@@ -95,7 +95,7 @@ static int get_llc_perf(unsigned long *llc_perf_miss)
ret = read(fd_lm, &rf_cqm, sizeof(struct read_format));
if (ret == -1) {
- perror("Could not get llc misses through perf");
+ ksft_perror("Could not get llc misses through perf");
return -1;
}
@@ -124,12 +124,12 @@ static int get_llc_occu_resctrl(unsigned long *llc_occupancy)
fp = fopen(llc_occup_path, "r");
if (!fp) {
- perror("Failed to open results file");
+ ksft_perror("Failed to open results file");
return errno;
}
if (fscanf(fp, "%lu", llc_occupancy) <= 0) {
- perror("Could not get llc occupancy");
+ ksft_perror("Could not get llc occupancy");
fclose(fp);
return -1;
@@ -159,7 +159,7 @@ static int print_results_cache(char *filename, int bm_pid,
} else {
fp = fopen(filename, "a");
if (!fp) {
- perror("Cannot open results file");
+ ksft_perror("Cannot open results file");
return errno;
}