Discussion:
how to add test sysfs nodes, to sys.tar.xz?
Add Reply
Dan Streetman
2017-01-26 14:21:41 UTC
Reply
Permalink
Raw Message
Hi,

Re: bug 4833 and pull request 4837,
https://github.com/systemd/systemd/issues/4833
https://github.com/systemd/systemd/pull/4837

I was thinking of how to add some test cases for whitespace, and
keszybz just merged these tests:
https://github.com/systemd/systemd/pull/5158

which test for proper whitespace->underscore replacement using $env{}.
However, I'd like to also add tests for whitespace replacement using
actual device $attr{}, which I think means the test/sys.tar.xz file
needs to be updated to add device (maybe a NVMe device) nodes that
include whitespace in its model and/or serial strings - is that how
new test sysfs device nodes are added? Updating the entire binary
seems like a big change just for a few device node files..

Thanks!
Zbigniew Jędrzejewski-Szmek
2017-01-26 14:36:07 UTC
Reply
Permalink
Raw Message
Thanks for working on the tests.
Post by Dan Streetman
However, I'd like to also add tests for whitespace replacement using
actual device $attr{}, which I think means the test/sys.tar.xz file
needs to be updated to add device (maybe a NVMe device) nodes that
include whitespace in its model and/or serial strings - is that how
new test sysfs device nodes are added? Updating the entire binary
seems like a big change just for a few device node files..
It's only 162k. It's not perfect that we have to update it every time
we add tests, but it's not too terrible.

If you're feeling ambitious, you might want to convert that tarball to
a script which generates the nodes. After all, it's just a bunch of
directories, with symlinks and a few simple text files. Then this will
be normal text file and git will be able to track changes to it. This
would a much nicer solution in the long run.

Z.
Dan Streetman
2017-01-30 22:40:40 UTC
Reply
Permalink
Raw Message
On Thu, Jan 26, 2017 at 9:36 AM, Zbigniew Jędrzejewski-Szmek
Post by Zbigniew Jędrzejewski-Szmek
Thanks for working on the tests.
Post by Dan Streetman
However, I'd like to also add tests for whitespace replacement using
actual device $attr{}, which I think means the test/sys.tar.xz file
needs to be updated to add device (maybe a NVMe device) nodes that
include whitespace in its model and/or serial strings - is that how
new test sysfs device nodes are added? Updating the entire binary
seems like a big change just for a few device node files..
It's only 162k. It's not perfect that we have to update it every time
we add tests, but it's not too terrible.
If you're feeling ambitious, you might want to convert that tarball to
a script which generates the nodes. After all, it's just a bunch of
directories, with symlinks and a few simple text files. Then this will
be normal text file and git will be able to track changes to it. This
would a much nicer solution in the long run.
I crafted a script that does that, which isn't complex, although it
isn't simple either. However, I'm wondering, why not just store the
files directly in git? It would be simpler than either the tarball or
a script, and git can handle symlinks and binary files, unless there's
some shortcoming that I'm not seeing?
Post by Zbigniew Jędrzejewski-Szmek
Z.
Zbigniew Jędrzejewski-Szmek
2017-02-05 23:26:20 UTC
Reply
Permalink
Raw Message
Post by Dan Streetman
On Thu, Jan 26, 2017 at 9:36 AM, Zbigniew Jędrzejewski-Szmek
Post by Zbigniew Jędrzejewski-Szmek
Thanks for working on the tests.
Post by Dan Streetman
However, I'd like to also add tests for whitespace replacement using
actual device $attr{}, which I think means the test/sys.tar.xz file
needs to be updated to add device (maybe a NVMe device) nodes that
include whitespace in its model and/or serial strings - is that how
new test sysfs device nodes are added? Updating the entire binary
seems like a big change just for a few device node files..
It's only 162k. It's not perfect that we have to update it every time
we add tests, but it's not too terrible.
If you're feeling ambitious, you might want to convert that tarball to
a script which generates the nodes. After all, it's just a bunch of
directories, with symlinks and a few simple text files. Then this will
be normal text file and git will be able to track changes to it. This
would a much nicer solution in the long run.
I crafted a script that does that, which isn't complex, although it
isn't simple either. However, I'm wondering, why not just store the
files directly in git? It would be simpler than either the tarball or
a script, and git can handle symlinks and binary files, unless there's
some shortcoming that I'm not seeing?
In principle, this would work too. But git tools aren't too good when
working with symlinks (e.g. git diff treats them as normal text files,
and displays a stupid warning about a missing newline, etc). When
scaled to the number of files in /sys, I think working with this
approach would be rather unpleasant.

Can you paste the script you have?

Zbyszek
Dan Streetman
2017-02-07 16:17:08 UTC
Reply
Permalink
Raw Message
On Sun, Feb 5, 2017 at 6:26 PM, Zbigniew Jędrzejewski-Szmek
Post by Zbigniew Jędrzejewski-Szmek
Post by Dan Streetman
On Thu, Jan 26, 2017 at 9:36 AM, Zbigniew Jędrzejewski-Szmek
Post by Zbigniew Jędrzejewski-Szmek
Thanks for working on the tests.
Post by Dan Streetman
However, I'd like to also add tests for whitespace replacement using
actual device $attr{}, which I think means the test/sys.tar.xz file
needs to be updated to add device (maybe a NVMe device) nodes that
include whitespace in its model and/or serial strings - is that how
new test sysfs device nodes are added? Updating the entire binary
seems like a big change just for a few device node files..
It's only 162k. It's not perfect that we have to update it every time
we add tests, but it's not too terrible.
If you're feeling ambitious, you might want to convert that tarball to
a script which generates the nodes. After all, it's just a bunch of
directories, with symlinks and a few simple text files. Then this will
be normal text file and git will be able to track changes to it. This
would a much nicer solution in the long run.
I crafted a script that does that, which isn't complex, although it
isn't simple either. However, I'm wondering, why not just store the
files directly in git? It would be simpler than either the tarball or
a script, and git can handle symlinks and binary files, unless there's
some shortcoming that I'm not seeing?
In principle, this would work too. But git tools aren't too good when
working with symlinks (e.g. git diff treats them as normal text files,
and displays a stupid warning about a missing newline, etc). When
scaled to the number of files in /sys, I think working with this
approach would be rather unpleasant.
Can you paste the script you have?
yep, opened pr 5250
https://github.com/systemd/systemd/pull/5250
Post by Zbigniew Jędrzejewski-Szmek
Zbyszek
Loading...