All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH][RESEND] RTC Device Driver Tests
@ 2010-02-24 12:10 Silesh C V
  2010-02-24 21:14 ` Garrett Cooper
  0 siblings, 1 reply; 18+ messages in thread
From: Silesh C V @ 2010-02-24 12:10 UTC (permalink / raw)
  To: ltp-list; +Cc: Arun.sudhilal, Mohamed.Rasheed


[-- Attachment #1.1: Type: text/plain, Size: 9047 bytes --]

Hi ,

This patch contains tests for the linux RTC driver.The patch is taken
against feb intermediate release.I have also attached the patch.Please find
the test log at the end of this mail.Build/Run instructions are explained in
the README.


Signed-off-By: Silesh C V <Silesh.Vellattu@lntinfotech.com>
--
diff -purN ltp-intermediate-20100228.
orig/testcases/kernel/device-drivers/rtc/Makefile
ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
---
ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/Makefile
1970-01-01 05:30:00.000000000 +0530
+++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
   2010-02-24 15:21:33.000000000 +0530
@@ -0,0 +1,28 @@
+#
+#  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 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
+SRC = test_rtc.c
+
+
+all: $(SRC)
+       $(CC) $(CFLAGS) $(SRC) -o rtc-test
+
+clean:
+       rm -f rtc-test
diff -purN
ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
---
ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
1970-01-01 05:30:00.000000000 +0530
+++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
   2010-02-24 14:34:01.000000000 +0530
@@ -0,0 +1,29 @@
+test_rtc.c : Test the Real Time Clock driver
+
+Tests supported as of now
+--------------------------
+1. Read test : This reads the time/date from the RTC
+   ioctls tested :- RTC_RD_TIME.
+
+2. Alarm Test: Sets the alarm to 5 seconds in future and makes sure it
rings.
+   ioctls tested :- RTC_ALM_SET, RTC_ALM_READ,  RTC_AIE_ON, RTC_AIE_OFF.
+
+3. Update interrupts test : Sets Update interrupts enable on, waits for
five
+   interrupts and then turns it off.
+   ioctls tested :- RTC_UIE_ON, RTC_UIE_OFF.
+
+
+How to Build
+------------
+
+Enter rtc directory and issue a 'make' .
+
+How to Run
+----------
+
+       The tests assume the rtc device node to be "/dev/rtc". If you have a
+different node run the test with the name of the node as a parameter.
+
+Eg. If your node is /dev/rtc0, then run the test as
+
+       $ ./rtc-test /dev/rtc0
diff -purN
ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/test_rtc.c
ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/test_rtc.c
---
ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/test_rtc.c
      1970-01-01 05:30:00.000000000 +0530
+++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/test_rtc.c
   2010-02-24 15:17:59.000000000 +0530
@@ -0,0 +1,175 @@
+/*   test_rtc.c
+ *
+ *   Copyright (c) Larsen & Toubro Infotech Ltd., 2010
+ *
+ *   Contact : Silesh C V <Silesh.Vellattu@lntinfotech.com>
+ *
+ *   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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+ *
+ */
+
+#include <sys/ioctl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <linux/rtc.h>
+#include <errno.h>
+
+int rtc_fd = -1;
+
+void read_alarm_test(void)
+{
+       struct rtc_time rtc_tm;
+       int ret;
+       unsigned long data;
+
+       printf("\nRTC READ TEST:\n");
+
+        /*Read RTC Time*/
+        ret = ioctl(rtc_fd, RTC_RD_TIME, &rtc_tm);
+        if (ret == -1) {
+                perror("RTC_RD_TIME ioctl");
+                printf("RTC READ TEST Failed\n");
+                return;
+        }
+
+        printf("RTC READ TEST Passed");
+        printf("\nCurrent RTC date/time is %d-%d-%d, %02d:%02d:%02d.\n",
+                rtc_tm.tm_mday, rtc_tm.tm_mon + 1, rtc_tm.tm_year + 1900,
+                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
+
+        printf("\nRTC ALARM TEST :\n");
+
+        /*set Alarm to 5 Seconds*/
+        rtc_tm.tm_sec += 5;
+        if (rtc_tm.tm_sec >= 60) {
+                rtc_tm.tm_sec %= 60;
+                rtc_tm.tm_min++;
+        }
+
+        if (rtc_tm.tm_min == 60) {
+                rtc_tm.tm_min = 0;
+                rtc_tm.tm_hour++;
+        }
+
+        if (rtc_tm.tm_hour == 24)
+                rtc_tm.tm_hour = 0;
+
+       ret = ioctl(rtc_fd, RTC_ALM_SET, &rtc_tm);
+        if (ret == -1) {
+                perror("RTC_ALM_SET ioctl");
+                printf("RTC ALARM TEST Failed\n");
+                return;
+        }
+
+        /*Read current alarm time*/
+        ret = ioctl(rtc_fd, RTC_ALM_READ, &rtc_tm);
+        if (ret == -1) {
+                perror("RTC_ALM_READ ioctl");
+                printf("RTC ALARM TEST Failed\n");
+                return;
+        }
+
+        printf("Alarm time set to %02d:%02d:%02d.\n",
+                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
+        /* Enable alarm interrupts */
+        ret = ioctl(rtc_fd, RTC_AIE_ON, 0);
+        if (ret == -1) {
+                perror("RTC_AIE_ON ioctl");
+                printf("RTC ALARM TEST Failed\n");
+                return;
+        }
+
+        printf("Waiting 5 seconds for the alarm...\n");
+        ret = read(rtc_fd, &data, sizeof(unsigned long));
+        if (ret == -1) {
+                perror("read");
+                printf("RTC ALARM TEST Failed\n");
+                return;
+        }
+
+       printf("Alarm rang.\n");
+        /* Disable alarm interrupts */
+        ret = ioctl(rtc_fd, RTC_AIE_OFF, 0);
+        if (ret == -1) {
+                perror("RTC_AIE_OFF ioctl");
+                printf("RTC ALARM TEST Failed\n");
+                return;
+        }
+
+        printf("RTC ALARM TEST Passed\n");
+}
+
+void update_interrupts_test(void)
+{
+       int ret, i;
+       unsigned long data;
+
+       printf("\nRTC UPDATE INTERRUPTS TEST :\n");
+        /*Turn on update interrupts*/
+        ret = ioctl(rtc_fd, RTC_UIE_ON, 0);
+        if (ret == -1) {
+                perror("RTC_UIE_ON ioctl");
+                printf("RTC UPDATE INTERRUPTS TEST Failed\n");
+               return;
+        }
+
+        printf("Waiting for  5 update interrupts...\n");
+        for (i = 1; i < 6; i++) {
+                ret = read(rtc_fd, &data, sizeof(unsigned long));
+                if (ret == -1) {
+                        perror("read");
+                        printf("RTC UPDATE INTERRUPTS TEST Failed\n");
+                        return;
+                }
+                printf("Update interrupt %d\n", i);
+        }
+
+         /* Turn off update interrupts */
+        ret = ioctl(rtc_fd, RTC_UIE_OFF, 0);
+        if (ret == -1) {
+                perror("RTC_UIE_OFF ioctl");
+                printf("RTC UPDATE INTERRUPTS TEST Failed\n");
+                return;
+        }
+        printf("RTC UPDATE INTERRUPTS TEST Passed\n");
+
+}
+
+int main(int argc, char **argv)
+{
+       char *rtc_dev = "/dev/rtc";
+
+       if (argc == 2)
+               rtc_dev = argv[1];
+
+       rtc_fd = open(rtc_dev, O_RDONLY);
+       if (rtc_fd < 0) {
+               perror(rtc_dev);
+               exit(errno);
+       }
+
+       /*Read and alarm tests*/
+       read_alarm_test();
+
+       /*Update interrupts test*/
+       update_interrupts_test();
+
+       close(rtc_fd);
+
+       printf("\nRTC Tests Done!\n");
+       return 0;
+}
--

test log
------------------------------

RTC READ TEST:
RTC READ TEST Passed
Current RTC date/time is 24-2-2010, 17:03:05.

RTC ALARM TEST :
Alarm time set to 17:03:10.
Waiting 5 seconds for the alarm...
Alarm rang.
RTC ALARM TEST Passed

RTC UPDATE INTERRUPTS TEST :
Waiting for  5 update interrupts...
Update interrupt 1
Update interrupt 2
Update interrupt 3
Update interrupt 4
Update interrupt 5
RTC UPDATE INTERRUPTS TEST Passed

RTC Tests Done!
---------------------------------------------------------


Thanks .
Silesh

[-- Attachment #1.2: Type: text/html, Size: 11118 bytes --]

[-- Attachment #2: ltp_rtc.patch --]
[-- Type: application/octet-stream, Size: 7997 bytes --]

diff -purN ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/Makefile ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
--- ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/Makefile	1970-01-01 05:30:00.000000000 +0530
+++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile	2010-02-24 15:21:33.000000000 +0530
@@ -0,0 +1,28 @@
+#
+#  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 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 
+SRC = test_rtc.c
+
+
+all: $(SRC)
+	$(CC) $(CFLAGS) $(SRC) -o rtc-test
+
+clean:
+	rm -f rtc-test
diff -purN ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
--- ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README	1970-01-01 05:30:00.000000000 +0530
+++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README	2010-02-24 14:34:01.000000000 +0530
@@ -0,0 +1,29 @@
+test_rtc.c : Test the Real Time Clock driver
+
+Tests supported as of now 
+--------------------------
+1. Read test : This reads the time/date from the RTC 
+   ioctls tested :- RTC_RD_TIME.
+  
+2. Alarm Test: Sets the alarm to 5 seconds in future and makes sure it rings.
+   ioctls tested :- RTC_ALM_SET, RTC_ALM_READ,  RTC_AIE_ON, RTC_AIE_OFF.
+
+3. Update interrupts test : Sets Update interrupts enable on, waits for five 
+   interrupts and then turns it off.
+   ioctls tested :- RTC_UIE_ON, RTC_UIE_OFF.
+
+
+How to Build
+------------
+
+Enter rtc directory and issue a 'make' .
+
+How to Run
+----------
+
+	The tests assume the rtc device node to be "/dev/rtc". If you have a
+different node run the test with the name of the node as a parameter.
+
+Eg. If your node is /dev/rtc0, then run the test as
+
+	$ ./rtc-test /dev/rtc0
diff -purN ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/test_rtc.c ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/test_rtc.c
--- ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/test_rtc.c	1970-01-01 05:30:00.000000000 +0530
+++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/test_rtc.c	2010-02-24 15:17:59.000000000 +0530
@@ -0,0 +1,175 @@
+/*   test_rtc.c
+ *
+ *   Copyright (c) Larsen & Toubro Infotech Ltd., 2010
+ *   
+ *   Contact : Silesh C V <Silesh.Vellattu@lntinfotech.com>
+ *
+ *   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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <sys/ioctl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <linux/rtc.h>
+#include <errno.h>
+
+int rtc_fd = -1;
+
+void read_alarm_test(void)
+{
+	struct rtc_time rtc_tm;
+	int ret;
+	unsigned long data;
+
+	printf("\nRTC READ TEST:\n");
+
+	 /*Read RTC Time*/
+        ret = ioctl(rtc_fd, RTC_RD_TIME, &rtc_tm);
+        if (ret == -1) {
+                perror("RTC_RD_TIME ioctl");
+                printf("RTC READ TEST Failed\n");
+                return;
+        }
+
+        printf("RTC READ TEST Passed");
+        printf("\nCurrent RTC date/time is %d-%d-%d, %02d:%02d:%02d.\n",
+                rtc_tm.tm_mday, rtc_tm.tm_mon + 1, rtc_tm.tm_year + 1900,
+                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
+
+        printf("\nRTC ALARM TEST :\n");
+
+        /*set Alarm to 5 Seconds*/
+        rtc_tm.tm_sec += 5;
+        if (rtc_tm.tm_sec >= 60) {
+                rtc_tm.tm_sec %= 60;
+                rtc_tm.tm_min++;
+        }
+
+        if (rtc_tm.tm_min == 60) {
+                rtc_tm.tm_min = 0;
+                rtc_tm.tm_hour++;
+        }
+
+        if (rtc_tm.tm_hour == 24)
+                rtc_tm.tm_hour = 0;
+
+	ret = ioctl(rtc_fd, RTC_ALM_SET, &rtc_tm);
+        if (ret == -1) {
+                perror("RTC_ALM_SET ioctl");
+                printf("RTC ALARM TEST Failed\n");
+                return;
+        }
+
+        /*Read current alarm time*/
+        ret = ioctl(rtc_fd, RTC_ALM_READ, &rtc_tm);
+        if (ret == -1) {
+                perror("RTC_ALM_READ ioctl");
+                printf("RTC ALARM TEST Failed\n");
+                return;
+        }
+
+        printf("Alarm time set to %02d:%02d:%02d.\n",
+                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
+        /* Enable alarm interrupts */
+        ret = ioctl(rtc_fd, RTC_AIE_ON, 0);
+        if (ret == -1) {
+                perror("RTC_AIE_ON ioctl");
+                printf("RTC ALARM TEST Failed\n");
+                return;
+        }
+
+        printf("Waiting 5 seconds for the alarm...\n");
+        ret = read(rtc_fd, &data, sizeof(unsigned long));
+        if (ret == -1) {
+                perror("read");
+                printf("RTC ALARM TEST Failed\n");
+                return;
+        }
+
+	printf("Alarm rang.\n");
+        /* Disable alarm interrupts */
+        ret = ioctl(rtc_fd, RTC_AIE_OFF, 0);
+        if (ret == -1) {
+                perror("RTC_AIE_OFF ioctl");
+                printf("RTC ALARM TEST Failed\n");
+                return;
+        }
+
+        printf("RTC ALARM TEST Passed\n");
+}
+
+void update_interrupts_test(void)
+{
+	int ret, i;
+	unsigned long data;
+
+	printf("\nRTC UPDATE INTERRUPTS TEST :\n");
+        /*Turn on update interrupts*/
+        ret = ioctl(rtc_fd, RTC_UIE_ON, 0);
+        if (ret == -1) {
+                perror("RTC_UIE_ON ioctl");
+                printf("RTC UPDATE INTERRUPTS TEST Failed\n");
+		return;
+        }
+
+        printf("Waiting for  5 update interrupts...\n");
+        for (i = 1; i < 6; i++) {
+                ret = read(rtc_fd, &data, sizeof(unsigned long));
+                if (ret == -1) {
+                        perror("read");
+                        printf("RTC UPDATE INTERRUPTS TEST Failed\n");
+                        return;
+                }
+                printf("Update interrupt %d\n", i);
+        }
+
+         /* Turn off update interrupts */
+        ret = ioctl(rtc_fd, RTC_UIE_OFF, 0);
+        if (ret == -1) {
+                perror("RTC_UIE_OFF ioctl");
+                printf("RTC UPDATE INTERRUPTS TEST Failed\n");
+                return;
+        }
+        printf("RTC UPDATE INTERRUPTS TEST Passed\n");
+
+}
+
+int main(int argc, char **argv)
+{
+	char *rtc_dev = "/dev/rtc";
+
+	if (argc == 2)
+		rtc_dev = argv[1];
+
+	rtc_fd = open(rtc_dev, O_RDONLY);
+	if (rtc_fd < 0) {
+		perror(rtc_dev);
+		exit(errno);
+	}
+
+	/*Read and alarm tests*/
+	read_alarm_test();
+
+	/*Update interrupts test*/
+	update_interrupts_test();
+	
+	close(rtc_fd);
+
+	printf("\nRTC Tests Done!\n");
+	return 0;
+}

[-- Attachment #3: Type: text/plain, Size: 345 bytes --]

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH][RESEND] RTC Device Driver Tests
  2010-02-24 12:10 [LTP] [PATCH][RESEND] RTC Device Driver Tests Silesh C V
@ 2010-02-24 21:14 ` Garrett Cooper
  2010-02-25  6:40   ` Silesh C V
  0 siblings, 1 reply; 18+ messages in thread
From: Garrett Cooper @ 2010-02-24 21:14 UTC (permalink / raw)
  To: Silesh C V; +Cc: ltp-list, Arun.sudhilal, Mohamed.Rasheed

On Wed, Feb 24, 2010 at 4:10 AM, Silesh C V <saileshcv@gmail.com> wrote:
>
> Hi ,
>
> This patch contains tests for the linux RTC driver.The patch is taken
> against feb intermediate release.I have also attached the patch.Please find
> the test log at the end of this mail.Build/Run instructions are explained in
> the README.
>
>
> Signed-off-By: Silesh C V <Silesh.Vellattu@lntinfotech.com>
> --
> diff -purN ltp-intermediate-20100228.
> orig/testcases/kernel/device-drivers/rtc/Makefile
> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
> ---
> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/Makefile
> 1970-01-01 05:30:00.000000000 +0530
> +++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
>    2010-02-24 15:21:33.000000000 +0530
> @@ -0,0 +1,28 @@
> +#
> +#  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 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
> +SRC = test_rtc.c
> +
> +
> +all: $(SRC)
> +       $(CC) $(CFLAGS) $(SRC) -o rtc-test
> +
> +clean:
> +       rm -f rtc-test

Please integrate into the Makefile infrastructure. See README.mk-devel
for more details.

> diff -purN
> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
> ---
> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
> 1970-01-01 05:30:00.000000000 +0530
> +++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
>    2010-02-24 14:34:01.000000000 +0530
> @@ -0,0 +1,29 @@
> +test_rtc.c : Test the Real Time Clock driver
> +
> +Tests supported as of now
> +--------------------------
> +1. Read test : This reads the time/date from the RTC
> +   ioctls tested :- RTC_RD_TIME.
> +
> +2. Alarm Test: Sets the alarm to 5 seconds in future and makes sure it
> rings.
> +   ioctls tested :- RTC_ALM_SET, RTC_ALM_READ,  RTC_AIE_ON, RTC_AIE_OFF.
> +
> +3. Update interrupts test : Sets Update interrupts enable on, waits for
> five
> +   interrupts and then turns it off.
> +   ioctls tested :- RTC_UIE_ON, RTC_UIE_OFF.
> +
> +
> +How to Build
> +------------
> +
> +Enter rtc directory and issue a 'make' .
> +
> +How to Run
> +----------
> +
> +       The tests assume the rtc device node to be "/dev/rtc". If you have a
> +different node run the test with the name of the node as a parameter.
> +
> +Eg. If your node is /dev/rtc0, then run the test as
> +
> +       $ ./rtc-test /dev/rtc0
> diff -purN
> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/test_rtc.c
> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/test_rtc.c
> ---
> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/test_rtc.c
>       1970-01-01 05:30:00.000000000 +0530
> +++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/test_rtc.c
>    2010-02-24 15:17:59.000000000 +0530
> @@ -0,0 +1,175 @@
> +/*   test_rtc.c
> + *
> + *   Copyright (c) Larsen & Toubro Infotech Ltd., 2010
> + *
> + *   Contact : Silesh C V <Silesh.Vellattu@lntinfotech.com>
> + *
> + *   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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
> USA
> + *
> + */
> +
> +#include <sys/ioctl.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <fcntl.h>
> +#include <unistd.h>
> +#include <linux/rtc.h>
> +#include <errno.h>
> +
> +int rtc_fd = -1;
> +
> +void read_alarm_test(void)
> +{
> +       struct rtc_time rtc_tm;
> +       int ret;
> +       unsigned long data;
> +
> +       printf("\nRTC READ TEST:\n");
> +
> +        /*Read RTC Time*/
> +        ret = ioctl(rtc_fd, RTC_RD_TIME, &rtc_tm);
> +        if (ret == -1) {
> +                perror("RTC_RD_TIME ioctl");
> +                printf("RTC READ TEST Failed\n");
> +                return;
> +        }
> +
> +        printf("RTC READ TEST Passed");
> +        printf("\nCurrent RTC date/time is %d-%d-%d, %02d:%02d:%02d.\n",
> +                rtc_tm.tm_mday, rtc_tm.tm_mon + 1, rtc_tm.tm_year + 1900,
> +                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);

strftime(3) ?

> +        printf("\nRTC ALARM TEST :\n");
> +
> +        /*set Alarm to 5 Seconds*/
> +        rtc_tm.tm_sec += 5;
> +        if (rtc_tm.tm_sec >= 60) {
> +                rtc_tm.tm_sec %= 60;
> +                rtc_tm.tm_min++;
> +        }
> +
> +        if (rtc_tm.tm_min == 60) {
> +                rtc_tm.tm_min = 0;
> +                rtc_tm.tm_hour++;
> +        }
> +
> +        if (rtc_tm.tm_hour == 24)
> +                rtc_tm.tm_hour = 0;
> +
> +       ret = ioctl(rtc_fd, RTC_ALM_SET, &rtc_tm);
> +        if (ret == -1) {
> +                perror("RTC_ALM_SET ioctl");
> +                printf("RTC ALARM TEST Failed\n");
> +                return;
> +        }
> +
> +        /*Read current alarm time*/
> +        ret = ioctl(rtc_fd, RTC_ALM_READ, &rtc_tm);
> +        if (ret == -1) {
> +                perror("RTC_ALM_READ ioctl");
> +                printf("RTC ALARM TEST Failed\n");
> +                return;
> +        }
> +
> +        printf("Alarm time set to %02d:%02d:%02d.\n",
> +                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
> +        /* Enable alarm interrupts */
> +        ret = ioctl(rtc_fd, RTC_AIE_ON, 0);
> +        if (ret == -1) {
> +                perror("RTC_AIE_ON ioctl");
> +                printf("RTC ALARM TEST Failed\n");
> +                return;
> +        }
> +
> +        printf("Waiting 5 seconds for the alarm...\n");
> +        ret = read(rtc_fd, &data, sizeof(unsigned long));
> +        if (ret == -1) {
> +                perror("read");
> +                printf("RTC ALARM TEST Failed\n");
> +                return;
> +        }
> +
> +       printf("Alarm rang.\n");
> +        /* Disable alarm interrupts */
> +        ret = ioctl(rtc_fd, RTC_AIE_OFF, 0);
> +        if (ret == -1) {
> +                perror("RTC_AIE_OFF ioctl");
> +                printf("RTC ALARM TEST Failed\n");
> +                return;
> +        }
> +
> +        printf("RTC ALARM TEST Passed\n");
> +}
> +
> +void update_interrupts_test(void)
> +{
> +       int ret, i;
> +       unsigned long data;
> +
> +       printf("\nRTC UPDATE INTERRUPTS TEST :\n");
> +        /*Turn on update interrupts*/
> +        ret = ioctl(rtc_fd, RTC_UIE_ON, 0);
> +        if (ret == -1) {
> +                perror("RTC_UIE_ON ioctl");
> +                printf("RTC UPDATE INTERRUPTS TEST Failed\n");
> +               return;
> +        }
> +
> +        printf("Waiting for  5 update interrupts...\n");
> +        for (i = 1; i < 6; i++) {
> +                ret = read(rtc_fd, &data, sizeof(unsigned long));
> +                if (ret == -1) {
> +                        perror("read");
> +                        printf("RTC UPDATE INTERRUPTS TEST Failed\n");
> +                        return;
> +                }
> +                printf("Update interrupt %d\n", i);
> +        }
> +
> +         /* Turn off update interrupts */
> +        ret = ioctl(rtc_fd, RTC_UIE_OFF, 0);
> +        if (ret == -1) {
> +                perror("RTC_UIE_OFF ioctl");
> +                printf("RTC UPDATE INTERRUPTS TEST Failed\n");
> +                return;
> +        }
> +        printf("RTC UPDATE INTERRUPTS TEST Passed\n");

tst_resm(ret == -1 ? TFAIL : TPASS, "RTC update interrupts test %s",
ret == -1 ? "failed" : "passed");

> +}
> +
> +int main(int argc, char **argv)
> +{
> +       char *rtc_dev = "/dev/rtc"
> +
> +
> +       if (argc == 2)
> +               rtc_dev = argv[1];
> +
> +       rtc_fd = open(rtc_dev, O_RDONLY);
> +       if (rtc_fd < 0) {
> +               perror(rtc_dev);

tst_brkm(TBROK | TERRNO, tst_exit, "couldn't open %s", rtc_dev);

> +               exit(errno);
> +       }
> +
> +       /*Read and alarm tests*/
> +       read_alarm_test();
> +
> +       /*Update interrupts test*/
> +       update_interrupts_test();
> +
> +       close(rtc_fd);
> +
> +       printf("\nRTC Tests Done!\n");
> +       return 0;
> +}

1. Please rename the test sourcefile to rtc-test.c because the current
naming is unnecessarily inconsistent.
2. Please replace printfs with tst_res(3) calls so this can be
properly integrated into LTP.

Thanks!
-Garrett

> --
> test log
> ------------------------------
> RTC READ TEST:
> RTC READ TEST Passed
> Current RTC date/time is 24-2-2010, 17:03:05.
>
> RTC ALARM TEST :
> Alarm time set to 17:03:10.
> Waiting 5 seconds for the alarm...
> Alarm rang.
> RTC ALARM TEST Passed
>
> RTC UPDATE INTERRUPTS TEST :
> Waiting for  5 update interrupts...
> Update interrupt 1
> Update interrupt 2
> Update interrupt 3
> Update interrupt 4
> Update interrupt 5
> RTC UPDATE INTERRUPTS TEST Passed
>
> RTC Tests Done!
> ---------------------------------------------------------
>
>
> Thanks .
> Silesh
>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>
>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH][RESEND] RTC Device Driver Tests
  2010-02-24 21:14 ` Garrett Cooper
@ 2010-02-25  6:40   ` Silesh C V
  2010-02-25  7:07     ` Garrett Cooper
  0 siblings, 1 reply; 18+ messages in thread
From: Silesh C V @ 2010-02-25  6:40 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list, Arun.sudhilal, Mohamed.Rasheed

Hi Garrett,

Thanks for the review and suggestions.

On 2/25/10, Garrett Cooper <yanegomi@gmail.com> wrote:
> On Wed, Feb 24, 2010 at 4:10 AM, Silesh C V <saileshcv@gmail.com> wrote:
>>
>> Hi ,
>>
>> This patch contains tests for the linux RTC driver.The patch is taken
>> against feb intermediate release.I have also attached the patch.Please
>> find
>> the test log at the end of this mail.Build/Run instructions are explained
>> in
>> the README.
>>
>>
>> Signed-off-By: Silesh C V <Silesh.Vellattu@lntinfotech.com>
>> --
>> diff -purN ltp-intermediate-20100228.
>> orig/testcases/kernel/device-drivers/rtc/Makefile
>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
>> ---
>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/Makefile
>> 1970-01-01 05:30:00.000000000 +0530
>> +++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
>>    2010-02-24 15:21:33.000000000 +0530
>> @@ -0,0 +1,28 @@
>> +#
>> +#  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 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
>> +SRC = test_rtc.c
>> +
>> +
>> +all: $(SRC)
>> +       $(CC) $(CFLAGS) $(SRC) -o rtc-test
>> +
>> +clean:
>> +       rm -f rtc-test
>
> Please integrate into the Makefile infrastructure. See README.mk-devel
> for more details.

I can see that under kernel/ directory, the device-drivers  directory
does not follow the new Makefile infrastructure. I tried adding
device-drivers SUBDIRS  to   testcases/kernel/Makefile. As none of the
other device driver test cases follow this Makefile approach, the
build breaks .

>
>> diff -purN
>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
>> ---
>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
>> 1970-01-01 05:30:00.000000000 +0530
>> +++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
>>    2010-02-24 14:34:01.000000000 +0530
>> @@ -0,0 +1,29 @@
>> +test_rtc.c : Test the Real Time Clock driver
>> +
>> +Tests supported as of now
>> +--------------------------
>> +1. Read test : This reads the time/date from the RTC
>> +   ioctls tested :- RTC_RD_TIME.
>> +
>> +2. Alarm Test: Sets the alarm to 5 seconds in future and makes sure it
>> rings.
>> +   ioctls tested :- RTC_ALM_SET, RTC_ALM_READ,  RTC_AIE_ON, RTC_AIE_OFF.
>> +
>> +3. Update interrupts test : Sets Update interrupts enable on, waits for
>> five
>> +   interrupts and then turns it off.
>> +   ioctls tested :- RTC_UIE_ON, RTC_UIE_OFF.
>> +
>> +
>> +How to Build
>> +------------
>> +
>> +Enter rtc directory and issue a 'make' .
>> +
>> +How to Run
>> +----------
>> +
>> +       The tests assume the rtc device node to be "/dev/rtc". If you have
>> a
>> +different node run the test with the name of the node as a parameter.
>> +
>> +Eg. If your node is /dev/rtc0, then run the test as
>> +
>> +       $ ./rtc-test /dev/rtc0
>> diff -purN
>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/test_rtc.c
>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/test_rtc.c
>> ---
>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/test_rtc.c
>>       1970-01-01 05:30:00.000000000 +0530
>> +++
>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/test_rtc.c
>>    2010-02-24 15:17:59.000000000 +0530
>> @@ -0,0 +1,175 @@
>> +/*   test_rtc.c
>> + *
>> + *   Copyright (c) Larsen & Toubro Infotech Ltd., 2010
>> + *
>> + *   Contact : Silesh C V <Silesh.Vellattu@lntinfotech.com>
>> + *
>> + *   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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
>> USA
>> + *
>> + */
>> +
>> +#include <sys/ioctl.h>
>> +#include <stdio.h>
>> +#include <stdlib.h>
>> +#include <fcntl.h>
>> +#include <unistd.h>
>> +#include <linux/rtc.h>
>> +#include <errno.h>
>> +
>> +int rtc_fd = -1;
>> +
>> +void read_alarm_test(void)
>> +{
>> +       struct rtc_time rtc_tm;
>> +       int ret;
>> +       unsigned long data;
>> +
>> +       printf("\nRTC READ TEST:\n");
>> +
>> +        /*Read RTC Time*/
>> +        ret = ioctl(rtc_fd, RTC_RD_TIME, &rtc_tm);
>> +        if (ret == -1) {
>> +                perror("RTC_RD_TIME ioctl");
>> +                printf("RTC READ TEST Failed\n");
>> +                return;
>> +        }
>> +
>> +        printf("RTC READ TEST Passed");
>> +        printf("\nCurrent RTC date/time is %d-%d-%d, %02d:%02d:%02d.\n",
>> +                rtc_tm.tm_mday, rtc_tm.tm_mon + 1, rtc_tm.tm_year + 1900,
>> +                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
>
> strftime(3) ?


OK. Coming in the next patch.


>
>> +        printf("\nRTC ALARM TEST :\n");
>> +
>> +        /*set Alarm to 5 Seconds*/
>> +        rtc_tm.tm_sec += 5;
>> +        if (rtc_tm.tm_sec >= 60) {
>> +                rtc_tm.tm_sec %= 60;
>> +                rtc_tm.tm_min++;
>> +        }
>> +
>> +        if (rtc_tm.tm_min == 60) {
>> +                rtc_tm.tm_min = 0;
>> +                rtc_tm.tm_hour++;
>> +        }
>> +
>> +        if (rtc_tm.tm_hour == 24)
>> +                rtc_tm.tm_hour = 0;
>> +
>> +       ret = ioctl(rtc_fd, RTC_ALM_SET, &rtc_tm);
>> +        if (ret == -1) {
>> +                perror("RTC_ALM_SET ioctl");
>> +                printf("RTC ALARM TEST Failed\n");
>> +                return;
>> +        }
>> +
>> +        /*Read current alarm time*/
>> +        ret = ioctl(rtc_fd, RTC_ALM_READ, &rtc_tm);
>> +        if (ret == -1) {
>> +                perror("RTC_ALM_READ ioctl");
>> +                printf("RTC ALARM TEST Failed\n");
>> +                return;
>> +        }
>> +
>> +        printf("Alarm time set to %02d:%02d:%02d.\n",
>> +                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
>> +        /* Enable alarm interrupts */
>> +        ret = ioctl(rtc_fd, RTC_AIE_ON, 0);
>> +        if (ret == -1) {
>> +                perror("RTC_AIE_ON ioctl");
>> +                printf("RTC ALARM TEST Failed\n");
>> +                return;
>> +        }
>> +
>> +        printf("Waiting 5 seconds for the alarm...\n");
>> +        ret = read(rtc_fd, &data, sizeof(unsigned long));
>> +        if (ret == -1) {
>> +                perror("read");
>> +                printf("RTC ALARM TEST Failed\n");
>> +                return;
>> +        }
>> +
>> +       printf("Alarm rang.\n");
>> +        /* Disable alarm interrupts */
>> +        ret = ioctl(rtc_fd, RTC_AIE_OFF, 0);
>> +        if (ret == -1) {
>> +                perror("RTC_AIE_OFF ioctl");
>> +                printf("RTC ALARM TEST Failed\n");
>> +                return;
>> +        }
>> +
>> +        printf("RTC ALARM TEST Passed\n");
>> +}
>> +
>> +void update_interrupts_test(void)
>> +{
>> +       int ret, i;
>> +       unsigned long data;
>> +
>> +       printf("\nRTC UPDATE INTERRUPTS TEST :\n");
>> +        /*Turn on update interrupts*/
>> +        ret = ioctl(rtc_fd, RTC_UIE_ON, 0);
>> +        if (ret == -1) {
>> +                perror("RTC_UIE_ON ioctl");
>> +                printf("RTC UPDATE INTERRUPTS TEST Failed\n");
>> +               return;
>> +        }
>> +
>> +        printf("Waiting for  5 update interrupts...\n");
>> +        for (i = 1; i < 6; i++) {
>> +                ret = read(rtc_fd, &data, sizeof(unsigned long));
>> +                if (ret == -1) {
>> +                        perror("read");
>> +                        printf("RTC UPDATE INTERRUPTS TEST Failed\n");
>> +                        return;
>> +                }
>> +                printf("Update interrupt %d\n", i);
>> +        }
>> +
>> +         /* Turn off update interrupts */
>> +        ret = ioctl(rtc_fd, RTC_UIE_OFF, 0);
>> +        if (ret == -1) {
>> +                perror("RTC_UIE_OFF ioctl");
>> +                printf("RTC UPDATE INTERRUPTS TEST Failed\n");
>> +                return;
>> +        }
>> +        printf("RTC UPDATE INTERRUPTS TEST Passed\n");
>
> tst_resm(ret == -1 ? TFAIL : TPASS, "RTC update interrupts test %s",
> ret == -1 ? "failed" : "passed");
>

This can be done only when we build the test along with LTP .But as
the problem I mentioned
earlier the device-driver directory is still out of the overall LTP build .

>> +}
>> +
>> +int main(int argc, char **argv)
>> +{
>> +       char *rtc_dev = "/dev/rtc"
>> +
>> +
>> +       if (argc == 2)
>> +               rtc_dev = argv[1];
>> +
>> +       rtc_fd = open(rtc_dev, O_RDONLY);
>> +       if (rtc_fd < 0) {
>> +               perror(rtc_dev);
>
> tst_brkm(TBROK | TERRNO, tst_exit, "couldn't open %s", rtc_dev);

Same here.

>
>> +               exit(errno);
>> +       }
>> +
>> +       /*Read and alarm tests*/
>> +       read_alarm_test();
>> +
>> +       /*Update interrupts test*/
>> +       update_interrupts_test();
>> +
>> +       close(rtc_fd);
>> +
>> +       printf("\nRTC Tests Done!\n");
>> +       return 0;
>> +}
>
> 1. Please rename the test sourcefile to rtc-test.c because the current
> naming is unnecessarily inconsistent.

OK.

> 2. Please replace printfs with tst_res(3) calls so this can be
> properly integrated into LTP.

Same issue as I explained earlier.

>
> Thanks!
> -Garrett

Thanks,

Silesh.

>
>> --
>> test log
>> ------------------------------
>> RTC READ TEST:
>> RTC READ TEST Passed
>> Current RTC date/time is 24-2-2010, 17:03:05.
>>
>> RTC ALARM TEST :
>> Alarm time set to 17:03:10.
>> Waiting 5 seconds for the alarm...
>> Alarm rang.
>> RTC ALARM TEST Passed
>>
>> RTC UPDATE INTERRUPTS TEST :
>> Waiting for  5 update interrupts...
>> Update interrupt 1
>> Update interrupt 2
>> Update interrupt 3
>> Update interrupt 4
>> Update interrupt 5
>> RTC UPDATE INTERRUPTS TEST Passed
>>
>> RTC Tests Done!
>> ---------------------------------------------------------
>>
>>
>> Thanks .
>> Silesh
>>
>>
>> ------------------------------------------------------------------------------
>> Download Intel&#174; Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Ltp-list mailing list
>> Ltp-list@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ltp-list
>>
>>
>


-- 
Silesh

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH][RESEND] RTC Device Driver Tests
  2010-02-25  6:40   ` Silesh C V
@ 2010-02-25  7:07     ` Garrett Cooper
  2010-02-25  7:11       ` Garrett Cooper
  0 siblings, 1 reply; 18+ messages in thread
From: Garrett Cooper @ 2010-02-25  7:07 UTC (permalink / raw)
  To: Silesh C V; +Cc: ltp-list, Arun.sudhilal, Mohamed.Rasheed

On Wed, Feb 24, 2010 at 10:40 PM, Silesh C V <saileshcv@gmail.com> wrote:
> Hi Garrett,
>
> Thanks for the review and suggestions.
>
> On 2/25/10, Garrett Cooper <yanegomi@gmail.com> wrote:
>> On Wed, Feb 24, 2010 at 4:10 AM, Silesh C V <saileshcv@gmail.com> wrote:
>>>
>>> Hi ,
>>>
>>> This patch contains tests for the linux RTC driver.The patch is taken
>>> against feb intermediate release.I have also attached the patch.Please
>>> find
>>> the test log at the end of this mail.Build/Run instructions are explained
>>> in
>>> the README.
>>>
>>>
>>> Signed-off-By: Silesh C V <Silesh.Vellattu@lntinfotech.com>
>>> --
>>> diff -purN ltp-intermediate-20100228.
>>> orig/testcases/kernel/device-drivers/rtc/Makefile
>>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
>>> ---
>>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/Makefile
>>> 1970-01-01 05:30:00.000000000 +0530
>>> +++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
>>>    2010-02-24 15:21:33.000000000 +0530
>>> @@ -0,0 +1,28 @@
>>> +#
>>> +#  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 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
>>> +SRC = test_rtc.c
>>> +
>>> +
>>> +all: $(SRC)
>>> +       $(CC) $(CFLAGS) $(SRC) -o rtc-test
>>> +
>>> +clean:
>>> +       rm -f rtc-test
>>
>> Please integrate into the Makefile infrastructure. See README.mk-devel
>> for more details.
>
> I can see that under kernel/ directory, the device-drivers  directory
> does not follow the new Makefile infrastructure. I tried adding
> device-drivers SUBDIRS  to   testcases/kernel/Makefile. As none of the
> other device driver test cases follow this Makefile approach, the
> build breaks .

Because those are kernel modules, and don't yet have an appropriate
template for LTP with the new Makefile infrastructure. Your test uses
straight ioctl(2) calls and doesn't need to be built with kernel
sources, s.t. it can be built perfectly fine within the new makefile
infrastructure.

>>> diff -purN
>>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
>>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
>>> ---
>>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
>>> 1970-01-01 05:30:00.000000000 +0530
>>> +++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
>>>    2010-02-24 14:34:01.000000000 +0530
>>> @@ -0,0 +1,29 @@
>>> +test_rtc.c : Test the Real Time Clock driver
>>> +
>>> +Tests supported as of now
>>> +--------------------------
>>> +1. Read test : This reads the time/date from the RTC
>>> +   ioctls tested :- RTC_RD_TIME.
>>> +
>>> +2. Alarm Test: Sets the alarm to 5 seconds in future and makes sure it
>>> rings.
>>> +   ioctls tested :- RTC_ALM_SET, RTC_ALM_READ,  RTC_AIE_ON, RTC_AIE_OFF.
>>> +
>>> +3. Update interrupts test : Sets Update interrupts enable on, waits for
>>> five
>>> +   interrupts and then turns it off.
>>> +   ioctls tested :- RTC_UIE_ON, RTC_UIE_OFF.
>>> +
>>> +
>>> +How to Build
>>> +------------
>>> +
>>> +Enter rtc directory and issue a 'make' .
>>> +
>>> +How to Run
>>> +----------
>>> +
>>> +       The tests assume the rtc device node to be "/dev/rtc". If you have
>>> a
>>> +different node run the test with the name of the node as a parameter.
>>> +
>>> +Eg. If your node is /dev/rtc0, then run the test as
>>> +
>>> +       $ ./rtc-test /dev/rtc0
>>> diff -purN
>>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/test_rtc.c
>>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/test_rtc.c
>>> ---
>>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/test_rtc.c
>>>       1970-01-01 05:30:00.000000000 +0530
>>> +++
>>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/test_rtc.c
>>>    2010-02-24 15:17:59.000000000 +0530
>>> @@ -0,0 +1,175 @@
>>> +/*   test_rtc.c
>>> + *
>>> + *   Copyright (c) Larsen & Toubro Infotech Ltd., 2010
>>> + *
>>> + *   Contact : Silesh C V <Silesh.Vellattu@lntinfotech.com>
>>> + *
>>> + *   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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
>>> USA
>>> + *
>>> + */
>>> +
>>> +#include <sys/ioctl.h>
>>> +#include <stdio.h>
>>> +#include <stdlib.h>
>>> +#include <fcntl.h>
>>> +#include <unistd.h>
>>> +#include <linux/rtc.h>
>>> +#include <errno.h>
>>> +
>>> +int rtc_fd = -1;
>>> +
>>> +void read_alarm_test(void)
>>> +{
>>> +       struct rtc_time rtc_tm;
>>> +       int ret;
>>> +       unsigned long data;
>>> +
>>> +       printf("\nRTC READ TEST:\n");
>>> +
>>> +        /*Read RTC Time*/
>>> +        ret = ioctl(rtc_fd, RTC_RD_TIME, &rtc_tm);
>>> +        if (ret == -1) {
>>> +                perror("RTC_RD_TIME ioctl");
>>> +                printf("RTC READ TEST Failed\n");
>>> +                return;
>>> +        }
>>> +
>>> +        printf("RTC READ TEST Passed");
>>> +        printf("\nCurrent RTC date/time is %d-%d-%d, %02d:%02d:%02d.\n",
>>> +                rtc_tm.tm_mday, rtc_tm.tm_mon + 1, rtc_tm.tm_year + 1900,
>>> +                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
>>
>> strftime(3) ?
>
>
> OK. Coming in the next patch.

Awesome :).

>>> +        printf("\nRTC ALARM TEST :\n");
>>> +
>>> +        /*set Alarm to 5 Seconds*/
>>> +        rtc_tm.tm_sec += 5;
>>> +        if (rtc_tm.tm_sec >= 60) {
>>> +                rtc_tm.tm_sec %= 60;
>>> +                rtc_tm.tm_min++;
>>> +        }
>>> +
>>> +        if (rtc_tm.tm_min == 60) {
>>> +                rtc_tm.tm_min = 0;
>>> +                rtc_tm.tm_hour++;
>>> +        }
>>> +
>>> +        if (rtc_tm.tm_hour == 24)
>>> +                rtc_tm.tm_hour = 0;
>>> +
>>> +       ret = ioctl(rtc_fd, RTC_ALM_SET, &rtc_tm);
>>> +        if (ret == -1) {
>>> +                perror("RTC_ALM_SET ioctl");
>>> +                printf("RTC ALARM TEST Failed\n");
>>> +                return;
>>> +        }
>>> +
>>> +        /*Read current alarm time*/
>>> +        ret = ioctl(rtc_fd, RTC_ALM_READ, &rtc_tm);
>>> +        if (ret == -1) {
>>> +                perror("RTC_ALM_READ ioctl");
>>> +                printf("RTC ALARM TEST Failed\n");
>>> +                return;
>>> +        }
>>> +
>>> +        printf("Alarm time set to %02d:%02d:%02d.\n",
>>> +                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
>>> +        /* Enable alarm interrupts */
>>> +        ret = ioctl(rtc_fd, RTC_AIE_ON, 0);
>>> +        if (ret == -1) {
>>> +                perror("RTC_AIE_ON ioctl");
>>> +                printf("RTC ALARM TEST Failed\n");
>>> +                return;
>>> +        }
>>> +
>>> +        printf("Waiting 5 seconds for the alarm...\n");
>>> +        ret = read(rtc_fd, &data, sizeof(unsigned long));
>>> +        if (ret == -1) {
>>> +                perror("read");
>>> +                printf("RTC ALARM TEST Failed\n");
>>> +                return;
>>> +        }
>>> +
>>> +       printf("Alarm rang.\n");
>>> +        /* Disable alarm interrupts */
>>> +        ret = ioctl(rtc_fd, RTC_AIE_OFF, 0);
>>> +        if (ret == -1) {
>>> +                perror("RTC_AIE_OFF ioctl");
>>> +                printf("RTC ALARM TEST Failed\n");
>>> +                return;
>>> +        }
>>> +
>>> +        printf("RTC ALARM TEST Passed\n");
>>> +}
>>> +
>>> +void update_interrupts_test(void)
>>> +{
>>> +       int ret, i;
>>> +       unsigned long data;
>>> +
>>> +       printf("\nRTC UPDATE INTERRUPTS TEST :\n");
>>> +        /*Turn on update interrupts*/
>>> +        ret = ioctl(rtc_fd, RTC_UIE_ON, 0);
>>> +        if (ret == -1) {
>>> +                perror("RTC_UIE_ON ioctl");
>>> +                printf("RTC UPDATE INTERRUPTS TEST Failed\n");
>>> +               return;
>>> +        }
>>> +
>>> +        printf("Waiting for  5 update interrupts...\n");
>>> +        for (i = 1; i < 6; i++) {
>>> +                ret = read(rtc_fd, &data, sizeof(unsigned long));
>>> +                if (ret == -1) {
>>> +                        perror("read");
>>> +                        printf("RTC UPDATE INTERRUPTS TEST Failed\n");
>>> +                        return;
>>> +                }
>>> +                printf("Update interrupt %d\n", i);
>>> +        }
>>> +
>>> +         /* Turn off update interrupts */
>>> +        ret = ioctl(rtc_fd, RTC_UIE_OFF, 0);
>>> +        if (ret == -1) {
>>> +                perror("RTC_UIE_OFF ioctl");
>>> +                printf("RTC UPDATE INTERRUPTS TEST Failed\n");
>>> +                return;
>>> +        }
>>> +        printf("RTC UPDATE INTERRUPTS TEST Passed\n");
>>
>> tst_resm(ret == -1 ? TFAIL : TPASS, "RTC update interrupts test %s",
>> ret == -1 ? "failed" : "passed");
>>
>
> This can be done only when we build the test along with LTP .But as
> the problem I mentioned
> earlier the device-driver directory is still out of the overall LTP build .

As said before, getting this in the standard build is trivial and the
other pieces aren't in the standard build because of the reasons I
mentioned earlier.

>>> +}
>>> +
>>> +int main(int argc, char **argv)
>>> +{
>>> +       char *rtc_dev = "/dev/rtc"
>>> +
>>> +
>>> +       if (argc == 2)
>>> +               rtc_dev = argv[1];
>>> +
>>> +       rtc_fd = open(rtc_dev, O_RDONLY);
>>> +       if (rtc_fd < 0) {
>>> +               perror(rtc_dev);
>>
>> tst_brkm(TBROK | TERRNO, tst_exit, "couldn't open %s", rtc_dev);
>
> Same here.
>
>>
>>> +               exit(errno);
>>> +       }
>>> +
>>> +       /*Read and alarm tests*/
>>> +       read_alarm_test();
>>> +
>>> +       /*Update interrupts test*/
>>> +       update_interrupts_test();
>>> +
>>> +       close(rtc_fd);
>>> +
>>> +       printf("\nRTC Tests Done!\n");
>>> +       return 0;
>>> +}
>>
>> 1. Please rename the test sourcefile to rtc-test.c because the current
>> naming is unnecessarily inconsistent.
>
> OK.
>
>> 2. Please replace printfs with tst_res(3) calls so this can be
>> properly integrated into LTP.
>
> Same issue as I explained earlier.
>
>>
>> Thanks!
>> -Garrett
>
> Thanks,
>
> Silesh.
>
>>
>>> --
>>> test log
>>> ------------------------------
>>> RTC READ TEST:
>>> RTC READ TEST Passed
>>> Current RTC date/time is 24-2-2010, 17:03:05.
>>>
>>> RTC ALARM TEST :
>>> Alarm time set to 17:03:10.
>>> Waiting 5 seconds for the alarm...
>>> Alarm rang.
>>> RTC ALARM TEST Passed
>>>
>>> RTC UPDATE INTERRUPTS TEST :
>>> Waiting for  5 update interrupts...
>>> Update interrupt 1
>>> Update interrupt 2
>>> Update interrupt 3
>>> Update interrupt 4
>>> Update interrupt 5
>>> RTC UPDATE INTERRUPTS TEST Passed
>>>
>>> RTC Tests Done!

    The end goal is to have these tests fit directly into LTP without
having to fudge around writing a secondary driver, thus maintaining
two pieces of dependent code [which is of course more complicated than
one piece of code], and thus is more of a pain to maintain longterm.
There's a lot of code in the repository like this that was ported and
subsequently not properly adapted to the existing infrastructure, thus
creating additional headache for maintainers and end-users.
Thanks!
-Garrett

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH][RESEND] RTC Device Driver Tests
  2010-02-25  7:07     ` Garrett Cooper
@ 2010-02-25  7:11       ` Garrett Cooper
  2010-02-25  9:09         ` Silesh C V
  0 siblings, 1 reply; 18+ messages in thread
From: Garrett Cooper @ 2010-02-25  7:11 UTC (permalink / raw)
  To: Silesh C V; +Cc: ltp-list, Arun.sudhilal, Mohamed.Rasheed

On Wed, Feb 24, 2010 at 11:07 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
> On Wed, Feb 24, 2010 at 10:40 PM, Silesh C V <saileshcv@gmail.com> wrote:
>> Hi Garrett,
>>
>> Thanks for the review and suggestions.
>>
>> On 2/25/10, Garrett Cooper <yanegomi@gmail.com> wrote:
>>> On Wed, Feb 24, 2010 at 4:10 AM, Silesh C V <saileshcv@gmail.com> wrote:
>>>>
>>>> Hi ,
>>>>
>>>> This patch contains tests for the linux RTC driver.The patch is taken
>>>> against feb intermediate release.I have also attached the patch.Please
>>>> find
>>>> the test log at the end of this mail.Build/Run instructions are explained
>>>> in
>>>> the README.
>>>>
>>>>
>>>> Signed-off-By: Silesh C V <Silesh.Vellattu@lntinfotech.com>
>>>> --
>>>> diff -purN ltp-intermediate-20100228.
>>>> orig/testcases/kernel/device-drivers/rtc/Makefile
>>>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
>>>> ---
>>>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/Makefile
>>>> 1970-01-01 05:30:00.000000000 +0530
>>>> +++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
>>>>    2010-02-24 15:21:33.000000000 +0530
>>>> @@ -0,0 +1,28 @@
>>>> +#
>>>> +#  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 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
>>>> +SRC = test_rtc.c
>>>> +
>>>> +
>>>> +all: $(SRC)
>>>> +       $(CC) $(CFLAGS) $(SRC) -o rtc-test
>>>> +
>>>> +clean:
>>>> +       rm -f rtc-test
>>>
>>> Please integrate into the Makefile infrastructure. See README.mk-devel
>>> for more details.
>>
>> I can see that under kernel/ directory, the device-drivers  directory
>> does not follow the new Makefile infrastructure. I tried adding
>> device-drivers SUBDIRS  to   testcases/kernel/Makefile. As none of the
>> other device driver test cases follow this Makefile approach, the
>> build breaks .
>
> Because those are kernel modules, and don't yet have an appropriate
> template for LTP with the new Makefile infrastructure. Your test uses
> straight ioctl(2) calls and doesn't need to be built with kernel
> sources, s.t. it can be built perfectly fine within the new makefile
> infrastructure.
>
>>>> diff -purN
>>>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
>>>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
>>>> ---
>>>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
>>>> 1970-01-01 05:30:00.000000000 +0530
>>>> +++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
>>>>    2010-02-24 14:34:01.000000000 +0530
>>>> @@ -0,0 +1,29 @@
>>>> +test_rtc.c : Test the Real Time Clock driver
>>>> +
>>>> +Tests supported as of now
>>>> +--------------------------
>>>> +1. Read test : This reads the time/date from the RTC
>>>> +   ioctls tested :- RTC_RD_TIME.
>>>> +
>>>> +2. Alarm Test: Sets the alarm to 5 seconds in future and makes sure it
>>>> rings.
>>>> +   ioctls tested :- RTC_ALM_SET, RTC_ALM_READ,  RTC_AIE_ON, RTC_AIE_OFF.
>>>> +
>>>> +3. Update interrupts test : Sets Update interrupts enable on, waits for
>>>> five
>>>> +   interrupts and then turns it off.
>>>> +   ioctls tested :- RTC_UIE_ON, RTC_UIE_OFF.
>>>> +
>>>> +
>>>> +How to Build
>>>> +------------
>>>> +
>>>> +Enter rtc directory and issue a 'make' .
>>>> +
>>>> +How to Run
>>>> +----------
>>>> +
>>>> +       The tests assume the rtc device node to be "/dev/rtc". If you have
>>>> a
>>>> +different node run the test with the name of the node as a parameter.
>>>> +
>>>> +Eg. If your node is /dev/rtc0, then run the test as
>>>> +
>>>> +       $ ./rtc-test /dev/rtc0
>>>> diff -purN
>>>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/test_rtc.c
>>>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/test_rtc.c
>>>> ---
>>>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/test_rtc.c
>>>>       1970-01-01 05:30:00.000000000 +0530
>>>> +++
>>>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/test_rtc.c
>>>>    2010-02-24 15:17:59.000000000 +0530
>>>> @@ -0,0 +1,175 @@
>>>> +/*   test_rtc.c
>>>> + *
>>>> + *   Copyright (c) Larsen & Toubro Infotech Ltd., 2010
>>>> + *
>>>> + *   Contact : Silesh C V <Silesh.Vellattu@lntinfotech.com>
>>>> + *
>>>> + *   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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
>>>> USA
>>>> + *
>>>> + */
>>>> +
>>>> +#include <sys/ioctl.h>
>>>> +#include <stdio.h>
>>>> +#include <stdlib.h>
>>>> +#include <fcntl.h>
>>>> +#include <unistd.h>
>>>> +#include <linux/rtc.h>
>>>> +#include <errno.h>
>>>> +
>>>> +int rtc_fd = -1;
>>>> +
>>>> +void read_alarm_test(void)
>>>> +{
>>>> +       struct rtc_time rtc_tm;
>>>> +       int ret;
>>>> +       unsigned long data;
>>>> +
>>>> +       printf("\nRTC READ TEST:\n");
>>>> +
>>>> +        /*Read RTC Time*/
>>>> +        ret = ioctl(rtc_fd, RTC_RD_TIME, &rtc_tm);
>>>> +        if (ret == -1) {
>>>> +                perror("RTC_RD_TIME ioctl");
>>>> +                printf("RTC READ TEST Failed\n");
>>>> +                return;
>>>> +        }
>>>> +
>>>> +        printf("RTC READ TEST Passed");
>>>> +        printf("\nCurrent RTC date/time is %d-%d-%d, %02d:%02d:%02d.\n",
>>>> +                rtc_tm.tm_mday, rtc_tm.tm_mon + 1, rtc_tm.tm_year + 1900,
>>>> +                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
>>>
>>> strftime(3) ?
>>
>>
>> OK. Coming in the next patch.
>
> Awesome :).
>
>>>> +        printf("\nRTC ALARM TEST :\n");
>>>> +
>>>> +        /*set Alarm to 5 Seconds*/
>>>> +        rtc_tm.tm_sec += 5;
>>>> +        if (rtc_tm.tm_sec >= 60) {
>>>> +                rtc_tm.tm_sec %= 60;
>>>> +                rtc_tm.tm_min++;
>>>> +        }
>>>> +
>>>> +        if (rtc_tm.tm_min == 60) {
>>>> +                rtc_tm.tm_min = 0;
>>>> +                rtc_tm.tm_hour++;
>>>> +        }
>>>> +
>>>> +        if (rtc_tm.tm_hour == 24)
>>>> +                rtc_tm.tm_hour = 0;
>>>> +
>>>> +       ret = ioctl(rtc_fd, RTC_ALM_SET, &rtc_tm);
>>>> +        if (ret == -1) {
>>>> +                perror("RTC_ALM_SET ioctl");
>>>> +                printf("RTC ALARM TEST Failed\n");
>>>> +                return;
>>>> +        }
>>>> +
>>>> +        /*Read current alarm time*/
>>>> +        ret = ioctl(rtc_fd, RTC_ALM_READ, &rtc_tm);
>>>> +        if (ret == -1) {
>>>> +                perror("RTC_ALM_READ ioctl");
>>>> +                printf("RTC ALARM TEST Failed\n");
>>>> +                return;
>>>> +        }
>>>> +
>>>> +        printf("Alarm time set to %02d:%02d:%02d.\n",
>>>> +                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
>>>> +        /* Enable alarm interrupts */
>>>> +        ret = ioctl(rtc_fd, RTC_AIE_ON, 0);
>>>> +        if (ret == -1) {
>>>> +                perror("RTC_AIE_ON ioctl");
>>>> +                printf("RTC ALARM TEST Failed\n");
>>>> +                return;
>>>> +        }
>>>> +
>>>> +        printf("Waiting 5 seconds for the alarm...\n");
>>>> +        ret = read(rtc_fd, &data, sizeof(unsigned long));
>>>> +        if (ret == -1) {
>>>> +                perror("read");
>>>> +                printf("RTC ALARM TEST Failed\n");
>>>> +                return;
>>>> +        }
>>>> +
>>>> +       printf("Alarm rang.\n");
>>>> +        /* Disable alarm interrupts */
>>>> +        ret = ioctl(rtc_fd, RTC_AIE_OFF, 0);
>>>> +        if (ret == -1) {
>>>> +                perror("RTC_AIE_OFF ioctl");
>>>> +                printf("RTC ALARM TEST Failed\n");
>>>> +                return;
>>>> +        }
>>>> +
>>>> +        printf("RTC ALARM TEST Passed\n");
>>>> +}
>>>> +
>>>> +void update_interrupts_test(void)
>>>> +{
>>>> +       int ret, i;
>>>> +       unsigned long data;
>>>> +
>>>> +       printf("\nRTC UPDATE INTERRUPTS TEST :\n");
>>>> +        /*Turn on update interrupts*/
>>>> +        ret = ioctl(rtc_fd, RTC_UIE_ON, 0);
>>>> +        if (ret == -1) {
>>>> +                perror("RTC_UIE_ON ioctl");
>>>> +                printf("RTC UPDATE INTERRUPTS TEST Failed\n");
>>>> +               return;
>>>> +        }
>>>> +
>>>> +        printf("Waiting for  5 update interrupts...\n");
>>>> +        for (i = 1; i < 6; i++) {
>>>> +                ret = read(rtc_fd, &data, sizeof(unsigned long));
>>>> +                if (ret == -1) {
>>>> +                        perror("read");
>>>> +                        printf("RTC UPDATE INTERRUPTS TEST Failed\n");
>>>> +                        return;
>>>> +                }
>>>> +                printf("Update interrupt %d\n", i);
>>>> +        }
>>>> +
>>>> +         /* Turn off update interrupts */
>>>> +        ret = ioctl(rtc_fd, RTC_UIE_OFF, 0);
>>>> +        if (ret == -1) {
>>>> +                perror("RTC_UIE_OFF ioctl");
>>>> +                printf("RTC UPDATE INTERRUPTS TEST Failed\n");
>>>> +                return;
>>>> +        }
>>>> +        printf("RTC UPDATE INTERRUPTS TEST Passed\n");
>>>
>>> tst_resm(ret == -1 ? TFAIL : TPASS, "RTC update interrupts test %s",
>>> ret == -1 ? "failed" : "passed");
>>>
>>
>> This can be done only when we build the test along with LTP .But as
>> the problem I mentioned
>> earlier the device-driver directory is still out of the overall LTP build .
>
> As said before, getting this in the standard build is trivial and the
> other pieces aren't in the standard build because of the reasons I
> mentioned earlier.
>
>>>> +}
>>>> +
>>>> +int main(int argc, char **argv)
>>>> +{
>>>> +       char *rtc_dev = "/dev/rtc"
>>>> +
>>>> +
>>>> +       if (argc == 2)
>>>> +               rtc_dev = argv[1];
>>>> +
>>>> +       rtc_fd = open(rtc_dev, O_RDONLY);
>>>> +       if (rtc_fd < 0) {
>>>> +               perror(rtc_dev);
>>>
>>> tst_brkm(TBROK | TERRNO, tst_exit, "couldn't open %s", rtc_dev);
>>
>> Same here.
>>
>>>
>>>> +               exit(errno);
>>>> +       }
>>>> +
>>>> +       /*Read and alarm tests*/
>>>> +       read_alarm_test();
>>>> +
>>>> +       /*Update interrupts test*/
>>>> +       update_interrupts_test();
>>>> +
>>>> +       close(rtc_fd);
>>>> +
>>>> +       printf("\nRTC Tests Done!\n");
>>>> +       return 0;
>>>> +}
>>>
>>> 1. Please rename the test sourcefile to rtc-test.c because the current
>>> naming is unnecessarily inconsistent.
>>
>> OK.
>>
>>> 2. Please replace printfs with tst_res(3) calls so this can be
>>> properly integrated into LTP.
>>
>> Same issue as I explained earlier.
>>
>>>
>>> Thanks!
>>> -Garrett
>>
>> Thanks,
>>
>> Silesh.
>>
>>>
>>>> --
>>>> test log
>>>> ------------------------------
>>>> RTC READ TEST:
>>>> RTC READ TEST Passed
>>>> Current RTC date/time is 24-2-2010, 17:03:05.
>>>>
>>>> RTC ALARM TEST :
>>>> Alarm time set to 17:03:10.
>>>> Waiting 5 seconds for the alarm...
>>>> Alarm rang.
>>>> RTC ALARM TEST Passed
>>>>
>>>> RTC UPDATE INTERRUPTS TEST :
>>>> Waiting for  5 update interrupts...
>>>> Update interrupt 1
>>>> Update interrupt 2
>>>> Update interrupt 3
>>>> Update interrupt 4
>>>> Update interrupt 5
>>>> RTC UPDATE INTERRUPTS TEST Passed
>>>>
>>>> RTC Tests Done!
>
>    The end goal is to have these tests fit directly into LTP without
> having to fudge around writing a secondary driver, thus maintaining
> two pieces of dependent code [which is of course more complicated than
> one piece of code], and thus is more of a pain to maintain longterm.
> There's a lot of code in the repository like this that was ported and
> subsequently not properly adapted to the existing infrastructure, thus
> creating additional headache for maintainers and end-users.

Ok -- I take that back. I have no idea wtf is going on in this
directory nor the ultimate intent of the tests in here, apart from
being a lot of ad hoc pain in the arse-ness.

I've learned enough to keep my hands off this because it looks like a mess.

Thanks,
-Garrett

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH][RESEND] RTC Device Driver Tests
  2010-02-25  7:11       ` Garrett Cooper
@ 2010-02-25  9:09         ` Silesh C V
  2010-02-25  9:33           ` Rishikesh K Rajak
  0 siblings, 1 reply; 18+ messages in thread
From: Silesh C V @ 2010-02-25  9:09 UTC (permalink / raw)
  To: Garrett Cooper, subrata; +Cc: ltp-list, Arun.sudhilal, Mohamed.Rasheed

On 2/25/10, Garrett Cooper <yanegomi@gmail.com> wrote:
> On Wed, Feb 24, 2010 at 11:07 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
>> On Wed, Feb 24, 2010 at 10:40 PM, Silesh C V <saileshcv@gmail.com> wrote:
>>> Hi Garrett,
>>>
>>> Thanks for the review and suggestions.
>>>
>>> On 2/25/10, Garrett Cooper <yanegomi@gmail.com> wrote:
>>>> On Wed, Feb 24, 2010 at 4:10 AM, Silesh C V <saileshcv@gmail.com> wrote:
>>>>>
>>>>> Hi ,
>>>>>
>>>>> This patch contains tests for the linux RTC driver.The patch is taken
>>>>> against feb intermediate release.I have also attached the patch.Please
>>>>> find
>>>>> the test log at the end of this mail.Build/Run instructions are
>>>>> explained
>>>>> in
>>>>> the README.
>>>>>
>>>>>
>>>>> Signed-off-By: Silesh C V <Silesh.Vellattu@lntinfotech.com>
>>>>> --
>>>>> diff -purN ltp-intermediate-20100228.
>>>>> orig/testcases/kernel/device-drivers/rtc/Makefile
>>>>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
>>>>> ---
>>>>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/Makefile
>>>>> 1970-01-01 05:30:00.000000000 +0530
>>>>> +++
>>>>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
>>>>>    2010-02-24 15:21:33.000000000 +0530
>>>>> @@ -0,0 +1,28 @@
>>>>> +#
>>>>> +#  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 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
>>>>> +SRC = test_rtc.c
>>>>> +
>>>>> +
>>>>> +all: $(SRC)
>>>>> +       $(CC) $(CFLAGS) $(SRC) -o rtc-test
>>>>> +
>>>>> +clean:
>>>>> +       rm -f rtc-test
>>>>
>>>> Please integrate into the Makefile infrastructure. See README.mk-devel
>>>> for more details.
>>>
>>> I can see that under kernel/ directory, the device-drivers  directory
>>> does not follow the new Makefile infrastructure. I tried adding
>>> device-drivers SUBDIRS  to   testcases/kernel/Makefile. As none of the
>>> other device driver test cases follow this Makefile approach, the
>>> build breaks .
>>
>> Because those are kernel modules, and don't yet have an appropriate
>> template for LTP with the new Makefile infrastructure. Your test uses
>> straight ioctl(2) calls and doesn't need to be built with kernel
>> sources, s.t. it can be built perfectly fine within the new makefile
>> infrastructure.
>>
>>>>> diff -purN
>>>>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
>>>>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
>>>>> ---
>>>>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
>>>>> 1970-01-01 05:30:00.000000000 +0530
>>>>> +++
>>>>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
>>>>>    2010-02-24 14:34:01.000000000 +0530
>>>>> @@ -0,0 +1,29 @@
>>>>> +test_rtc.c : Test the Real Time Clock driver
>>>>> +
>>>>> +Tests supported as of now
>>>>> +--------------------------
>>>>> +1. Read test : This reads the time/date from the RTC
>>>>> +   ioctls tested :- RTC_RD_TIME.
>>>>> +
>>>>> +2. Alarm Test: Sets the alarm to 5 seconds in future and makes sure it
>>>>> rings.
>>>>> +   ioctls tested :- RTC_ALM_SET, RTC_ALM_READ,  RTC_AIE_ON,
>>>>> RTC_AIE_OFF.
>>>>> +
>>>>> +3. Update interrupts test : Sets Update interrupts enable on, waits
>>>>> for
>>>>> five
>>>>> +   interrupts and then turns it off.
>>>>> +   ioctls tested :- RTC_UIE_ON, RTC_UIE_OFF.
>>>>> +
>>>>> +
>>>>> +How to Build
>>>>> +------------
>>>>> +
>>>>> +Enter rtc directory and issue a 'make' .
>>>>> +
>>>>> +How to Run
>>>>> +----------
>>>>> +
>>>>> +       The tests assume the rtc device node to be "/dev/rtc". If you
>>>>> have
>>>>> a
>>>>> +different node run the test with the name of the node as a parameter.
>>>>> +
>>>>> +Eg. If your node is /dev/rtc0, then run the test as
>>>>> +
>>>>> +       $ ./rtc-test /dev/rtc0
>>>>> diff -purN
>>>>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/test_rtc.c
>>>>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/test_rtc.c
>>>>> ---
>>>>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/test_rtc.c
>>>>>       1970-01-01 05:30:00.000000000 +0530
>>>>> +++
>>>>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/test_rtc.c
>>>>>    2010-02-24 15:17:59.000000000 +0530
>>>>> @@ -0,0 +1,175 @@
>>>>> +/*   test_rtc.c
>>>>> + *
>>>>> + *   Copyright (c) Larsen & Toubro Infotech Ltd., 2010
>>>>> + *
>>>>> + *   Contact : Silesh C V <Silesh.Vellattu@lntinfotech.com>
>>>>> + *
>>>>> + *   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 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., 59 Temple Place, Suite 330, Boston, MA
>>>>> 02111-1307
>>>>> USA
>>>>> + *
>>>>> + */
>>>>> +
>>>>> +#include <sys/ioctl.h>
>>>>> +#include <stdio.h>
>>>>> +#include <stdlib.h>
>>>>> +#include <fcntl.h>
>>>>> +#include <unistd.h>
>>>>> +#include <linux/rtc.h>
>>>>> +#include <errno.h>
>>>>> +
>>>>> +int rtc_fd = -1;
>>>>> +
>>>>> +void read_alarm_test(void)
>>>>> +{
>>>>> +       struct rtc_time rtc_tm;
>>>>> +       int ret;
>>>>> +       unsigned long data;
>>>>> +
>>>>> +       printf("\nRTC READ TEST:\n");
>>>>> +
>>>>> +        /*Read RTC Time*/
>>>>> +        ret = ioctl(rtc_fd, RTC_RD_TIME, &rtc_tm);
>>>>> +        if (ret == -1) {
>>>>> +                perror("RTC_RD_TIME ioctl");
>>>>> +                printf("RTC READ TEST Failed\n");
>>>>> +                return;
>>>>> +        }
>>>>> +
>>>>> +        printf("RTC READ TEST Passed");
>>>>> +        printf("\nCurrent RTC date/time is %d-%d-%d,
>>>>> %02d:%02d:%02d.\n",
>>>>> +                rtc_tm.tm_mday, rtc_tm.tm_mon + 1, rtc_tm.tm_year +
>>>>> 1900,
>>>>> +                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
>>>>
>>>> strftime(3) ?
>>>
>>>
>>> OK. Coming in the next patch.
>>
>> Awesome :).
>>
>>>>> +        printf("\nRTC ALARM TEST :\n");
>>>>> +
>>>>> +        /*set Alarm to 5 Seconds*/
>>>>> +        rtc_tm.tm_sec += 5;
>>>>> +        if (rtc_tm.tm_sec >= 60) {
>>>>> +                rtc_tm.tm_sec %= 60;
>>>>> +                rtc_tm.tm_min++;
>>>>> +        }
>>>>> +
>>>>> +        if (rtc_tm.tm_min == 60) {
>>>>> +                rtc_tm.tm_min = 0;
>>>>> +                rtc_tm.tm_hour++;
>>>>> +        }
>>>>> +
>>>>> +        if (rtc_tm.tm_hour == 24)
>>>>> +                rtc_tm.tm_hour = 0;
>>>>> +
>>>>> +       ret = ioctl(rtc_fd, RTC_ALM_SET, &rtc_tm);
>>>>> +        if (ret == -1) {
>>>>> +                perror("RTC_ALM_SET ioctl");
>>>>> +                printf("RTC ALARM TEST Failed\n");
>>>>> +                return;
>>>>> +        }
>>>>> +
>>>>> +        /*Read current alarm time*/
>>>>> +        ret = ioctl(rtc_fd, RTC_ALM_READ, &rtc_tm);
>>>>> +        if (ret == -1) {
>>>>> +                perror("RTC_ALM_READ ioctl");
>>>>> +                printf("RTC ALARM TEST Failed\n");
>>>>> +                return;
>>>>> +        }
>>>>> +
>>>>> +        printf("Alarm time set to %02d:%02d:%02d.\n",
>>>>> +                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
>>>>> +        /* Enable alarm interrupts */
>>>>> +        ret = ioctl(rtc_fd, RTC_AIE_ON, 0);
>>>>> +        if (ret == -1) {
>>>>> +                perror("RTC_AIE_ON ioctl");
>>>>> +                printf("RTC ALARM TEST Failed\n");
>>>>> +                return;
>>>>> +        }
>>>>> +
>>>>> +        printf("Waiting 5 seconds for the alarm...\n");
>>>>> +        ret = read(rtc_fd, &data, sizeof(unsigned long));
>>>>> +        if (ret == -1) {
>>>>> +                perror("read");
>>>>> +                printf("RTC ALARM TEST Failed\n");
>>>>> +                return;
>>>>> +        }
>>>>> +
>>>>> +       printf("Alarm rang.\n");
>>>>> +        /* Disable alarm interrupts */
>>>>> +        ret = ioctl(rtc_fd, RTC_AIE_OFF, 0);
>>>>> +        if (ret == -1) {
>>>>> +                perror("RTC_AIE_OFF ioctl");
>>>>> +                printf("RTC ALARM TEST Failed\n");
>>>>> +                return;
>>>>> +        }
>>>>> +
>>>>> +        printf("RTC ALARM TEST Passed\n");
>>>>> +}
>>>>> +
>>>>> +void update_interrupts_test(void)
>>>>> +{
>>>>> +       int ret, i;
>>>>> +       unsigned long data;
>>>>> +
>>>>> +       printf("\nRTC UPDATE INTERRUPTS TEST :\n");
>>>>> +        /*Turn on update interrupts*/
>>>>> +        ret = ioctl(rtc_fd, RTC_UIE_ON, 0);
>>>>> +        if (ret == -1) {
>>>>> +                perror("RTC_UIE_ON ioctl");
>>>>> +                printf("RTC UPDATE INTERRUPTS TEST Failed\n");
>>>>> +               return;
>>>>> +        }
>>>>> +
>>>>> +        printf("Waiting for  5 update interrupts...\n");
>>>>> +        for (i = 1; i < 6; i++) {
>>>>> +                ret = read(rtc_fd, &data, sizeof(unsigned long));
>>>>> +                if (ret == -1) {
>>>>> +                        perror("read");
>>>>> +                        printf("RTC UPDATE INTERRUPTS TEST Failed\n");
>>>>> +                        return;
>>>>> +                }
>>>>> +                printf("Update interrupt %d\n", i);
>>>>> +        }
>>>>> +
>>>>> +         /* Turn off update interrupts */
>>>>> +        ret = ioctl(rtc_fd, RTC_UIE_OFF, 0);
>>>>> +        if (ret == -1) {
>>>>> +                perror("RTC_UIE_OFF ioctl");
>>>>> +                printf("RTC UPDATE INTERRUPTS TEST Failed\n");
>>>>> +                return;
>>>>> +        }
>>>>> +        printf("RTC UPDATE INTERRUPTS TEST Passed\n");
>>>>
>>>> tst_resm(ret == -1 ? TFAIL : TPASS, "RTC update interrupts test %s",
>>>> ret == -1 ? "failed" : "passed");
>>>>
>>>
>>> This can be done only when we build the test along with LTP .But as
>>> the problem I mentioned
>>> earlier the device-driver directory is still out of the overall LTP build
>>> .
>>
>> As said before, getting this in the standard build is trivial and the
>> other pieces aren't in the standard build because of the reasons I
>> mentioned earlier.
>>
>>>>> +}
>>>>> +
>>>>> +int main(int argc, char **argv)
>>>>> +{
>>>>> +       char *rtc_dev = "/dev/rtc"
>>>>> +
>>>>> +
>>>>> +       if (argc == 2)
>>>>> +               rtc_dev = argv[1];
>>>>> +
>>>>> +       rtc_fd = open(rtc_dev, O_RDONLY);
>>>>> +       if (rtc_fd < 0) {
>>>>> +               perror(rtc_dev);
>>>>
>>>> tst_brkm(TBROK | TERRNO, tst_exit, "couldn't open %s", rtc_dev);
>>>
>>> Same here.
>>>
>>>>
>>>>> +               exit(errno);
>>>>> +       }
>>>>> +
>>>>> +       /*Read and alarm tests*/
>>>>> +       read_alarm_test();
>>>>> +
>>>>> +       /*Update interrupts test*/
>>>>> +       update_interrupts_test();
>>>>> +
>>>>> +       close(rtc_fd);
>>>>> +
>>>>> +       printf("\nRTC Tests Done!\n");
>>>>> +       return 0;
>>>>> +}
>>>>
>>>> 1. Please rename the test sourcefile to rtc-test.c because the current
>>>> naming is unnecessarily inconsistent.
>>>
>>> OK.
>>>
>>>> 2. Please replace printfs with tst_res(3) calls so this can be
>>>> properly integrated into LTP.
>>>
>>> Same issue as I explained earlier.
>>>
>>>>
>>>> Thanks!
>>>> -Garrett
>>>
>>> Thanks,
>>>
>>> Silesh.
>>>
>>>>
>>>>> --
>>>>> test log
>>>>> ------------------------------
>>>>> RTC READ TEST:
>>>>> RTC READ TEST Passed
>>>>> Current RTC date/time is 24-2-2010, 17:03:05.
>>>>>
>>>>> RTC ALARM TEST :
>>>>> Alarm time set to 17:03:10.
>>>>> Waiting 5 seconds for the alarm...
>>>>> Alarm rang.
>>>>> RTC ALARM TEST Passed
>>>>>
>>>>> RTC UPDATE INTERRUPTS TEST :
>>>>> Waiting for  5 update interrupts...
>>>>> Update interrupt 1
>>>>> Update interrupt 2
>>>>> Update interrupt 3
>>>>> Update interrupt 4
>>>>> Update interrupt 5
>>>>> RTC UPDATE INTERRUPTS TEST Passed
>>>>>
>>>>> RTC Tests Done!
>>
>>    The end goal is to have these tests fit directly into LTP without
>> having to fudge around writing a secondary driver, thus maintaining
>> two pieces of dependent code [which is of course more complicated than
>> one piece of code], and thus is more of a pain to maintain longterm.
>> There's a lot of code in the repository like this that was ported and
>> subsequently not properly adapted to the existing infrastructure, thus
>> creating additional headache for maintainers and end-users.
>
> Ok -- I take that back. I have no idea wtf is going on in this
> directory nor the ultimate intent of the tests in here, apart from
> being a lot of ad hoc pain in the arse-ness.

The README in testcases/kernel/device-drivers/ says that these tests
should not be run with the other tests, and they have to be built
separately. I agree that this is because they have a kernel space part
also. But this prevents us from  building  device_driver tests that
have only user space part (as in RTC tests), along with the overall
build. And these tests does not belong in any other directory other
than kernel/device-drivers. So as long as other tests are there we
will have to live with building new device driver tests separately.I
can re-send  the patch with Garrett's suggestions  incorporated.

Subrata, suggestions ?


Thanks,
Silesh
>
> I've learned enough to keep my hands off this because it looks like a mess.
>
> Thanks,
> -Garrett
>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH][RESEND] RTC Device Driver Tests
  2010-02-25  9:09         ` Silesh C V
@ 2010-02-25  9:33           ` Rishikesh K Rajak
  2010-02-25  9:48             ` Garrett Cooper
  0 siblings, 1 reply; 18+ messages in thread
From: Rishikesh K Rajak @ 2010-02-25  9:33 UTC (permalink / raw)
  To: Silesh C V; +Cc: ltp-list, Arun.sudhilal, Mohamed.Rasheed

On Thu, Feb 25, 2010 at 02:39:37PM +0530, Silesh C V wrote:
> >>
> >>    The end goal is to have these tests fit directly into LTP without
> >> having to fudge around writing a secondary driver, thus maintaining
> >> two pieces of dependent code [which is of course more complicated than
> >> one piece of code], and thus is more of a pain to maintain longterm.
> >> There's a lot of code in the repository like this that was ported and
> >> subsequently not properly adapted to the existing infrastructure, thus
> >> creating additional headache for maintainers and end-users.
> >
> > Ok -- I take that back. I have no idea wtf is going on in this
> > directory nor the ultimate intent of the tests in here, apart from
> > being a lot of ad hoc pain in the arse-ness.
> 
> The README in testcases/kernel/device-drivers/ says that these tests
> should not be run with the other tests, and they have to be built
> separately. I agree that this is because they have a kernel space part
> also. But this prevents us from  building  device_driver tests that
> have only user space part (as in RTC tests), along with the overall
> build. And these tests does not belong in any other directory other
> than kernel/device-drivers. So as long as other tests are there we
> will have to live with building new device driver tests separately.I
> can re-send  the patch with Garrett's suggestions  incorporated.
> 
> Subrata, suggestions ?

Hi Silesh,

How about porting this on new makefile infrastructure ? I think this is
time where we can look back and can make one piece of code as garret
said is correct. Please see your fesibility. Let me know if you still
want this to be integrated. Before that can you please little more
descriptive with your patch e,g: what it is doing. 

And also it is always good if you include more documentation for each 
function as coding style suggests.

Thanks
Rishi
> 
> 
> Thanks,
> Silesh
> >
> > I've learned enough to keep my hands off this because it looks like a mess.
> >
> > Thanks,
> > -Garrett
> >

-- 
Thanks & Regards
Rishi
LTP Maintainer
IBM, LTC, Bangalore
Please join IRC #ltp @ irc.freenode.net

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH][RESEND] RTC Device Driver Tests
  2010-02-25  9:33           ` Rishikesh K Rajak
@ 2010-02-25  9:48             ` Garrett Cooper
  2010-02-26  3:06               ` Silesh C V
  0 siblings, 1 reply; 18+ messages in thread
From: Garrett Cooper @ 2010-02-25  9:48 UTC (permalink / raw)
  To: Silesh C V, Garrett Cooper, subrata, ltp-list, Arun.sudhilal,
	Mohamed.Rasheed

On Thu, Feb 25, 2010 at 1:33 AM, Rishikesh K Rajak
<risrajak@linux.vnet.ibm.com> wrote:
> On Thu, Feb 25, 2010 at 02:39:37PM +0530, Silesh C V wrote:
>> >>
>> >>    The end goal is to have these tests fit directly into LTP without
>> >> having to fudge around writing a secondary driver, thus maintaining
>> >> two pieces of dependent code [which is of course more complicated than
>> >> one piece of code], and thus is more of a pain to maintain longterm.
>> >> There's a lot of code in the repository like this that was ported and
>> >> subsequently not properly adapted to the existing infrastructure, thus
>> >> creating additional headache for maintainers and end-users.
>> >
>> > Ok -- I take that back. I have no idea wtf is going on in this
>> > directory nor the ultimate intent of the tests in here, apart from
>> > being a lot of ad hoc pain in the arse-ness.
>>
>> The README in testcases/kernel/device-drivers/ says that these tests
>> should not be run with the other tests, and they have to be built
>> separately. I agree that this is because they have a kernel space part
>> also. But this prevents us from  building  device_driver tests that
>> have only user space part (as in RTC tests), along with the overall
>> build. And these tests does not belong in any other directory other
>> than kernel/device-drivers. So as long as other tests are there we
>> will have to live with building new device driver tests separately.I
>> can re-send  the patch with Garrett's suggestions  incorporated.
>>
>> Subrata, suggestions ?
>
> Hi Silesh,
>
> How about porting this on new makefile infrastructure ? I think this is
> time where we can look back and can make one piece of code as garret
> said is correct. Please see your fesibility. Let me know if you still
> want this to be integrated. Before that can you please little more
> descriptive with your patch e,g: what it is doing.
>
> And also it is always good if you include more documentation for each
> function as coding style suggests.

Regardless of whether or not this can fit within the new makefile
infrastructure -- please at least consider adding in the bits to use
tst_res(3). It will make maintenance considerably easier in the long
run. I can port a Makefile over in < 30 mins -- it's the C code that
I'd have to fumble around with as I'm not the original developer, I
may not understand all the nuances of what's trying to be tested, etc.

More documentation would be extremely helpful, in particular pointers
to additional reference material so that someone who has _zero_
understanding in how the rtc driver typically works in Linux can at
least look up additional materials to develop a better understanding
of what's going on...

>> >
>> > I've learned enough to keep my hands off this because it looks like a mess.

Thanks,
-Garrett

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH][RESEND] RTC Device Driver Tests
  2010-02-25  9:48             ` Garrett Cooper
@ 2010-02-26  3:06               ` Silesh C V
  2010-02-26  4:55                 ` [LTP] [PATCH-v2] " Silesh C V
  0 siblings, 1 reply; 18+ messages in thread
From: Silesh C V @ 2010-02-26  3:06 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list, Arun.sudhilal, Mohamed.Rasheed

On 2/25/10, Garrett Cooper <yanegomi@gmail.com> wrote:
> On Thu, Feb 25, 2010 at 1:33 AM, Rishikesh K Rajak
> <risrajak@linux.vnet.ibm.com> wrote:
>> On Thu, Feb 25, 2010 at 02:39:37PM +0530, Silesh C V wrote:
>>> >>
>>> >>    The end goal is to have these tests fit directly into LTP without
>>> >> having to fudge around writing a secondary driver, thus maintaining
>>> >> two pieces of dependent code [which is of course more complicated than
>>> >> one piece of code], and thus is more of a pain to maintain longterm.
>>> >> There's a lot of code in the repository like this that was ported and
>>> >> subsequently not properly adapted to the existing infrastructure, thus
>>> >> creating additional headache for maintainers and end-users.
>>> >
>>> > Ok -- I take that back. I have no idea wtf is going on in this
>>> > directory nor the ultimate intent of the tests in here, apart from
>>> > being a lot of ad hoc pain in the arse-ness.
>>>
>>> The README in testcases/kernel/device-drivers/ says that these tests
>>> should not be run with the other tests, and they have to be built
>>> separately. I agree that this is because they have a kernel space part
>>> also. But this prevents us from  building  device_driver tests that
>>> have only user space part (as in RTC tests), along with the overall
>>> build. And these tests does not belong in any other directory other
>>> than kernel/device-drivers. So as long as other tests are there we
>>> will have to live with building new device driver tests separately.I
>>> can re-send  the patch with Garrett's suggestions  incorporated.
>>>
>>> Subrata, suggestions ?
>>
>> Hi Silesh,
>>
>> How about porting this on new makefile infrastructure ? I think this is
>> time where we can look back and can make one piece of code as garret
>> said is correct. Please see your fesibility. Let me know if you still
>> want this to be integrated. Before that can you please little more
>> descriptive with your patch e,g: what it is doing.
>>
>> And also it is always good if you include more documentation for each
>> function as coding style suggests.
>
> Regardless of whether or not this can fit within the new makefile
> infrastructure -- please at least consider adding in the bits to use
> tst_res(3).

OK.Coming in the next patch.

It will make maintenance considerably easier in the long
> run. I can port a Makefile over in < 30 mins -- it's the C code that
> I'd have to fumble around with as I'm not the original developer, I
> may not understand all the nuances of what's trying to be tested, etc.
>
> More documentation would be extremely helpful, in particular pointers
> to additional reference material so that someone who has _zero_
> understanding in how the rtc driver typically works in Linux can at
> least look up additional materials to develop a better understanding
> of what's going on...

OK. Coming in the next patch.
>
>>> >
>>> > I've learned enough to keep my hands off this because it looks like a
>>> > mess.
>
> Thanks,
> -Garrett
>

Thanks,
Silesh

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* [LTP] [PATCH-v2] RTC Device Driver Tests
  2010-02-26  3:06               ` Silesh C V
@ 2010-02-26  4:55                 ` Silesh C V
  2010-02-26  5:31                   ` Garrett Cooper
  2010-02-26  5:34                   ` Rishikesh K Rajak
  0 siblings, 2 replies; 18+ messages in thread
From: Silesh C V @ 2010-02-26  4:55 UTC (permalink / raw)
  To: ltp-list; +Cc: Arun.sudhilal, Mohamed.Rasheed


[-- Attachment #1.1: Type: text/plain, Size: 9625 bytes --]

Hi,

Here is the new version of the RTC device driver tests.Although it does not
fall
under the new Make infrastructure,  I have used tst_res APIs. So it should
be easy
to port these tests to the new infrastructure without touching the C file.
Thanks again for the suggestions and review.

Thanks,
Silesh
---
diff -purN ltp-intermediate-20100228.
orig/testcases/kernel/device-drivers/rtc/Makefile
ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
---
ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/Makefile
1970-01-01 05:30:00.000000000 +0530
+++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
   2010-02-25 22:33:40.000000000 +0530
@@ -0,0 +1,29 @@
+#
+#  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 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
+
+
+all: $(SRC)
+       $(CC) $(SRC) $(CFLAGS) $(LIBS) -o rtc-test
+
+clean:
+       rm -f rtc-test
diff -purN
ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
---
ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
1970-01-01 05:30:00.000000000 +0530
+++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
   2010-02-26 13:55:11.000000000 +0530
@@ -0,0 +1,29 @@
+rtc-test.c : Test the Real Time Clock driver
+
+Tests supported as of now
+--------------------------
+1. Read test : This reads the time/date from the RTC
+   ioctls tested :- RTC_RD_TIME.
+
+2. Alarm Test: Sets the alarm to 5 seconds in future and makes sure it
rings.
+   ioctls tested :- RTC_ALM_SET, RTC_ALM_READ,  RTC_AIE_ON, RTC_AIE_OFF.
+
+3. Update interrupts test : Sets Update interrupts enable on, waits for
five
+   interrupts and then turns it off.
+   ioctls tested :- RTC_UIE_ON, RTC_UIE_OFF.
+
+
+How to Build
+------------
+You have to build the complete LTP package before trying to build these
tests.
+After building the complete LTP sources enter this directory and issue a
'make'.
+
+How to Run
+----------
+
+       The tests assume the rtc device node to be "/dev/rtc". If you have a
+different node run the test with the name of the node as a parameter.
+
+Eg. If your node is /dev/rtc0, then run the test as
+
+       $ ./rtc-test /dev/rtc0
diff -purN
ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/rtc-test.c
ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/rtc-test.c
---
ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/rtc-test.c
      1970-01-01 05:30:00.000000000 +0530
+++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/rtc-test.c
   2010-02-26 14:15:21.000000000 +0530
@@ -0,0 +1,192 @@
+/*   rtc-test.c
+ *
+ *   Tests for the Real Time Clock driver.
+ *
+ *   Copyright (c) Larsen & Toubro Infotech Ltd., 2010
+ *
+ *   Author : Silesh C V <Silesh.Vellattu@lntinfotech.com>
+ *
+ *   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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+ */
+
+#include "test.h"
+#include <sys/ioctl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <linux/rtc.h>
+#include <errno.h>
+#include <time.h>
+
+int rtc_fd = -1;
+char *TCID = "rtc01";
+int TST_TOTAL = 3;
+
+
+/* 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
+ * RTC_RD_TIME, RTC_ALM_SET, RTC_ALM_READ, RTC_AIE_OFF  */
+
+void read_alarm_test(void)
+{
+       struct rtc_time rtc_tm;
+       int ret;
+       unsigned long data;
+       char time[35];
+
+       tst_resm(TINFO, "RTC READ TEST:");
+
+        /*Read RTC Time*/
+        ret = ioctl(rtc_fd, RTC_RD_TIME, &rtc_tm);
+        if (ret == -1) {
+                tst_resm(TINFO, "RTC_RD_TIME ioctl failed");
+                tst_resm(TFAIL, "RTC READ TEST Failed ");
+                return;
+        }
+
+        tst_resm(TPASS, "RTC READ TEST Passed");
+
+        strftime(time, sizeof(time), "%D %r", (struct tm *)&rtc_tm);
+
+       tst_resm(TINFO, "Current Date/time is  %s", time);
+
+        tst_resm(TINFO, "RTC ALARM TEST :");
+        /*set Alarm to 5 Seconds*/
+        rtc_tm.tm_sec += 5;
+        if (rtc_tm.tm_sec >= 60) {
+                rtc_tm.tm_sec %= 60;
+                rtc_tm.tm_min++;
+        }
+
+        if (rtc_tm.tm_min == 60) {
+                rtc_tm.tm_min = 0;
+                rtc_tm.tm_hour++;
+        }
+
+        if (rtc_tm.tm_hour == 24)
+                rtc_tm.tm_hour = 0;
+
+       ret = ioctl(rtc_fd, RTC_ALM_SET, &rtc_tm);
+        if (ret == -1) {
+                tst_resm(TINFO, "RTC_ALM_SET ioctl failed");
+                tst_resm(TFAIL, "RTC ALARM TEST Failed");
+                return;
+        }
+
+        /*Read current alarm time*/
+        ret = ioctl(rtc_fd, RTC_ALM_READ, &rtc_tm);
+        if (ret == -1) {
+                tst_resm(TINFO, "RTC_ALM_READ ioctl failed");
+                tst_resm(TFAIL,"RTC ALARM TEST Failed");
+                return;
+        }
+
+        tst_resm(TINFO, "Alarm time set to %02d:%02d:%02d.",
+                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
+        /* Enable alarm interrupts */
+        ret = ioctl(rtc_fd, RTC_AIE_ON, 0);
+        if (ret == -1) {
+                tst_resm(TINFO, "RTC_AIE_ON ioctl failed");
+                tst_resm(TFAIL, "RTC ALARM TEST Failed");
+                return;
+        }
+
+        tst_resm(TINFO, "Waiting 5 seconds for the alarm...");
+        ret = read(rtc_fd, &data, sizeof(unsigned long));
+        if (ret == -1) {
+                tst_resm(TINFO, "read failed");
+                tst_resm(TFAIL, "RTC ALARM TEST Failed");
+                return;
+        }
+
+       tst_resm(TINFO, "Alarm rang.");
+        /* Disable alarm interrupts */
+        ret = ioctl(rtc_fd, RTC_AIE_OFF, 0);
+        if (ret == -1) {
+                tst_resm(TINFO, "RTC_AIE_OFF ioctl failed");
+                tst_resm(TFAIL, "RTC ALARM TEST Failed");
+                return;
+        }
+
+        tst_resm(TPASS, "RTC ALARM TEST Passed");
+}
+
+/* Update_interrupts_test :Once the Update interrupts is enabled,
+ * the RTC gives interrupts (1/sec) on the interrupts line(if the rtc
+ * has one). This is tested by enabling the update interrupts
+ * and then waiting for 5 interrupts.*/
+
+void update_interrupts_test(void)
+{
+       int ret, i;
+       unsigned long data;
+
+       tst_resm(TINFO, "RTC UPDATE INTERRUPTS TEST :");
+        /*Turn on update interrupts*/
+        ret = ioctl(rtc_fd, RTC_UIE_ON, 0);
+        if (ret == -1) {
+                tst_resm(TINFO, "RTC_UIE_ON ioctl failed");
+                tst_resm(TFAIL, "RTC UPDATE INTERRUPTS TEST Failed");
+               return;
+        }
+
+        tst_resm(TINFO, "Waiting for  5 update interrupts...");
+        for (i = 1; i < 6; i++) {
+               /*this read blocks until the interrupt*/
+                ret = read(rtc_fd, &data, sizeof(unsigned long));
+                if (ret == -1) {
+                        tst_resm(TINFO, "read failed");
+                        tst_resm(TFAIL, "RTC UPDATE INTERRUPTS TEST
Failed");
+                        return;
+                }
+                tst_resm(TINFO, "Update interrupt %d", i);
+        }
+
+         /* Turn off update interrupts */
+        ret = ioctl(rtc_fd, RTC_UIE_OFF, 0);
+        if (ret == -1) {
+                tst_resm(TINFO, "RTC_UIE_OFF ioctl failed");
+                tst_resm(TFAIL, "RTC UPDATE INTERRUPTS TEST Failed");
+                return;
+        }
+        tst_resm(TPASS, "RTC UPDATE INTERRUPTS TEST Passed");
+
+}
+
+int main(int argc, char **argv)
+{
+       char *rtc_dev = "/dev/rtc";
+
+       if (argc == 2)
+               rtc_dev = argv[1];
+
+       rtc_fd = open(rtc_dev, O_RDONLY);
+
+       if (rtc_fd < 0)
+               tst_brkm(TBROK | TERRNO, tst_exit, "couldn't open %s",
rtc_dev);
+
+       /*Read and alarm tests*/
+       read_alarm_test();
+
+       /*Update interrupts test*/
+       update_interrupts_test();
+
+       close(rtc_fd);
+
+       tst_resm(TINFO, "RTC Tests Done!");
+       return 0;
+}

--

[-- Attachment #1.2: Type: text/html, Size: 11559 bytes --]

[-- Attachment #2: ltp_rtc.patch --]
[-- Type: application/octet-stream, Size: 9101 bytes --]

diff -purN ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/Makefile ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
--- ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/Makefile	1970-01-01 05:30:00.000000000 +0530
+++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile	2010-02-25 22:33:40.000000000 +0530
@@ -0,0 +1,29 @@
+#
+#  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 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
+
+
+all: $(SRC)
+	$(CC) $(SRC) $(CFLAGS) $(LIBS) -o rtc-test
+
+clean:
+	rm -f rtc-test
diff -purN ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
--- ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README	1970-01-01 05:30:00.000000000 +0530
+++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README	2010-02-26 13:55:11.000000000 +0530
@@ -0,0 +1,29 @@
+rtc-test.c : Test the Real Time Clock driver
+
+Tests supported as of now 
+--------------------------
+1. Read test : This reads the time/date from the RTC 
+   ioctls tested :- RTC_RD_TIME.
+  
+2. Alarm Test: Sets the alarm to 5 seconds in future and makes sure it rings.
+   ioctls tested :- RTC_ALM_SET, RTC_ALM_READ,  RTC_AIE_ON, RTC_AIE_OFF.
+
+3. Update interrupts test : Sets Update interrupts enable on, waits for five 
+   interrupts and then turns it off.
+   ioctls tested :- RTC_UIE_ON, RTC_UIE_OFF.
+
+
+How to Build
+------------
+You have to build the complete LTP package before trying to build these tests.
+After building the complete LTP sources enter this directory and issue a 'make'.
+
+How to Run
+----------
+
+	The tests assume the rtc device node to be "/dev/rtc". If you have a
+different node run the test with the name of the node as a parameter.
+
+Eg. If your node is /dev/rtc0, then run the test as
+
+	$ ./rtc-test /dev/rtc0
diff -purN ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/rtc-test.c ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/rtc-test.c
--- ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/rtc-test.c	1970-01-01 05:30:00.000000000 +0530
+++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/rtc-test.c	2010-02-26 14:15:21.000000000 +0530
@@ -0,0 +1,192 @@
+/*   rtc-test.c 
+ *
+ *   Tests for the Real Time Clock driver.
+ *
+ *   Copyright (c) Larsen & Toubro Infotech Ltd., 2010
+ *   
+ *   Author : Silesh C V <Silesh.Vellattu@lntinfotech.com>
+ *
+ *   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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "test.h"
+#include <sys/ioctl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <linux/rtc.h>
+#include <errno.h>
+#include <time.h>
+
+int rtc_fd = -1;
+char *TCID = "rtc01";
+int TST_TOTAL = 3;
+
+
+/* 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 
+ * RTC_RD_TIME, RTC_ALM_SET, RTC_ALM_READ, RTC_AIE_OFF  */
+
+void read_alarm_test(void)
+{
+	struct rtc_time rtc_tm;
+	int ret;
+	unsigned long data;
+	char time[35];
+
+	tst_resm(TINFO, "RTC READ TEST:");
+
+	 /*Read RTC Time*/
+        ret = ioctl(rtc_fd, RTC_RD_TIME, &rtc_tm);
+        if (ret == -1) {
+                tst_resm(TINFO, "RTC_RD_TIME ioctl failed");
+                tst_resm(TFAIL, "RTC READ TEST Failed ");
+                return;
+        }
+
+        tst_resm(TPASS, "RTC READ TEST Passed");
+
+        strftime(time, sizeof(time), "%D %r", (struct tm *)&rtc_tm); 
+
+	tst_resm(TINFO, "Current Date/time is  %s", time);
+
+        tst_resm(TINFO, "RTC ALARM TEST :");
+        /*set Alarm to 5 Seconds*/
+        rtc_tm.tm_sec += 5;
+        if (rtc_tm.tm_sec >= 60) {
+                rtc_tm.tm_sec %= 60;
+                rtc_tm.tm_min++;
+        }
+
+        if (rtc_tm.tm_min == 60) {
+                rtc_tm.tm_min = 0;
+                rtc_tm.tm_hour++;
+        }
+
+        if (rtc_tm.tm_hour == 24)
+                rtc_tm.tm_hour = 0;
+
+	ret = ioctl(rtc_fd, RTC_ALM_SET, &rtc_tm);
+        if (ret == -1) {
+                tst_resm(TINFO, "RTC_ALM_SET ioctl failed");
+                tst_resm(TFAIL, "RTC ALARM TEST Failed");
+                return;
+        }
+
+        /*Read current alarm time*/
+        ret = ioctl(rtc_fd, RTC_ALM_READ, &rtc_tm);
+        if (ret == -1) {
+                tst_resm(TINFO, "RTC_ALM_READ ioctl failed");
+                tst_resm(TFAIL,"RTC ALARM TEST Failed");
+                return;
+        }
+
+        tst_resm(TINFO, "Alarm time set to %02d:%02d:%02d.",
+                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
+        /* Enable alarm interrupts */
+        ret = ioctl(rtc_fd, RTC_AIE_ON, 0);
+        if (ret == -1) {
+                tst_resm(TINFO, "RTC_AIE_ON ioctl failed");
+                tst_resm(TFAIL, "RTC ALARM TEST Failed");
+                return;
+        }
+
+        tst_resm(TINFO, "Waiting 5 seconds for the alarm...");
+        ret = read(rtc_fd, &data, sizeof(unsigned long));
+        if (ret == -1) {
+                tst_resm(TINFO, "read failed");
+                tst_resm(TFAIL, "RTC ALARM TEST Failed");
+                return;
+        }
+
+	tst_resm(TINFO, "Alarm rang.");
+        /* Disable alarm interrupts */
+        ret = ioctl(rtc_fd, RTC_AIE_OFF, 0);
+        if (ret == -1) {
+                tst_resm(TINFO, "RTC_AIE_OFF ioctl failed");
+                tst_resm(TFAIL, "RTC ALARM TEST Failed");
+                return;
+        }
+
+        tst_resm(TPASS, "RTC ALARM TEST Passed");
+}
+
+/* Update_interrupts_test :Once the Update interrupts is enabled, 
+ * the RTC gives interrupts (1/sec) on the interrupts line(if the rtc 
+ * has one). This is tested by enabling the update interrupts 
+ * and then waiting for 5 interrupts.*/
+
+void update_interrupts_test(void)
+{
+	int ret, i;
+	unsigned long data;
+
+	tst_resm(TINFO, "RTC UPDATE INTERRUPTS TEST :");
+        /*Turn on update interrupts*/
+        ret = ioctl(rtc_fd, RTC_UIE_ON, 0);
+        if (ret == -1) {
+                tst_resm(TINFO, "RTC_UIE_ON ioctl failed");
+                tst_resm(TFAIL, "RTC UPDATE INTERRUPTS TEST Failed");
+		return;
+        }
+
+        tst_resm(TINFO, "Waiting for  5 update interrupts...");
+        for (i = 1; i < 6; i++) {
+		/*this read blocks until the interrupt*/
+                ret = read(rtc_fd, &data, sizeof(unsigned long));
+                if (ret == -1) {
+                        tst_resm(TINFO, "read failed");
+                        tst_resm(TFAIL, "RTC UPDATE INTERRUPTS TEST Failed");
+                        return;
+                }
+                tst_resm(TINFO, "Update interrupt %d", i);
+        }
+
+         /* Turn off update interrupts */
+        ret = ioctl(rtc_fd, RTC_UIE_OFF, 0);
+        if (ret == -1) {
+                tst_resm(TINFO, "RTC_UIE_OFF ioctl failed");
+                tst_resm(TFAIL, "RTC UPDATE INTERRUPTS TEST Failed");
+                return;
+        }
+        tst_resm(TPASS, "RTC UPDATE INTERRUPTS TEST Passed");
+
+}
+
+int main(int argc, char **argv)
+{
+	char *rtc_dev = "/dev/rtc";
+
+	if (argc == 2)
+		rtc_dev = argv[1];
+
+	rtc_fd = open(rtc_dev, O_RDONLY);
+  
+	if (rtc_fd < 0)
+		tst_brkm(TBROK | TERRNO, tst_exit, "couldn't open %s", rtc_dev);
+
+	/*Read and alarm tests*/
+	read_alarm_test();
+
+	/*Update interrupts test*/
+	update_interrupts_test();
+	
+	close(rtc_fd);
+
+	tst_resm(TINFO, "RTC Tests Done!");
+	return 0;
+}

[-- Attachment #3: Type: text/plain, Size: 345 bytes --]

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH-v2] RTC Device Driver Tests
  2010-02-26  4:55                 ` [LTP] [PATCH-v2] " Silesh C V
@ 2010-02-26  5:31                   ` Garrett Cooper
  2010-02-26  6:39                     ` Silesh C V
  2010-02-26  5:34                   ` Rishikesh K Rajak
  1 sibling, 1 reply; 18+ messages in thread
From: Garrett Cooper @ 2010-02-26  5:31 UTC (permalink / raw)
  To: Silesh C V; +Cc: ltp-list, Arun.sudhilal, Mohamed.Rasheed

Much better! Three comments:

On Thu, Feb 25, 2010 at 8:55 PM, Silesh C V <saileshcv@gmail.com> wrote:
> Hi,
>
> Here is the new version of the RTC device driver tests.Although it does not
> fall
> under the new Make infrastructure,  I have used tst_res APIs. So it should
> be easy
> to port these tests to the new infrastructure without touching the C file.
> Thanks again for the suggestions and review.
>
> Thanks,
> Silesh
> ---
> diff -purN ltp-intermediate-20100228.
> orig/testcases/kernel/device-drivers/rtc/Makefile
> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
> ---
> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/Makefile
> 1970-01-01 05:30:00.000000000 +0530
> +++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
>    2010-02-25 22:33:40.000000000 +0530
> @@ -0,0 +1,29 @@
> +#
> +#  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 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
> +
> +
> +all: $(SRC)
> +       $(CC) $(SRC) $(CFLAGS) $(LIBS) -o rtc-test
> +
> +clean:
> +       rm -f rtc-test
> diff -purN
> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
> ---
> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
> 1970-01-01 05:30:00.000000000 +0530
> +++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
>    2010-02-26 13:55:11.000000000 +0530
> @@ -0,0 +1,29 @@
> +rtc-test.c : Test the Real Time Clock driver
> +
> +Tests supported as of now
> +--------------------------
> +1. Read test : This reads the time/date from the RTC
> +   ioctls tested :- RTC_RD_TIME.
> +
> +2. Alarm Test: Sets the alarm to 5 seconds in future and makes sure it
> rings.
> +   ioctls tested :- RTC_ALM_SET, RTC_ALM_READ,  RTC_AIE_ON, RTC_AIE_OFF.
> +
> +3. Update interrupts test : Sets Update interrupts enable on, waits for
> five
> +   interrupts and then turns it off.
> +   ioctls tested :- RTC_UIE_ON, RTC_UIE_OFF.
> +
> +
> +How to Build
> +------------
> +You have to build the complete LTP package before trying to build these
> tests.
> +After building the complete LTP sources enter this directory and issue a
> 'make'.
> +
> +How to Run
> +----------
> +
> +       The tests assume the rtc device node to be "/dev/rtc". If you have a
> +different node run the test with the name of the node as a parameter.
> +
> +Eg. If your node is /dev/rtc0, then run the test as
> +
> +       $ ./rtc-test /dev/rtc0
> diff -purN
> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/rtc-test.c
> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/rtc-test.c
> ---
> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/rtc-test.c
>       1970-01-01 05:30:00.000000000 +0530
> +++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/rtc-test.c
>    2010-02-26 14:15:21.000000000 +0530
> @@ -0,0 +1,192 @@
> +/*   rtc-test.c
> + *
> + *   Tests for the Real Time Clock driver.
> + *
> + *   Copyright (c) Larsen & Toubro Infotech Ltd., 2010
> + *
> + *   Author : Silesh C V <Silesh.Vellattu@lntinfotech.com>
> + *
> + *   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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
> USA
> + */
> +
> +#include "test.h"
> +#include <sys/ioctl.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <fcntl.h>
> +#include <unistd.h>
> +#include <linux/rtc.h>
> +#include <errno.h>
> +#include <time.h>
> +
> +int rtc_fd = -1;
> +char *TCID = "rtc01";
> +int TST_TOTAL = 3;
> +
> +
> +/* 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
> + * RTC_RD_TIME, RTC_ALM_SET, RTC_ALM_READ, RTC_AIE_OFF  */
> +
> +void read_alarm_test(void)
> +{
> +       struct rtc_time rtc_tm;
> +       int ret;
> +       unsigned long data;
> +       char time[35];

Why 35?

> +       tst_resm(TINFO, "RTC READ TEST:");
> +
> +        /*Read RTC Time*/
> +        ret = ioctl(rtc_fd, RTC_RD_TIME, &rtc_tm);
> +        if (ret == -1) {
> +                tst_resm(TINFO, "RTC_RD_TIME ioctl failed");
> +                tst_resm(TFAIL, "RTC READ TEST Failed ");
> +                return;
> +        }
> +
> +        tst_resm(TPASS, "RTC READ TEST Passed");
> +
> +        strftime(time, sizeof(time), "%D %r", (struct tm *)&rtc_tm);
> +
> +       tst_resm(TINFO, "Current Date/time is  %s", time);
> +
> +        tst_resm(TINFO, "RTC ALARM TEST :");
> +        /*set Alarm to 5 Seconds*/
> +        rtc_tm.tm_sec += 5;
> +        if (rtc_tm.tm_sec >= 60) {
> +                rtc_tm.tm_sec %= 60;
> +                rtc_tm.tm_min++;
> +        }
> +
> +        if (rtc_tm.tm_min == 60) {
> +                rtc_tm.tm_min = 0;
> +                rtc_tm.tm_hour++;
> +        }
> +
> +        if (rtc_tm.tm_hour == 24)
> +                rtc_tm.tm_hour = 0;
> +
> +       ret = ioctl(rtc_fd, RTC_ALM_SET, &rtc_tm);
> +        if (ret == -1) {
> +                tst_resm(TINFO, "RTC_ALM_SET ioctl failed");
> +                tst_resm(TFAIL, "RTC ALARM TEST Failed");

Could this be abbreviated to just one printout please, or maybe do this like...?

int passed = 0;

/* ... */

if (ioctl(rtc_fd, RTC_ALM_SET, &rtc_tm) < 0) {
    tst_resm(TINFO, "RTC_ALM_SET ioctl failed");
} else if (ioctl(rtc_fd, RTC_ALM_READ, &rtc_tm) < 0) {

} else {
     /* Print out the time here. */
     if (ioctl(rtc_fd, RTC_AIE_ON, 0) < 0) {
         tst_resm(TINFO, "RTC_AIE_ON ioctl failed");
     } else {
         /* etc, etc  ... the final true statement would equate set
passed = 1; */
     }
}

tst_resm(passed ? TPASS : TFAIL, "RTC ALARM TEST %s", (passed ?
"passed" : "failed"));

That way it would make the flow more straightforward by having only
one entrance and exit, and the overall code in the test could be
compacted a bit more, thus making things IMO more straightforward.

> +                return;
> +        }
> +
> +        /*Read current alarm time*/
> +        ret = ioctl(rtc_fd, RTC_ALM_READ, &rtc_tm);
> +        if (ret == -1) {
> +                tst_resm(TINFO, "RTC_ALM_READ ioctl failed");
> +                tst_resm(TFAIL,"RTC ALARM TEST Failed");
> +                return;
> +        }
> +
> +        tst_resm(TINFO, "Alarm time set to %02d:%02d:%02d.",
> +                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
> +        /* Enable alarm interrupts */
> +        ret = ioctl(rtc_fd, RTC_AIE_ON, 0);
> +        if (ret == -1) {
> +                tst_resm(TINFO, "RTC_AIE_ON ioctl failed");
> +                tst_resm(TFAIL, "RTC ALARM TEST Failed");
> +                return;
> +        }
> +
> +        tst_resm(TINFO, "Waiting 5 seconds for the alarm...");
> +        ret = read(rtc_fd, &data, sizeof(unsigned long));
> +        if (ret == -1) {
> +                tst_resm(TINFO, "read failed");
> +                tst_resm(TFAIL, "RTC ALARM TEST Failed");
> +                return;
> +        }
> +
> +       tst_resm(TINFO, "Alarm rang.");
> +        /* Disable alarm interrupts */
> +        ret = ioctl(rtc_fd, RTC_AIE_OFF, 0);
> +        if (ret == -1) {
> +                tst_resm(TINFO, "RTC_AIE_OFF ioctl failed");
> +                tst_resm(TFAIL, "RTC ALARM TEST Failed");
> +                return;
> +        }
> +
> +        tst_resm(TPASS, "RTC ALARM TEST Passed");
> +}
> +
> +/* Update_interrupts_test :Once the Update interrupts is enabled,
> + * the RTC gives interrupts (1/sec) on the interrupts line(if the rtc
> + * has one). This is tested by enabling the update interrupts
> + * and then waiting for 5 interrupts.*/
> +
> +void update_interrupts_test(void)
> +{
> +       int ret, i;
> +       unsigned long data;
> +
> +       tst_resm(TINFO, "RTC UPDATE INTERRUPTS TEST :");
> +        /*Turn on update interrupts*/
> +        ret = ioctl(rtc_fd, RTC_UIE_ON, 0);
> +        if (ret == -1) {
> +                tst_resm(TINFO, "RTC_UIE_ON ioctl failed");
> +                tst_resm(TFAIL, "RTC UPDATE INTERRUPTS TEST Failed");
> +               return;
> +        }
> +
> +        tst_resm(TINFO, "Waiting for  5 update interrupts...");
> +        for (i = 1; i < 6; i++) {
> +               /*this read blocks until the interrupt*/
> +                ret = read(rtc_fd, &data, sizeof(unsigned long));
> +                if (ret == -1) {
> +                        tst_resm(TINFO, "read failed");
> +                        tst_resm(TFAIL, "RTC UPDATE INTERRUPTS TEST
> Failed");
> +                        return;
> +                }
> +                tst_resm(TINFO, "Update interrupt %d", i);
> +        }
> +
> +         /* Turn off update interrupts */
> +        ret = ioctl(rtc_fd, RTC_UIE_OFF, 0);
> +        if (ret == -1) {
> +                tst_resm(TINFO, "RTC_UIE_OFF ioctl failed");
> +                tst_resm(TFAIL, "RTC UPDATE INTERRUPTS TEST Failed");
> +                return;
> +        }
> +        tst_resm(TPASS, "RTC UPDATE INTERRUPTS TEST Passed");

Same as above, but to a lesser degree.

> +}
> +
> +int main(int argc, char **argv)
> +{
> +       char *rtc_dev = "/dev/rtc";
> +
> +       if (argc == 2)
> +               rtc_dev = argv[1];
> +
> +       rtc_fd = open(rtc_dev, O_RDONLY);
> +
> +       if (rtc_fd < 0)
> +               tst_brkm(TBROK | TERRNO, tst_exit, "couldn't open %s",
> rtc_dev);
> +
> +       /*Read and alarm tests*/
> +       read_alarm_test();
> +
> +       /*Update interrupts test*/
> +       update_interrupts_test();
> +
> +       close(rtc_fd);
> +
> +       tst_resm(TINFO, "RTC Tests Done!");
> +       return 0;
> +}

Thanks!
-Garrett

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH-v2] RTC Device Driver Tests
  2010-02-26  4:55                 ` [LTP] [PATCH-v2] " Silesh C V
  2010-02-26  5:31                   ` Garrett Cooper
@ 2010-02-26  5:34                   ` Rishikesh K Rajak
  2010-02-26  8:51                     ` Rishikesh K Rajak
  1 sibling, 1 reply; 18+ messages in thread
From: Rishikesh K Rajak @ 2010-02-26  5:34 UTC (permalink / raw)
  To: Silesh C V; +Cc: ltp-list, Arun.sudhilal, Mohamed.Rasheed

On Fri, Feb 26, 2010 at 10:25:17AM +0530, Silesh C V wrote:
>Hi, 
>Here is the new version of the RTC device driver tests.Although it does
>not fall under the new Make infrastructure,  I have used tst_res APIs. So it
>should be easy to port these tests to the new infrastructure without touching the C
>file. Thanks again for the suggestions and review.

Hi Silesh,

Thanks for your patch, let's wait to hear and Acked from Garret, then we
will apply this in our tree.

-- 
Thanks & Regards
Rishi
LTP Maintainer
IBM, LTC, Bangalore
Please join IRC #ltp @ irc.freenode.net

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH-v2] RTC Device Driver Tests
  2010-02-26  5:31                   ` Garrett Cooper
@ 2010-02-26  6:39                     ` Silesh C V
  0 siblings, 0 replies; 18+ messages in thread
From: Silesh C V @ 2010-02-26  6:39 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list, Arun.sudhilal, Mohamed.Rasheed

On 2/26/10, Garrett Cooper <yanegomi@gmail.com> wrote:
> Much better! Three comments:
>
> On Thu, Feb 25, 2010 at 8:55 PM, Silesh C V <saileshcv@gmail.com> wrote:
>> Hi,
>>
>> Here is the new version of the RTC device driver tests.Although it does
>> not
>> fall
>> under the new Make infrastructure,  I have used tst_res APIs. So it should
>> be easy
>> to port these tests to the new infrastructure without touching the C file.
>> Thanks again for the suggestions and review.
>>
>> Thanks,
>> Silesh
>> ---
>> diff -purN ltp-intermediate-20100228.
>> orig/testcases/kernel/device-drivers/rtc/Makefile
>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
>> ---
>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/Makefile
>> 1970-01-01 05:30:00.000000000 +0530
>> +++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/Makefile
>>    2010-02-25 22:33:40.000000000 +0530
>> @@ -0,0 +1,29 @@
>> +#
>> +#  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 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
>> +
>> +
>> +all: $(SRC)
>> +       $(CC) $(SRC) $(CFLAGS) $(LIBS) -o rtc-test
>> +
>> +clean:
>> +       rm -f rtc-test
>> diff -purN
>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
>> ---
>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/README
>> 1970-01-01 05:30:00.000000000 +0530
>> +++ ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/README
>>    2010-02-26 13:55:11.000000000 +0530
>> @@ -0,0 +1,29 @@
>> +rtc-test.c : Test the Real Time Clock driver
>> +
>> +Tests supported as of now
>> +--------------------------
>> +1. Read test : This reads the time/date from the RTC
>> +   ioctls tested :- RTC_RD_TIME.
>> +
>> +2. Alarm Test: Sets the alarm to 5 seconds in future and makes sure it
>> rings.
>> +   ioctls tested :- RTC_ALM_SET, RTC_ALM_READ,  RTC_AIE_ON, RTC_AIE_OFF.
>> +
>> +3. Update interrupts test : Sets Update interrupts enable on, waits for
>> five
>> +   interrupts and then turns it off.
>> +   ioctls tested :- RTC_UIE_ON, RTC_UIE_OFF.
>> +
>> +
>> +How to Build
>> +------------
>> +You have to build the complete LTP package before trying to build these
>> tests.
>> +After building the complete LTP sources enter this directory and issue a
>> 'make'.
>> +
>> +How to Run
>> +----------
>> +
>> +       The tests assume the rtc device node to be "/dev/rtc". If you have
>> a
>> +different node run the test with the name of the node as a parameter.
>> +
>> +Eg. If your node is /dev/rtc0, then run the test as
>> +
>> +       $ ./rtc-test /dev/rtc0
>> diff -purN
>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/rtc-test.c
>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/rtc-test.c
>> ---
>> ltp-intermediate-20100228.orig/testcases/kernel/device-drivers/rtc/rtc-test.c
>>       1970-01-01 05:30:00.000000000 +0530
>> +++
>> ltp-intermediate-20100228/testcases/kernel/device-drivers/rtc/rtc-test.c
>>    2010-02-26 14:15:21.000000000 +0530
>> @@ -0,0 +1,192 @@
>> +/*   rtc-test.c
>> + *
>> + *   Tests for the Real Time Clock driver.
>> + *
>> + *   Copyright (c) Larsen & Toubro Infotech Ltd., 2010
>> + *
>> + *   Author : Silesh C V <Silesh.Vellattu@lntinfotech.com>
>> + *
>> + *   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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
>> USA
>> + */
>> +
>> +#include "test.h"
>> +#include <sys/ioctl.h>
>> +#include <stdio.h>
>> +#include <stdlib.h>
>> +#include <fcntl.h>
>> +#include <unistd.h>
>> +#include <linux/rtc.h>
>> +#include <errno.h>
>> +#include <time.h>
>> +
>> +int rtc_fd = -1;
>> +char *TCID = "rtc01";
>> +int TST_TOTAL = 3;
>> +
>> +
>> +/* 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
>> + * RTC_RD_TIME, RTC_ALM_SET, RTC_ALM_READ, RTC_AIE_OFF  */
>> +
>> +void read_alarm_test(void)
>> +{
>> +       struct rtc_time rtc_tm;
>> +       int ret;
>> +       unsigned long data;
>> +       char time[35];
>
> Why 35?

OK, I need not add a #define right ? I will make it 25 :-), that much
is needed to hold the time and date.


>
>> +       tst_resm(TINFO, "RTC READ TEST:");
>> +
>> +        /*Read RTC Time*/
>> +        ret = ioctl(rtc_fd, RTC_RD_TIME, &rtc_tm);
>> +        if (ret == -1) {
>> +                tst_resm(TINFO, "RTC_RD_TIME ioctl failed");
>> +                tst_resm(TFAIL, "RTC READ TEST Failed ");
>> +                return;
>> +        }
>> +
>> +        tst_resm(TPASS, "RTC READ TEST Passed");
>> +
>> +        strftime(time, sizeof(time), "%D %r", (struct tm *)&rtc_tm);
>> +
>> +       tst_resm(TINFO, "Current Date/time is  %s", time);
>> +
>> +        tst_resm(TINFO, "RTC ALARM TEST :");
>> +        /*set Alarm to 5 Seconds*/
>> +        rtc_tm.tm_sec += 5;
>> +        if (rtc_tm.tm_sec >= 60) {
>> +                rtc_tm.tm_sec %= 60;
>> +                rtc_tm.tm_min++;
>> +        }
>> +
>> +        if (rtc_tm.tm_min == 60) {
>> +                rtc_tm.tm_min = 0;
>> +                rtc_tm.tm_hour++;
>> +        }
>> +
>> +        if (rtc_tm.tm_hour == 24)
>> +                rtc_tm.tm_hour = 0;
>> +
>> +       ret = ioctl(rtc_fd, RTC_ALM_SET, &rtc_tm);
>> +        if (ret == -1) {
>> +                tst_resm(TINFO, "RTC_ALM_SET ioctl failed");
>> +                tst_resm(TFAIL, "RTC ALARM TEST Failed");
>
> Could this be abbreviated to just one printout please, or maybe do this
> like...?
>
> int passed = 0;
>
> /* ... */
>
> if (ioctl(rtc_fd, RTC_ALM_SET, &rtc_tm) < 0) {
>     tst_resm(TINFO, "RTC_ALM_SET ioctl failed");
> } else if (ioctl(rtc_fd, RTC_ALM_READ, &rtc_tm) < 0) {
>
> } else {
>      /* Print out the time here. */
>      if (ioctl(rtc_fd, RTC_AIE_ON, 0) < 0) {
>          tst_resm(TINFO, "RTC_AIE_ON ioctl failed");
>      } else {
>          /* etc, etc  ... the final true statement would equate set
> passed = 1; */
>      }
> }
>
> tst_resm(passed ? TPASS : TFAIL, "RTC ALARM TEST %s", (passed ?
> "passed" : "failed"));
>

I has tried this , although it made the code compact, it almost made the code
not readable and more complex.


> That way it would make the flow more straightforward by having only
> one entrance and exit, and the overall code in the test could be
> compacted a bit more, thus making things IMO more straightforward.
>
>> +                return;
>> +        }
>> +
>> +        /*Read current alarm time*/
>> +        ret = ioctl(rtc_fd, RTC_ALM_READ, &rtc_tm);
>> +        if (ret == -1) {
>> +                tst_resm(TINFO, "RTC_ALM_READ ioctl failed");
>> +                tst_resm(TFAIL,"RTC ALARM TEST Failed");
>> +                return;
>> +        }
>> +
>> +        tst_resm(TINFO, "Alarm time set to %02d:%02d:%02d.",
>> +                rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
>> +        /* Enable alarm interrupts */
>> +        ret = ioctl(rtc_fd, RTC_AIE_ON, 0);
>> +        if (ret == -1) {
>> +                tst_resm(TINFO, "RTC_AIE_ON ioctl failed");
>> +                tst_resm(TFAIL, "RTC ALARM TEST Failed");
>> +                return;
>> +        }
>> +
>> +        tst_resm(TINFO, "Waiting 5 seconds for the alarm...");
>> +        ret = read(rtc_fd, &data, sizeof(unsigned long));
>> +        if (ret == -1) {
>> +                tst_resm(TINFO, "read failed");
>> +                tst_resm(TFAIL, "RTC ALARM TEST Failed");
>> +                return;
>> +        }
>> +
>> +       tst_resm(TINFO, "Alarm rang.");
>> +        /* Disable alarm interrupts */
>> +        ret = ioctl(rtc_fd, RTC_AIE_OFF, 0);
>> +        if (ret == -1) {
>> +                tst_resm(TINFO, "RTC_AIE_OFF ioctl failed");
>> +                tst_resm(TFAIL, "RTC ALARM TEST Failed");
>> +                return;
>> +        }
>> +
>> +        tst_resm(TPASS, "RTC ALARM TEST Passed");
>> +}
>> +
>> +/* Update_interrupts_test :Once the Update interrupts is enabled,
>> + * the RTC gives interrupts (1/sec) on the interrupts line(if the rtc
>> + * has one). This is tested by enabling the update interrupts
>> + * and then waiting for 5 interrupts.*/
>> +
>> +void update_interrupts_test(void)
>> +{
>> +       int ret, i;
>> +       unsigned long data;
>> +
>> +       tst_resm(TINFO, "RTC UPDATE INTERRUPTS TEST :");
>> +        /*Turn on update interrupts*/
>> +        ret = ioctl(rtc_fd, RTC_UIE_ON, 0);
>> +        if (ret == -1) {
>> +                tst_resm(TINFO, "RTC_UIE_ON ioctl failed");
>> +                tst_resm(TFAIL, "RTC UPDATE INTERRUPTS TEST Failed");
>> +               return;
>> +        }
>> +
>> +        tst_resm(TINFO, "Waiting for  5 update interrupts...");
>> +        for (i = 1; i < 6; i++) {
>> +               /*this read blocks until the interrupt*/
>> +                ret = read(rtc_fd, &data, sizeof(unsigned long));
>> +                if (ret == -1) {
>> +                        tst_resm(TINFO, "read failed");
>> +                        tst_resm(TFAIL, "RTC UPDATE INTERRUPTS TEST
>> Failed");
>> +                        return;
>> +                }
>> +                tst_resm(TINFO, "Update interrupt %d", i);
>> +        }
>> +
>> +         /* Turn off update interrupts */
>> +        ret = ioctl(rtc_fd, RTC_UIE_OFF, 0);
>> +        if (ret == -1) {
>> +                tst_resm(TINFO, "RTC_UIE_OFF ioctl failed");
>> +                tst_resm(TFAIL, "RTC UPDATE INTERRUPTS TEST Failed");
>> +                return;
>> +        }
>> +        tst_resm(TPASS, "RTC UPDATE INTERRUPTS TEST Passed");
>
> Same as above, but to a lesser degree.
>
>> +}
>> +
>> +int main(int argc, char **argv)
>> +{
>> +       char *rtc_dev = "/dev/rtc";
>> +
>> +       if (argc == 2)
>> +               rtc_dev = argv[1];
>> +
>> +       rtc_fd = open(rtc_dev, O_RDONLY);
>> +
>> +       if (rtc_fd < 0)
>> +               tst_brkm(TBROK | TERRNO, tst_exit, "couldn't open %s",
>> rtc_dev);
>> +
>> +       /*Read and alarm tests*/
>> +       read_alarm_test();
>> +
>> +       /*Update interrupts test*/
>> +       update_interrupts_test();
>> +
>> +       close(rtc_fd);
>> +
>> +       tst_resm(TINFO, "RTC Tests Done!");
>> +       return 0;
>> +}
>
> Thanks!
> -Garrett
>


-- 
Silesh

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH-v2] RTC Device Driver Tests
  2010-02-26  5:34                   ` Rishikesh K Rajak
@ 2010-02-26  8:51                     ` Rishikesh K Rajak
  2010-02-26  9:11                       ` Rishikesh K Rajak
  0 siblings, 1 reply; 18+ messages in thread
From: Rishikesh K Rajak @ 2010-02-26  8:51 UTC (permalink / raw)
  To: Silesh C V; +Cc: ltp-list, Arun.sudhilal, Mohamed.Rasheed

On Fri, Feb 26, 2010 at 11:04:52AM +0530, Rishikesh K Rajak wrote:
> On Fri, Feb 26, 2010 at 10:25:17AM +0530, Silesh C V wrote:
> >Hi, 
> >Here is the new version of the RTC device driver tests.Although it does
> >not fall under the new Make infrastructure,  I have used tst_res APIs. So it
> >should be easy to port these tests to the new infrastructure without touching the C
> >file. Thanks again for the suggestions and review.
> 
> Hi Silesh,
> 
> Thanks for your patch, let's wait to hear and Acked from Garret, then we
> will apply this in our tree.

Hi Silesh,

I got a chance to test your patch on RHEL5.4GA and i was having device
as /dev/rtc .

But when i run your testcase on this device i get following :

[root@mx3655 rtc]# ./rtc-test /dev/rtc
rtc01       0  TINFO  :  RTC READ TEST:
rtc01       1  TPASS  :  RTC READ TEST Passed
rtc01       0  TINFO  :  Current Date/time is  02/26/10 08:40:17 AM
rtc01       0  TINFO  :  RTC ALARM TEST :
rtc01       0  TINFO  :  Alarm time set to 08:40:22.
rtc01       0  TINFO  :  Waiting 5 seconds for the alarm...
<------ Stuck forever :(

Looks like some issue with your code, can you please relook once again ?

Thanks for your patch.
-Rishi

> 
> -- 
> Thanks & Regards
> Rishi
> LTP Maintainer
> IBM, LTC, Bangalore
> Please join IRC #ltp @ irc.freenode.net
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list

-- 
Thanks & Regards
Rishi
LTP Maintainer
IBM, LTC, Bangalore
Please join IRC #ltp @ irc.freenode.net

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH-v2] RTC Device Driver Tests
  2010-02-26  8:51                     ` Rishikesh K Rajak
@ 2010-02-26  9:11                       ` Rishikesh K Rajak
  2010-03-01  6:29                         ` Rishikesh K Rajak
  0 siblings, 1 reply; 18+ messages in thread
From: Rishikesh K Rajak @ 2010-02-26  9:11 UTC (permalink / raw)
  To: Silesh C V, ltp-list, Garrett Cooper, Arun.sudhilal, Mohamed.Rasheed

On Fri, Feb 26, 2010 at 02:21:36PM +0530, Rishikesh K Rajak wrote:
> > >Hi, 
> 
> Looks like some issue with your code, can you please relook once again ?

I have other system Which has SLES11 and i could see it has 

mls41:/home/test/ltp-full-20100131/testcases/kernel/device-drivers/rtc #
ls -l /dev/rtc*
lrwxrwxrwx 1 root root      4 2010-02-26 13:04 /dev/rtc -> rtc0
crw-r--r-- 1 root root 252, 0 2010-02-26 13:04 /dev/rtc0
mls41:/home/test/ltp-full-20100131/testcases/kernel/device-drivers/rtc # 

And here testcase passes. So can you check what could be the reason for
failing on RHEL5.4 where it has only.

[root@mx3655 ~]# ls -l /dev/rtc*
crw-r--r-- 1 root root 10, 135 Feb 18 06:42 /dev/rtc
[root@mx3655 ~]# 

Thanks for your support.

-- 
Thanks & Regards
Rishi
LTP Maintainer
IBM, LTC, Bangalore
Please join IRC #ltp @ irc.freenode.net

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH-v2] RTC Device Driver Tests
  2010-02-26  9:11                       ` Rishikesh K Rajak
@ 2010-03-01  6:29                         ` Rishikesh K Rajak
  2010-03-02  9:47                           ` Silesh C V
  0 siblings, 1 reply; 18+ messages in thread
From: Rishikesh K Rajak @ 2010-03-01  6:29 UTC (permalink / raw)
  To: Silesh C V, ltp-list, Garrett Cooper, Arun.sudhilal, Mohamed.Rasheed

On Fri, Feb 26, 2010 at 02:41:19PM +0530, Rishikesh K Rajak wrote:
> On Fri, Feb 26, 2010 at 02:21:36PM +0530, Rishikesh K Rajak wrote:
> > > >Hi, 
> > 
> > Looks like some issue with your code, can you please relook once again ?
> 
> I have other system Which has SLES11 and i could see it has 
> 
> mls41:/home/test/ltp-full-20100131/testcases/kernel/device-drivers/rtc #
> ls -l /dev/rtc*
> lrwxrwxrwx 1 root root      4 2010-02-26 13:04 /dev/rtc -> rtc0
> crw-r--r-- 1 root root 252, 0 2010-02-26 13:04 /dev/rtc0
> mls41:/home/test/ltp-full-20100131/testcases/kernel/device-drivers/rtc # 
> 
> And here testcase passes. So can you check what could be the reason for
> failing on RHEL5.4 where it has only.
> 
> [root@mx3655 ~]# ls -l /dev/rtc*
> crw-r--r-- 1 root root 10, 135 Feb 18 06:42 /dev/rtc
> [root@mx3655 ~]# 
> 
> Thanks for your support.

HI Silesh,

Any input here, so that i can push this to upstream.

Thanks
Rishi

> 
> -- 
> Thanks & Regards
> Rishi
> LTP Maintainer
> IBM, LTC, Bangalore
> Please join IRC #ltp @ irc.freenode.net
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list

-- 
Thanks & Regards
Rishi
LTP Maintainer
IBM, LTC, Bangalore
Please join IRC #ltp @ irc.freenode.net

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH-v2] RTC Device Driver Tests
  2010-03-01  6:29                         ` Rishikesh K Rajak
@ 2010-03-02  9:47                           ` Silesh C V
  2010-03-03  4:59                             ` Rishikesh K Rajak
  0 siblings, 1 reply; 18+ messages in thread
From: Silesh C V @ 2010-03-02  9:47 UTC (permalink / raw)
  To: risrajak; +Cc: ltp-list, Arun.sudhilal, Mohamed.Rasheed

On 3/1/10, Rishikesh K Rajak <risrajak@linux.vnet.ibm.com> wrote:
> On Fri, Feb 26, 2010 at 02:41:19PM +0530, Rishikesh K Rajak wrote:
>> On Fri, Feb 26, 2010 at 02:21:36PM +0530, Rishikesh K Rajak wrote:
>> > > >Hi,
>> >
>> > Looks like some issue with your code, can you please relook once again ?
>>
>> I have other system Which has SLES11 and i could see it has
>>
>> mls41:/home/test/ltp-full-20100131/testcases/kernel/device-drivers/rtc #
>> ls -l /dev/rtc*
>> lrwxrwxrwx 1 root root      4 2010-02-26 13:04 /dev/rtc -> rtc0
>> crw-r--r-- 1 root root 252, 0 2010-02-26 13:04 /dev/rtc0
>> mls41:/home/test/ltp-full-20100131/testcases/kernel/device-drivers/rtc #
>>
>> And here testcase passes. So can you check what could be the reason for
>> failing on RHEL5.4 where it has only.
>>
>> [root@mx3655 ~]# ls -l /dev/rtc*
>> crw-r--r-- 1 root root 10, 135 Feb 18 06:42 /dev/rtc
>> [root@mx3655 ~]#
>>
>> Thanks for your support.
>
> HI Silesh,
>
> Any input here, so that i can push this to upstream.

Hi Rishi,

Sorry for the late reply. I was out of the office for the past few
days.AFAIK alarm not ringing usually happens because of the absence of
an IRQ line from the RTC.I should be able to make the test report a
FAIL when this happens by using select(2) so that a time out occurs. I
will send another patch soon.


Thanks,
Silesh.

>
> Thanks
> Rishi
>
>>
>> --
>> Thanks & Regards
>> Rishi
>> LTP Maintainer
>> IBM, LTC, Bangalore
>> Please join IRC #ltp @ irc.freenode.net
>>
>> ------------------------------------------------------------------------------
>> Download Intel&#174; Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Ltp-list mailing list
>> Ltp-list@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ltp-list
>
> --
> Thanks & Regards
> Rishi
> LTP Maintainer
> IBM, LTC, Bangalore
> Please join IRC #ltp @ irc.freenode.net
>


-- 
Silesh

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH-v2] RTC Device Driver Tests
  2010-03-02  9:47                           ` Silesh C V
@ 2010-03-03  4:59                             ` Rishikesh K Rajak
  0 siblings, 0 replies; 18+ messages in thread
From: Rishikesh K Rajak @ 2010-03-03  4:59 UTC (permalink / raw)
  To: Silesh C V; +Cc: ltp-list, Arun.sudhilal, Mohamed.Rasheed

On Tue, Mar 02, 2010 at 03:17:01PM +0530, Silesh C V wrote:
> On 3/1/10, Rishikesh K Rajak <risrajak@linux.vnet.ibm.com> wrote:
> > HI Silesh,
> >
> > Any input here, so that i can push this to upstream.
> 
> Hi Rishi,
> 
> Sorry for the late reply. I was out of the office for the past few
> days.AFAIK alarm not ringing usually happens because of the absence of
> an IRQ line from the RTC.I should be able to make the test report a
> FAIL when this happens by using select(2) so that a time out occurs. I
> will send another patch soon.

Thanks, can you please send your patch against next branch of ltp git
tree ?
#git clone -b next
git://ltp.git.sourceforge.net/gitroot/ltp/ltp-dev.git ltp

Thanks
-Rishi


> 
> 
-- 
Thanks & Regards
Rishi
LTP Maintainer
IBM, LTC, Bangalore
Please join IRC #ltp @ irc.freenode.net

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2010-03-03  5:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-24 12:10 [LTP] [PATCH][RESEND] RTC Device Driver Tests Silesh C V
2010-02-24 21:14 ` Garrett Cooper
2010-02-25  6:40   ` Silesh C V
2010-02-25  7:07     ` Garrett Cooper
2010-02-25  7:11       ` Garrett Cooper
2010-02-25  9:09         ` Silesh C V
2010-02-25  9:33           ` Rishikesh K Rajak
2010-02-25  9:48             ` Garrett Cooper
2010-02-26  3:06               ` Silesh C V
2010-02-26  4:55                 ` [LTP] [PATCH-v2] " Silesh C V
2010-02-26  5:31                   ` Garrett Cooper
2010-02-26  6:39                     ` Silesh C V
2010-02-26  5:34                   ` Rishikesh K Rajak
2010-02-26  8:51                     ` Rishikesh K Rajak
2010-02-26  9:11                       ` Rishikesh K Rajak
2010-03-01  6:29                         ` Rishikesh K Rajak
2010-03-02  9:47                           ` Silesh C V
2010-03-03  4:59                             ` Rishikesh K Rajak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.