public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] device-drivers: rtc: minor updates
@ 2013-09-09 12:23 Alexey Kodanev
  2013-09-09 14:11 ` chrubis
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Kodanev @ 2013-09-09 12:23 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko, Alexey Kodanev

Makefile updated.
Added .gitignore file.
Added root check and rtc device check.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/kernel/device-drivers/rtc/.gitignore |    1 +
 testcases/kernel/device-drivers/rtc/Makefile   |   39 +++++++++--------------
 testcases/kernel/device-drivers/rtc/rtc-test.c |   32 ++++++++++++++++---
 3 files changed, 43 insertions(+), 29 deletions(-)
 create mode 100644 testcases/kernel/device-drivers/rtc/.gitignore

diff --git a/testcases/kernel/device-drivers/rtc/.gitignore b/testcases/kernel/device-drivers/rtc/.gitignore
new file mode 100644
index 0000000..727656a
--- /dev/null
+++ b/testcases/kernel/device-drivers/rtc/.gitignore
@@ -0,0 +1 @@
+/rtc-test
diff --git a/testcases/kernel/device-drivers/rtc/Makefile b/testcases/kernel/device-drivers/rtc/Makefile
index 0eefcb0..effd5da 100644
--- a/testcases/kernel/device-drivers/rtc/Makefile
+++ b/testcases/kernel/device-drivers/rtc/Makefile
@@ -1,29 +1,20 @@
+# Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
 #
-#  Copyright (c) Larsen & Toubro Infotech Ltd., 2010
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
 #
-#  This program is free software;  you can redistribute it and/or modify
-#  it under the terms of the GNU General Public License as published by
-#  the Free Software Foundation; either version 2 of the License, or
-#  (at your option) any later version.
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
 #
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-#  the GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program;  if not, write to the Free Software
-#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
-#
-#
-
-CFLAGS = -O2 -Wall -I ../../../../include/
-LIBS = -L ../../../../lib/ -lltp
-SRC = rtc-test.c
-
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-all: $(SRC)
-	$(CC) $(SRC) $(CFLAGS) $(LIBS) -o rtc-test
+top_srcdir		?= ../../../..
 
-clean:
-	rm -f rtc-test
+include $(top_srcdir)/include/mk/testcases.mk
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/device-drivers/rtc/rtc-test.c b/testcases/kernel/device-drivers/rtc/rtc-test.c
index 28c1113..aa931f5 100644
--- a/testcases/kernel/device-drivers/rtc/rtc-test.c
+++ b/testcases/kernel/device-drivers/rtc/rtc-test.c
@@ -3,6 +3,7 @@
  *   Tests for the Real Time Clock driver.
  *
  *   Copyright (c) Larsen & Toubro Infotech Ltd., 2010
+ *   Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
  *
  *   Author : Silesh C V <Silesh.Vellattu@lntinfotech.com>
  *
@@ -21,7 +22,7 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "test.h"
+
 #include <sys/ioctl.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -31,10 +32,26 @@
 #include <errno.h>
 #include <time.h>
 
+#include "test.h"
+#include "usctest.h"
+
 int rtc_fd = -1;
 char *TCID = "rtc01";
 int TST_TOTAL = 3;
 
+static char *rtc_dev = "/dev/rtc";
+static int dflag;
+static const option_t options[] = {
+	{"d:", &dflag, &rtc_dev},
+	{NULL, NULL, NULL}
+};
+
+static void help(void)
+{
+	printf("  -d x    rtc device node, default is %s\n",
+		rtc_dev);
+}
+
 /* Read and Alarm Tests :  Read test reads the Date/time from RTC
  * while Alarm test, sets the alarm to 5 seconds in future and
  * waits for it to ring.The ioctls tested in these tests are
@@ -192,12 +209,17 @@ void update_interrupts_test(void)
 	tst_resm(TPASS, "RTC UPDATE INTERRUPTS TEST Passed");
 }
 
-int main(int argc, char **argv)
+int main(int argc, char *argv[])
 {
-	char *rtc_dev = "/dev/rtc";
+	char *msg;
+	msg = parse_opts(argc, argv, options, help);
+	if (msg != NULL)
+		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
+
+	tst_require_root(NULL);
 
-	if (argc == 2)
-		rtc_dev = argv[1];
+	if (access(rtc_dev, F_OK) == -1)
+		tst_brkm(TCONF, NULL, "couldn't find rtc device '%s'", rtc_dev);
 
 	rtc_fd = open(rtc_dev, O_RDONLY);
 
-- 
1.7.1


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] device-drivers: rtc: minor updates
  2013-09-09 12:23 [LTP] [PATCH] device-drivers: rtc: minor updates Alexey Kodanev
@ 2013-09-09 14:11 ` chrubis
       [not found]   ` <522DE321.5090701@oracle.com>
  0 siblings, 1 reply; 5+ messages in thread
From: chrubis @ 2013-09-09 14:11 UTC (permalink / raw)
  To: Alexey Kodanev; +Cc: vasily.isaenko, ltp-list

Hi!
> Makefile updated.
> Added .gitignore file.
> Added root check and rtc device check.

The changes looks good, what about adding the test into kernel_misc
runtest file?

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] device-drivers: rtc: minor updates
       [not found]   ` <522DE321.5090701@oracle.com>
@ 2013-09-09 15:22     ` chrubis
  2013-09-10 12:47       ` chrubis
  0 siblings, 1 reply; 5+ messages in thread
From: chrubis @ 2013-09-09 15:22 UTC (permalink / raw)
  To: alexey.kodanev; +Cc: vasily.isaenko, ltp-list

Hi!
> > Hi!
> >> Makefile updated.
> >> Added .gitignore file.
> >> Added root check and rtc device check.
> > The changes looks good, what about adding the test into kernel_misc
> > runtest file?
> >
> I thought I can do it in separate patches. We have to add device-drivers 
> directory to .../testcases/kernel/Makefile and then  include this test 
> in .../device-drivers/Makefile to build it automatically.
> I've recently sent a patch which is adding Makefile to device-drivers 
> directory, is it OK?

I would split it to patch that adds Makefile into device drivers
directory and adds device-drivers directory into the kernel/Makefile
(assuming that Makefile with empty SUBDIRS is noop) And for each fixed
test a patch that enables subdirectory once test is fixed along with
updating the runtest entry (which is a bit unfortunate as this may
generate collisions if you work on more than one subdir which means that
this patch should be done only once the test fix is acked). If you are
OK with that, let's start with rtc test.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] device-drivers: rtc: minor updates
  2013-09-09 15:22     ` chrubis
@ 2013-09-10 12:47       ` chrubis
       [not found]         ` <522F2003.5010101@oracle.com>
  0 siblings, 1 reply; 5+ messages in thread
From: chrubis @ 2013-09-10 12:47 UTC (permalink / raw)
  To: alexey.kodanev; +Cc: vasily.isaenko, ltp-list

Hi!
I've commited the changes in makefiles, fix for rtc test and the final
patch to enable rtc build and runtest.

Note that I've renamed the rtc-test to rtc01 so that the binary name
matches the test name (TCID) and fixed the runtest entry (you had it
wrong anyway the first string is test name and the rest is the
commandline to execute).

Thanks for the patches :)

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] device-drivers: rtc: minor updates
       [not found]         ` <522F2003.5010101@oracle.com>
@ 2013-09-10 13:41           ` chrubis
  0 siblings, 0 replies; 5+ messages in thread
From: chrubis @ 2013-09-10 13:41 UTC (permalink / raw)
  To: alexey.kodanev; +Cc: vasily.isaenko, ltp-list

Hi!
> > Note that I've renamed the rtc-test to rtc01 so that the binary name
> > matches the test name (TCID) and fixed the runtest entry (you had it
> > wrong anyway the first string is test name and the rest is the
> > commandline to execute).
> Thanks, I missed it :)
> I have a quick question concerning SUBDIRS in the 
> ..../device-drivers/Makefile: should we keep test directories in 
> alphabetical order?

Yes please.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-10 13:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-09 12:23 [LTP] [PATCH] device-drivers: rtc: minor updates Alexey Kodanev
2013-09-09 14:11 ` chrubis
     [not found]   ` <522DE321.5090701@oracle.com>
2013-09-09 15:22     ` chrubis
2013-09-10 12:47       ` chrubis
     [not found]         ` <522F2003.5010101@oracle.com>
2013-09-10 13:41           ` chrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox