Re: [RFC PATCH v2 2/2] kselftest: devices: Add sample board file for google,spherion

From: Nícolas F. R. A. Prado
Date: Tue Nov 28 2023 - 16:05:54 EST


On Tue, Nov 28, 2023 at 06:33:52PM +0000, Bird, Tim wrote:
>
>
> > -----Original Message-----
> > From: Christopher Obbard <chris.obbard@xxxxxxxxxxxxx>
> > Hi Nícolas,
> >
> > On Mon, 2023-11-27 at 18:34 -0500, Nícolas F. R. A. Prado wrote:
> > > Add a sample board file describing the file's format and with the list
> > > of devices expected to be probed on the google,spherion machine as an
> > > example.
> >
> > Did you consider using some machine-readable & extensible format like yaml?
> > Surely we don't need to invent yet-another file-format? :-)

For this RFC my focus was to gather feedback on even more basic aspects of the
test, mainly:
- Is using a device's match properties (the ones that constitute modalias) a
good way to encode a device in a stable way or can we do better? (See cover
letter for comparison to HW topology approach)

So I just went for the simplest format I could think of. Moving forward, I agree
YAML might be a better fit and I can try it out for the next version.

>
> I went back to examine the test more closely. These board files are loaded via
> the shell's 'source' command.
>
> If I'm reading the test correctly, the format is machine-readable and extensible, since
> it's a fragment of a shell script. The 'usb' and 'pci' first entries on the lines are
> actually function calls, and the other items in a test line are arguments.
>
> So, as an RFC - how about calling the board files: "<compatible-string>.sh" to make this
> clear, and maybe adding a comment at the top about the nature of the file?
>
> There's probably a use case for reading this file not in this original shell script context,
> so I think Christopher's point about a machine-readable AND easily human-readable
> format is valid. Personally, I find this format not too bad to read (but then I'm a
> shell junky.)

That's right, the board files are shell scripts that are sourced. I went this
route for simplicity rather than necessity. In fact, I'd prefer to have the
board files be dumb files with just the data necessary to describe the devices
on the platform moving forward. For this purpose I'll try using YAML for the
next version and seeing how it goes.

>
> I believe, Nicolas, that you were already planning on putting some comments in the
> file to describe the line format (function arguments?), based on feedback from Greg KH.
> IMHO, knowing that the format allows comments is useful, so adding a sample
> comment would be welcome.

Well, the text added at the top of this file describing the format of each line
was already done in response to Greg's comment. Although I didn't mention
anything about comments indeed, I'll make sure to document that for next
version (even if it is in YAML it doesn't hurt to have comments as part of the
example).

Also, I've noticed that my patches show "(no changes since v1)". Please
disregard these. There have clearly been changes since v1 (the whole approach is
different), which I've documented on the cover letter, but those trailers were
added by mistake when generating the patches.

Thanks,
Nícolas