From: Jared Hulbert <jaredeh@gmail.com>
To: "Eric W. Biederman" <ebiederman@lnxi.com>
Cc: MTD List <linux-mtd@lists.infradead.org>
Subject: Re: Unit test for cfi_cmdset_0001.c
Date: Fri, 28 Jan 2005 11:47:31 -0800 [thread overview]
Message-ID: <6934efce050128114749c662b1@mail.gmail.com> (raw)
In-Reply-To: <m33bwmw0ax.fsf@maxwell.lnxi.com>
Wow! Lots of sceptics! Help! Anybody who thinks this is an idea
that is promising please chime in. :)
Hmm, Let me try to explain a little better.
Consider cfi_cmdset_0001.c:
cfi_intelext_write_buffers() calls cfi_intelext_write_words() and
do_write_buffer()
In order to properly unit test you'd need to stub out
cfi_intelext_write_words() and do_write_buffer(). For those that
don't understand stubbing out this means creating a phony functions to
accept input and give output based on the test condition. This allows
you to test code paths that are improbable under nomial conditions or
very difficult to test with other methods. But if the
do_write_buffer() is compiled into the same .o as
cfi_intelext_write_buffers() I'm not sure how to link to my stub
do_write_buffer() instead of the real one. That is the problem that
drives my original question about #if's, forking the files, etc.
Because there are macros between this driver and any real hardware it
should be rather easy to test various states and see at least the
sequence of events the hardware will see. This allow you to test for
hardware that does not exist or is not really worth it. Certianly it
is not a magic bullet, it is only as good as your tests, and doesn't
find timing bugs or bugs related to multitasking etc.
I did it with a file system at work it was very useful.
,JAred
next prev parent reply other threads:[~2005-01-28 19:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-28 1:20 Unit test for cfi_cmdset_0001.c Jared Hulbert
2005-01-28 2:12 ` Nicolas Pitre
2005-01-28 2:16 ` Josh Boyer
2005-01-28 6:11 ` Eric W. Biederman
2005-01-28 19:47 ` Jared Hulbert [this message]
2005-01-28 20:59 ` Nicolas Pitre
2005-01-29 1:48 ` Jared Hulbert
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=6934efce050128114749c662b1@mail.gmail.com \
--to=jaredeh@gmail.com \
--cc=ebiederman@lnxi.com \
--cc=linux-mtd@lists.infradead.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