Re: [PATCH] Testbeds for libudev/gudev clients

Lucas De Marchi <[email protected]>
Newsgroups gmane.linux.hotplug.devel
Message-ID <CAMOw1v6azAk359kjrJze6dfba9vh7BTcG0010gHyBQk7sT6KbQ@mail.gmail.com>
On Mon, Jul 9, 2012 at 11:22 AM, Martin Pitt <[email protected]> wrote:
> Kay Sievers [2012-07-09 15:50 +0200]:
>> Can't the tests just use a fs namespace and run the test in it with a
>> bind-mount of /sys in it? Maybe check the unshare(1) tool to get the
>> idea, or it might already be able to do that.
>
> Most alternatives would require root privileges, which make tests a
> lot less useful: You cannot run them in environments like jhbuild or
> "make distcheck", and are also both inconvenient and potentially
> ruining your system when you run them during development.
>
> Another alternative I can think of that avoids root privs is a
> fakechroot like LD_PRELOAD wrapper which intercepts all gazillion
> variants of open and stat-like calls and redirects them to the
> testbed. But given how fakechroot breaks with every other new glibc
> release this is not something I'm very keen to do.

You might want to look into kmod's testsuite. We do exactly that and
until there's a better alternative I plan to support this for newer
glibcs. There's a path.so that you can copy and paste to your project
- there are even other traps like the ones to uname(), init_module(),
delete_module() etc.

When I implemented that I tried what you are trying now and it didn't
look right and it's ugly to touch all the calls with path strings and
also very error prone.

It's not perfect, it could be simplified I think, but it doesn't touch
any libkmod/tools code like your approach, it doesn't require root
privileges and it's working quite well for all needs of kmod until
now, which I think are more than the ones for testing udev.

Lucas De Marchi
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.