Hi Ilpo,
On 12/14/2023 2:12 AM, Ilpo Järvinen wrote:
On Wed, 13 Dec 2023, Reinette Chatre wrote:
Hi Ilpo,
On 12/11/2023 4:17 AM, Ilpo Järvinen wrote:
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
Another great cleanup. Also thanks for fixing some non-sensical messages.
...
@@ -149,7 +149,7 @@ int cat_perf_miss_val(int cpu_no, int n, char *cache_type) param.num_of_runs = 0; if (pipe(pipefd)) {
perror("# Unable to create pipe");
return errno; }ksft_perror("Unable to create pipe");
@@ -185,7 +185,7 @@ int cat_perf_miss_val(int cpu_no, int n, char *cache_type) * Just print the error message. * Let while(1) run and wait for itself to be killed. */
perror("# failed signaling parent process");
ksft_perror("Failed signaling parent process");
Partial writes are not actually errors and it cannot be expected that errno be set in these cases. In these cases I think ksft_print_msg() would be more appropriate.
I can change those to use print instead although I don't think these will fail for other reasons than a real error as the pipe should be empty and only single byte is written to it.
Apologies, I did not pay attention to the actual size of the message. Yes, leaving it as ksft_perror() is reasonable.
Reinette