From: Reinette Chatre <reinette.chatre@intel.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Maciej Wieczor-Retman" <maciej.wieczor-retman@intel.com>
Cc: <fenghua.yu@intel.com>, <shuah@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH v3 2/5] selftests/resctrl: Add helpers for the non-contiguous test
Date: Fri, 26 Jan 2024 10:58:04 -0800 [thread overview]
Message-ID: <611fd2b6-d9ec-42f0-9711-b1398fc02842@intel.com> (raw)
In-Reply-To: <ea9b0e06-c07e-eb4b-9e7d-ed20419b677d@linux.intel.com>
On 1/25/2024 4:14 AM, Ilpo Järvinen wrote:
> On Thu, 25 Jan 2024, Maciej Wieczor-Retman wrote:
>> + fp = fopen(file_path, "r");
>> + if (!fp) {
>> + snprintf(reason, sizeof(reason), "Error in opening %s file\n", filename);
>> + ksft_perror(reason);
>
> Was this the conclusion of the kstf_perror() discussion with Reinette? I
> expected a bit different outcome when I stopped following it...
>
> In any case, it would be nice though if ksft_perror() (or some kselftest.h
> function yet to be added with a different name) would accept full printf
> interface and just add the errno string into the end of the string so one
> would not need to build constructs like this at all.
>
> It will require a bit of macro trickery into kselftest.h. I don't know how
> it should handle the case where somebody just passes a char pointer to it,
> not a string literal, but I guess it would just throw an error while
> compiling if somebody tries to do that as the macro string literal
> concatenation could not build useful/compilable token.
>
> It would make these prints informative enough to become actually useful
> without needed to resort to preparing the string in advance which seems
> to be required almost every single case with the current interface.
I think this can be accomplished with a new:
void ksft_vprint_msg(const char *msg, va_list args)
... but ksft_perror() does conform to perror() and I expect that having one
support variable number of arguments while the other does to cause confusion.
To support variable number of arguments with errno I'd propose just to use
ksft_print_msg() with strerror(errno), errno as the arguments (or even %m
that that errno handling within ksft_print_msg() aims to support). This does
indeed seem to be the custom in other tests.
Reinette
next prev parent reply other threads:[~2024-01-26 18:58 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 11:09 [PATCH v3 0/5] selftests/resctrl: Add non-contiguous CBMs in Intel CAT selftest Maciej Wieczor-Retman
2024-01-25 11:10 ` [PATCH v3 1/5] selftests/resctrl: Add test groups and name L3 CAT test L3_CAT Maciej Wieczor-Retman
2024-01-25 11:10 ` [PATCH v3 2/5] selftests/resctrl: Add helpers for the non-contiguous test Maciej Wieczor-Retman
2024-01-25 12:14 ` Ilpo Järvinen
2024-01-26 18:58 ` Reinette Chatre [this message]
2024-01-31 11:57 ` Maciej Wieczor-Retman
2024-01-31 12:04 ` Ilpo Järvinen
2024-01-26 21:08 ` Reinette Chatre
2024-01-31 11:48 ` Maciej Wieczor-Retman
2024-01-25 11:12 ` [PATCH v3 3/5] selftests/resctrl: Split validate_resctrl_feature_request() Maciej Wieczor-Retman
2024-01-25 11:46 ` Ilpo Järvinen
2024-01-31 10:05 ` Maciej Wieczor-Retman
2024-01-25 11:12 ` [PATCH v3 4/5] selftests/resctrl: Add resource_info_file_exists() Maciej Wieczor-Retman
2024-01-25 12:16 ` Ilpo Järvinen
2024-01-26 21:08 ` Reinette Chatre
2024-01-31 12:07 ` Maciej Wieczor-Retman
2024-01-25 11:13 ` [PATCH v3 5/5] selftests/resctrl: Add non-contiguous CBMs CAT test Maciej Wieczor-Retman
2024-01-26 21:10 ` Reinette Chatre
2024-01-31 12:55 ` Maciej Wieczor-Retman
2024-02-01 19:47 ` Reinette Chatre
2024-02-02 10:17 ` Maciej Wieczor-Retman
2024-02-02 17:10 ` Reinette Chatre
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=611fd2b6-d9ec-42f0-9711-b1398fc02842@intel.com \
--to=reinette.chatre@intel.com \
--cc=fenghua.yu@intel.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=maciej.wieczor-retman@intel.com \
--cc=shuah@kernel.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
all inboxes | Powered by JetHome®