linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Egerer <thomas.egerer@secunet.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: [PATCH 0/2] libudev: Get all sysfs attrs for a device
Date: Thu, 03 Mar 2011 17:38:50 +0000	[thread overview]
Message-ID: <4D6FD22A.9050509@secunet.com> (raw)
In-Reply-To: <4D6F5CA6.2010905@secunet.com>

Kay,

The approach shown in the patch may have indeed a performance impact which we
understand must be avoided. But I take it you are not generally opposed to
providing such an interface, assuming it is implemented in a way that does not
interfere with the existing mode of operation?

Let me explain a little bit why we think this interface would be helpful... We
want to write unit tests for applications that interact with udev (get
notified when devices pop up/disappear), and for this we need an abstraction
layer that we can mock. libudev has a nice clean interface that fits this
purpose very well actually, but we cannot obtain a list of attributes through
libudev (why we sometimes need that, see below). This means that we are
building a secondary abstraction to just obtain the list of attributes, and
strictly funnel everything else through libudev. We then provide "mock"
and "real" implementations of both, and make sure to "tie" the two different
implementations properly (which deeply interact for the "mock" case under the
hood). As you can imagine, this is "a bit" messy.

The test cases to be injected into the applications are usually generated
from "traces" captured from live systems, possibly filtered and post-processed
to simulate exactly the interaction we want to see. It is sometimes useful
to "recapture" from test-data instead of a live system, and when we capture
things, we don't always know what attributes a subsequent test might actually
want. To faithfully replay the interaction later we therefore need to
preserve "as much as we can".

We are aware that poking random things in sysfs can have rather "undesirable"
consequences, so there is probably not much one can do with such an interface
outside the scope of such testing scenarios. It is on the other hand very
difficult to provide good testability without it.

Cheers, Thomas

  parent reply	other threads:[~2011-03-03 17:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03  9:17 [PATCH 0/2] libudev: Get all sysfs attrs for a device Thomas Egerer
2011-03-03 14:11 ` Kay Sievers
2011-03-03 17:00 ` Martin Pitt
2011-03-03 17:15 ` Kay Sievers
2011-03-03 17:38 ` Thomas Egerer [this message]
2011-03-03 17:47 ` Kay Sievers
2011-03-04 16:06 ` Thomas Egerer
2011-03-04 22:14 ` Kay Sievers

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=4D6FD22A.9050509@secunet.com \
    --to=thomas.egerer@secunet.com \
    --cc=linux-hotplug@vger.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;
as well as URLs for NNTP newsgroup(s).