From: Artem Bityutskiy <dedekind1@gmail.com>
To: Brian Norris <computersforpeace@gmail.com>,
Akinobu Mita <akinobu.mita@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
linux-mtd@lists.infradead.org,
Adrian Hunter <adrian.hunter@intel.com>
Subject: Re: [PATCH -next 1/7] mtd: tests: introduce mtd_test module
Date: Fri, 02 Aug 2013 17:05:01 +0300 [thread overview]
Message-ID: <1375452301.14869.323.camel@sauron.fi.intel.com> (raw)
In-Reply-To: <CAN8TOE987JxGfj-O5NxVCOCVkjsiFy2pRuNMaY3m6+mHdvqtnA@mail.gmail.com>
On Sat, 2013-07-27 at 12:27 -0700, Brian Norris wrote:
> > These functions will be used for reducing code duplication among
> > mtd/tests modules later.
>
> I like this idea. There is definitely too much code duplication.
>
> However, there is an important tradeoff here: now to run these (very
> simple) tests, we have a two-step process*:
>
> insmod mtd_test.ko
> insmod mtd_<actualtest>.ko dev=<MTD>
The helpers do not have to be in a separate module. Here is a short
patch demonstrating how we could put all the helpers to a single .c file
and then just link it to the tests.
It renames mtd_oobtest.c to oobtest.c, and this part of the patch is
omitted. Do it by hand if you want to try this patch:
$ mv drivers/mtd/tests/mtd_oobtest.c drivers/mtd/tests/oobtest.c
Note, I do realize that the code will actually be copied to every test
module, but I think it is fine for our small test infrastructure.
From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Date: Fri, 2 Aug 2013 16:41:37 +0300
Subject: [PATCH] tmp: a patch to demonstrate a possible way of having test
helpers
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
drivers/mtd/tests/Makefile | 2 +
drivers/mtd/tests/mtd_oobtest.c | 714 --------------------------------------
drivers/mtd/tests/oobtest.c | 718 +++++++++++++++++++++++++++++++++++++++
drivers/mtd/tests/test_helpers.c | 6 +
drivers/mtd/tests/test_helpers.h | 1 +
5 files changed, 727 insertions(+), 714 deletions(-)
delete mode 100644 drivers/mtd/tests/mtd_oobtest.c
create mode 100644 drivers/mtd/tests/oobtest.c
create mode 100644 drivers/mtd/tests/test_helpers.c
create mode 100644 drivers/mtd/tests/test_helpers.h
diff --git a/drivers/mtd/tests/Makefile b/drivers/mtd/tests/Makefile
index bd0065c..41a34d3 100644
--- a/drivers/mtd/tests/Makefile
+++ b/drivers/mtd/tests/Makefile
@@ -7,3 +7,5 @@ obj-$(CONFIG_MTD_TESTS) += mtd_subpagetest.o
obj-$(CONFIG_MTD_TESTS) += mtd_torturetest.o
obj-$(CONFIG_MTD_TESTS) += mtd_nandecctest.o
obj-$(CONFIG_MTD_TESTS) += mtd_nandbiterrs.o
+
+mtd_oobtest-objs := oobtest.o test_helpers.o
diff --git a/drivers/mtd/tests/test_helpers.c b/drivers/mtd/tests/test_helpers.c
new file mode 100644
index 0000000..70c4692
--- /dev/null
+++ b/drivers/mtd/tests/test_helpers.c
@@ -0,0 +1,6 @@
+#include "test_helpers.h"
+
+int a_helper(void)
+{
+ return 0;
+}
diff --git a/drivers/mtd/tests/test_helpers.h b/drivers/mtd/tests/test_helpers.h
new file mode 100644
index 0000000..0948a6e
--- /dev/null
+++ b/drivers/mtd/tests/test_helpers.h
@@ -0,0 +1 @@
+int a_helper(void);
--
Best Regards,
Artem Bityutskiy
next prev parent reply other threads:[~2013-08-02 14:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-27 2:14 [PATCH -next 0/7] mtd: tests: reduce duplication among mtd tests modules Akinobu Mita
2013-07-27 2:14 ` [PATCH -next 1/7] mtd: tests: introduce mtd_test module Akinobu Mita
2013-07-27 19:27 ` Brian Norris
2013-07-28 2:21 ` Akinobu Mita
2013-07-28 4:39 ` Vikram Narayanan
2013-07-28 4:41 ` Vikram Narayanan
2013-07-29 3:15 ` Akinobu Mita
2013-08-02 14:05 ` Artem Bityutskiy [this message]
2013-08-03 7:55 ` Akinobu Mita
2013-07-27 2:14 ` [PATCH -next 2/7] mtd: mtd_oobtest: use " Akinobu Mita
2013-07-27 2:14 ` [PATCH -next 3/7] mtd: mtd_pagetest: " Akinobu Mita
2013-07-27 2:14 ` [PATCH -next 4/7] mtd: mtd_readtest: " Akinobu Mita
2013-07-27 2:14 ` [PATCH -next 5/7] mtd: mtd_speedtest: " Akinobu Mita
2013-07-27 2:14 ` [PATCH -next 6/7] mtd: mtd_stresstest: " Akinobu Mita
2013-07-27 2:14 ` [PATCH -next 7/7] mtd: mtd_subpagetest: " Akinobu Mita
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=1375452301.14869.323.camel@sauron.fi.intel.com \
--to=dedekind1@gmail.com \
--cc=adrian.hunter@intel.com \
--cc=akinobu.mita@gmail.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--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