change log for rtems (2010-06-21)

rtems-vc at rtems.org rtems-vc at rtems.org
Mon Jun 21 17:12:00 UTC 2010


 *joel* (on branch rtems-4-10-branch):
2010-06-21	Joel Sherrill <joel.sherrilL at OARcorp.com>

	PR 1559/misc
	Coverity Id 16
	* libmisc/monitor/mon-editor.c: Fix buffer overflow.

M 1.2444  cpukit/ChangeLog
M 1.2346.2.42  cpukit/ChangeLog
M    1.5  cpukit/libmisc/monitor/mon-editor.c
M 1.4.2.1  cpukit/libmisc/monitor/mon-editor.c

diff -u rtems/cpukit/ChangeLog:1.2443 rtems/cpukit/ChangeLog:1.2444
--- rtems/cpukit/ChangeLog:1.2443	Sun Jun 20 14:41:32 2010
+++ rtems/cpukit/ChangeLog	Mon Jun 21 11:25:08 2010
@@ -1,3 +1,9 @@
+2010-06-21	Joel Sherrill <joel.sherrilL at OARcorp.com>
+
+	PR 1559/misc
+	Coverity Id 16
+	* libmisc/monitor/mon-editor.c: Fix buffer overflow.
+
 2010-06-20	Joel Sherrill <joel.sherrill at oarcorp.com>
 
 	* sapi/include/confdefs.h: Add parameters for FIFOs and pipes since

diff -u rtems/cpukit/ChangeLog:1.2346.2.41 rtems/cpukit/ChangeLog:1.2346.2.42
--- rtems/cpukit/ChangeLog:1.2346.2.41	Fri Jun 18 08:29:29 2010
+++ rtems/cpukit/ChangeLog	Mon Jun 21 11:25:20 2010
@@ -1,3 +1,9 @@
+2010-06-21	Joel Sherrill <joel.sherrilL at OARcorp.com>
+
+	PR 1559/misc
+	Coverity Id 16
+	* libmisc/monitor/mon-editor.c: Fix buffer overflow.
+
 2010-06-18	Ralf Corsépius <ralf.corsepius at rtems.org>
 
 	* rtems/include/rtems/rtems/object.h,

diff -u rtems/cpukit/libmisc/monitor/mon-editor.c:1.4 rtems/cpukit/libmisc/monitor/mon-editor.c:1.5
--- rtems/cpukit/libmisc/monitor/mon-editor.c:1.4	Sun Nov 29 06:12:39 2009
+++ rtems/cpukit/libmisc/monitor/mon-editor.c	Mon Jun 21 11:25:09 2010
@@ -428,7 +428,7 @@
               if ((pos < end) && (end < RTEMS_COMMAND_BUFFER_SIZE))
               {
                 int ch, bs;
-                for (ch = end + 1; ch > pos; ch--)
+                for (ch = end; ch > pos; ch--)
                   buffer[ch] = buffer[ch - 1];
                 fprintf(stdout,buffer + pos);
                 for (bs = 0; bs < (end - pos + 1); bs++)

diff -u rtems/cpukit/libmisc/monitor/mon-editor.c:1.4 rtems/cpukit/libmisc/monitor/mon-editor.c:1.4.2.1
--- rtems/cpukit/libmisc/monitor/mon-editor.c:1.4	Sun Nov 29 06:12:39 2009
+++ rtems/cpukit/libmisc/monitor/mon-editor.c	Mon Jun 21 11:25:20 2010
@@ -428,7 +428,7 @@
               if ((pos < end) && (end < RTEMS_COMMAND_BUFFER_SIZE))
               {
                 int ch, bs;
-                for (ch = end + 1; ch > pos; ch--)
+                for (ch = end; ch > pos; ch--)
                   buffer[ch] = buffer[ch - 1];
                 fprintf(stdout,buffer + pos);
                 for (bs = 0; bs < (end - pos + 1); bs++)


 *joel* (on branch rtems-4-10-branch):
2010-06-21	Joel Sherrill <joel.sherrilL at OARcorp.com>

	PR 1554/cpukit
	Coverity Id 17
	* libi2c/libi2c.c: Fix memory leak on error.

M 1.1539.2.64  cpukit/ChangeLog
M 1.2346.2.43  cpukit/ChangeLog
M 1.11.2.2  cpukit/libi2c/libi2c.c
M 1.16.2.1  cpukit/libi2c/libi2c.c

diff -u rtems/cpukit/ChangeLog:1.1539.2.63 rtems/cpukit/ChangeLog:1.1539.2.64
--- rtems/cpukit/ChangeLog:1.1539.2.63	Tue Mar 16 16:28:06 2010
+++ rtems/cpukit/ChangeLog	Mon Jun 21 11:27:22 2010
@@ -1,3 +1,9 @@
+2010-06-21	Joel Sherrill <joel.sherrilL at OARcorp.com>
+
+	PR 1554/cpukit
+	Coverity Id 17
+	* libi2c/libi2c.c: Fix memory leak on error.
+
 2010-03-17	Chris Johns <chrisj at rtems.org>
 
 	* libfs/src/dosfs/msdos_create.c: Fix the date/time call order to

diff -u rtems/cpukit/ChangeLog:1.2346.2.42 rtems/cpukit/ChangeLog:1.2346.2.43
--- rtems/cpukit/ChangeLog:1.2346.2.42	Mon Jun 21 11:25:20 2010
+++ rtems/cpukit/ChangeLog	Mon Jun 21 11:27:11 2010
@@ -1,5 +1,11 @@
 2010-06-21	Joel Sherrill <joel.sherrilL at OARcorp.com>
 
+	PR 1554/cpukit
+	Coverity Id 17
+	* libi2c/libi2c.c: Fix memory leak on error.
+
+2010-06-21	Joel Sherrill <joel.sherrilL at OARcorp.com>
+
 	PR 1559/misc
 	Coverity Id 16
 	* libmisc/monitor/mon-editor.c: Fix buffer overflow.

diff -u rtems/cpukit/libi2c/libi2c.c:1.11.2.1 rtems/cpukit/libi2c/libi2c.c:1.11.2.2
--- rtems/cpukit/libi2c/libi2c.c:1.11.2.1	Wed Sep 24 09:31:37 2008
+++ rtems/cpukit/libi2c/libi2c.c	Mon Jun 21 11:27:23 2010
@@ -395,11 +395,13 @@
   /* check */
   if ('/' != *nmcpy) {
     safe_printf ( DRVNM "Bad name: must be an absolute path starting with '/'\n");
+    free( nmcpy );
     return -RTEMS_INVALID_NAME;
   }
   /* file must not exist */
   if (!stat (nmcpy, &sbuf)) {
     safe_printf ( DRVNM "Bad name: file exists already\n");
+    free( nmcpy );
     return -RTEMS_INVALID_NAME;
   }
 
@@ -412,6 +414,7 @@
   if (i) {
     safe_printf ( DRVNM "Get %s status failed: %s\n",
              nmcpy, strerror(errno));
+    free( nmcpy );
     return -RTEMS_INVALID_NAME;
   }
   /* should be a directory since name terminates in '/' */
@@ -419,11 +422,13 @@
 
   if (!libmutex) {
     safe_printf ( DRVNM "Library not initialized\n");
+    free( nmcpy );
     return -RTEMS_NOT_DEFINED;
   }
 
   if (bus == NULL || bus->size < sizeof (*bus)) {
     safe_printf ( DRVNM "No bus-ops or size too small -- misconfiguration?\n");
+    free( nmcpy );
     return -RTEMS_NOT_CONFIGURED;
   }
 

diff -u rtems/cpukit/libi2c/libi2c.c:1.16 rtems/cpukit/libi2c/libi2c.c:1.16.2.1
--- rtems/cpukit/libi2c/libi2c.c:1.16	Sun Nov 29 06:09:18 2009
+++ rtems/cpukit/libi2c/libi2c.c	Mon Jun 21 11:27:12 2010
@@ -395,11 +395,13 @@
   /* check */
   if ('/' != *nmcpy) {
     safe_printf ( DRVNM "Bad name: must be an absolute path starting with '/'\n");
+    free( nmcpy );
     return -RTEMS_INVALID_NAME;
   }
   /* file must not exist */
   if (!stat (nmcpy, &sbuf)) {
     safe_printf ( DRVNM "Bad name: file exists already\n");
+    free( nmcpy );
     return -RTEMS_INVALID_NAME;
   }
 
@@ -412,6 +414,7 @@
   if (i) {
     safe_printf ( DRVNM "Get %s status failed: %s\n",
              nmcpy, strerror(errno));
+    free( nmcpy );
     return -RTEMS_INVALID_NAME;
   }
   /* should be a directory since name terminates in '/' */
@@ -419,11 +422,13 @@
 
   if (libmutex == RTEMS_ID_NONE) {
     safe_printf ( DRVNM "Library not initialized\n");
+    free( nmcpy );
     return -RTEMS_NOT_DEFINED;
   }
 
   if (bus == NULL || bus->size < sizeof (*bus)) {
     safe_printf ( DRVNM "No bus-ops or size too small -- misconfiguration?\n");
+    free( nmcpy );
     return -RTEMS_NOT_CONFIGURED;
   }
 


 *joel*:
2010-06-21	Joel Sherrill <joel.sherrilL at OARcorp.com>

	PR 1554/cpukit
	Coverity Id 17
	* libi2c/libi2c.c, score/src/objectextendinformation.c: Fix memory leak
	on error.

M 1.2445  cpukit/ChangeLog
M   1.17  cpukit/libi2c/libi2c.c
M   1.22  cpukit/score/src/objectextendinformation.c

diff -u rtems/cpukit/ChangeLog:1.2444 rtems/cpukit/ChangeLog:1.2445
--- rtems/cpukit/ChangeLog:1.2444	Mon Jun 21 11:25:08 2010
+++ rtems/cpukit/ChangeLog	Mon Jun 21 11:27:36 2010
@@ -1,5 +1,12 @@
 2010-06-21	Joel Sherrill <joel.sherrilL at OARcorp.com>
 
+	PR 1554/cpukit
+	Coverity Id 17
+	* libi2c/libi2c.c, score/src/objectextendinformation.c: Fix memory leak
+	on error.
+
+2010-06-21	Joel Sherrill <joel.sherrilL at OARcorp.com>
+
 	PR 1559/misc
 	Coverity Id 16
 	* libmisc/monitor/mon-editor.c: Fix buffer overflow.

diff -u rtems/cpukit/libi2c/libi2c.c:1.16 rtems/cpukit/libi2c/libi2c.c:1.17
--- rtems/cpukit/libi2c/libi2c.c:1.16	Sun Nov 29 06:09:18 2009
+++ rtems/cpukit/libi2c/libi2c.c	Mon Jun 21 11:27:37 2010
@@ -389,17 +389,23 @@
   char tmp, *chpt;
   struct stat sbuf;
 
-  strcpy (nmcpy, name ? name : "/dev/i2c");
+  if (nmcpy == NULL) {
+    safe_printf ( DRVNM "No memory\n");
+    return -RTEMS_NO_MEMORY;
+  }
 
+  strcpy (nmcpy, name ? name : "/dev/i2c");
 
   /* check */
   if ('/' != *nmcpy) {
     safe_printf ( DRVNM "Bad name: must be an absolute path starting with '/'\n");
+    free( nmcpy );
     return -RTEMS_INVALID_NAME;
   }
   /* file must not exist */
   if (!stat (nmcpy, &sbuf)) {
     safe_printf ( DRVNM "Bad name: file exists already\n");
+    free( nmcpy );
     return -RTEMS_INVALID_NAME;
   }
 
@@ -412,6 +418,7 @@
   if (i) {
     safe_printf ( DRVNM "Get %s status failed: %s\n",
              nmcpy, strerror(errno));
+    free( nmcpy );
     return -RTEMS_INVALID_NAME;
   }
   /* should be a directory since name terminates in '/' */
@@ -419,11 +426,13 @@
 
   if (libmutex == RTEMS_ID_NONE) {
     safe_printf ( DRVNM "Library not initialized\n");
+    free( nmcpy );
     return -RTEMS_NOT_DEFINED;
   }
 
   if (bus == NULL || bus->size < sizeof (*bus)) {
     safe_printf ( DRVNM "No bus-ops or size too small -- misconfiguration?\n");
+    free( nmcpy );
     return -RTEMS_NOT_CONFIGURED;
   }
 

diff -u rtems/cpukit/score/src/objectextendinformation.c:1.21 rtems/cpukit/score/src/objectextendinformation.c:1.22
--- rtems/cpukit/score/src/objectextendinformation.c:1.21	Wed Jan 20 11:08:19 2010
+++ rtems/cpukit/score/src/objectextendinformation.c	Mon Jun 21 11:27:37 2010
@@ -56,11 +56,13 @@
   uint32_t          maximum;
   size_t            block_size;
   void             *new_object_block;
+  bool              do_extend;
 
   /*
-   *  Search for a free block of indexes. The block variable ends up set
-   *  to block_count + 1 if the table needs to be extended.
+   *  Search for a free block of indexes. If we do NOT need to allocate or
+   *  extend the block table, then we will change do_extend.
    */
+  do_extend     = true;
   minimum_index = _Objects_Get_index( information->minimum_id );
   index_base    = minimum_index;
   block         = 0;
@@ -72,9 +74,10 @@
     block_count = information->maximum / information->allocation_size;
 
     for ( ; block < block_count; block++ ) {
-      if ( information->object_blocks[ block ] == NULL )
+      if ( information->object_blocks[ block ] == NULL ) {
+        do_extend = false;
         break;
-      else
+      } else
         index_base += information->allocation_size;
     }
   }
@@ -104,9 +107,9 @@
   }
 
   /*
-   *  If the index_base is the maximum we need to grow the tables.
+   *  Do we need to grow the tables?
    */
-  if (index_base >= information->maximum ) {
+  if ( do_extend ) {
     ISR_Level         level;
     void            **object_blocks;
     uint32_t         *inactive_per_block;


 *joel* (on branch rtems-4-10-branch):
2010-06-21	Peter Dufault <dufault at hda.com>

	PR 1570/cpukit
	* posix/src/semtimedwait.c: This routine is supposed to return -1/errno
	NOT the status directly.

M 1.2446  cpukit/ChangeLog
M 1.696.2.107  cpukit/ChangeLog
M 1.1080.2.59  cpukit/ChangeLog
M 1.1539.2.65  cpukit/ChangeLog
M 1.2346.2.44  cpukit/ChangeLog
M   1.14  cpukit/posix/src/semtimedwait.c
M 1.4.2.4  cpukit/posix/src/semtimedwait.c
M 1.9.2.2  cpukit/posix/src/semtimedwait.c
M 1.11.2.1  cpukit/posix/src/semtimedwait.c
M 1.13.2.1  cpukit/posix/src/semtimedwait.c

diff -u rtems/cpukit/ChangeLog:1.2445 rtems/cpukit/ChangeLog:1.2446
--- rtems/cpukit/ChangeLog:1.2445	Mon Jun 21 11:27:36 2010
+++ rtems/cpukit/ChangeLog	Mon Jun 21 11:38:26 2010
@@ -1,3 +1,9 @@
+2010-06-21	Peter Dufault <dufault at hda.com>
+
+	PR 1570/cpukit
+	* posix/src/semtimedwait.c: This routine is supposed to return -1/errno
+	NOT the status directly.
+
 2010-06-21	Joel Sherrill <joel.sherrilL at OARcorp.com>
 
 	PR 1554/cpukit

diff -u rtems/cpukit/ChangeLog:1.696.2.106 rtems/cpukit/ChangeLog:1.696.2.107
--- rtems/cpukit/ChangeLog:1.696.2.106	Thu Dec 10 16:38:36 2009
+++ rtems/cpukit/ChangeLog	Mon Jun 21 11:38:55 2010
@@ -1,3 +1,9 @@
+2010-06-21	Peter Dufault <dufault at hda.com>
+
+	PR 1570/cpukit
+	* posix/src/semtimedwait.c: This routine is supposed to return -1/errno
+	NOT the status directly.
+
 2009-12-10	Joel Sherrill <joel.sherrill at OARcorp.com>
 
 	PR 1482

diff -u rtems/cpukit/ChangeLog:1.1080.2.58 rtems/cpukit/ChangeLog:1.1080.2.59
--- rtems/cpukit/ChangeLog:1.1080.2.58	Thu Dec 10 16:19:35 2009
+++ rtems/cpukit/ChangeLog	Mon Jun 21 11:38:46 2010
@@ -1,3 +1,9 @@
+2010-06-21	Peter Dufault <dufault at hda.com>
+
+	PR 1570/cpukit
+	* posix/src/semtimedwait.c: This routine is supposed to return -1/errno
+	NOT the status directly.
+
 2009-12-10	Joel Sherrill <joel.sherrill at OARcorp.com>
 
 	PR 1482

diff -u rtems/cpukit/ChangeLog:1.1539.2.64 rtems/cpukit/ChangeLog:1.1539.2.65
--- rtems/cpukit/ChangeLog:1.1539.2.64	Mon Jun 21 11:27:22 2010
+++ rtems/cpukit/ChangeLog	Mon Jun 21 11:38:39 2010
@@ -1,3 +1,9 @@
+2010-06-21	Peter Dufault <dufault at hda.com>
+
+	PR 1570/cpukit
+	* posix/src/semtimedwait.c: This routine is supposed to return -1/errno
+	NOT the status directly.
+
 2010-06-21	Joel Sherrill <joel.sherrilL at OARcorp.com>
 
 	PR 1554/cpukit

diff -u rtems/cpukit/ChangeLog:1.2346.2.43 rtems/cpukit/ChangeLog:1.2346.2.44
--- rtems/cpukit/ChangeLog:1.2346.2.43	Mon Jun 21 11:27:11 2010
+++ rtems/cpukit/ChangeLog	Mon Jun 21 11:38:32 2010
@@ -1,3 +1,9 @@
+2010-06-21	Peter Dufault <dufault at hda.com>
+
+	PR 1570/cpukit
+	* posix/src/semtimedwait.c: This routine is supposed to return -1/errno
+	NOT the status directly.
+
 2010-06-21	Joel Sherrill <joel.sherrilL at OARcorp.com>
 
 	PR 1554/cpukit

diff -u rtems/cpukit/posix/src/semtimedwait.c:1.13 rtems/cpukit/posix/src/semtimedwait.c:1.14
--- rtems/cpukit/posix/src/semtimedwait.c:1.13	Mon Nov 30 09:44:21 2009
+++ rtems/cpukit/posix/src/semtimedwait.c	Mon Jun 21 11:38:26 2010
@@ -72,10 +72,10 @@
   if ( !do_wait && (lock_status == EBUSY) ) {
     switch (lock_status) {
       case POSIX_ABSOLUTE_TIMEOUT_INVALID:
-        return EINVAL;
+        rtems_set_errno_and_return_minus_one( EINVAL );
       case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
       case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
-        return ETIMEDOUT;
+        rtems_set_errno_and_return_minus_one( ETIMEDOUT );
       case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
         break;
     }

diff -u rtems/cpukit/posix/src/semtimedwait.c:1.4.2.3 rtems/cpukit/posix/src/semtimedwait.c:1.4.2.4
--- rtems/cpukit/posix/src/semtimedwait.c:1.4.2.3	Thu Jul 24 15:43:24 2008
+++ rtems/cpukit/posix/src/semtimedwait.c	Mon Jun 21 11:38:56 2010
@@ -69,10 +69,10 @@
   if ( !do_wait && (lock_status == EBUSY) ) {
     switch (lock_status) {
       case POSIX_ABSOLUTE_TIMEOUT_INVALID:
-        return EINVAL;
+        rtems_set_errno_and_return_minus_one( EINVAL );
       case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
       case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
-        return ETIMEDOUT;
+        rtems_set_errno_and_return_minus_one( ETIMEDOUT );
       case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
         break;
     }

diff -u rtems/cpukit/posix/src/semtimedwait.c:1.9.2.1 rtems/cpukit/posix/src/semtimedwait.c:1.9.2.2
--- rtems/cpukit/posix/src/semtimedwait.c:1.9.2.1	Tue Jul 22 12:17:12 2008
+++ rtems/cpukit/posix/src/semtimedwait.c	Mon Jun 21 11:38:47 2010
@@ -76,10 +76,10 @@
   if ( !do_wait && (lock_status == EBUSY) ) {
     switch (lock_status) {
       case POSIX_ABSOLUTE_TIMEOUT_INVALID:
-        return EINVAL;
+        rtems_set_errno_and_return_minus_one( EINVAL );
       case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
       case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
-        return ETIMEDOUT;
+        rtems_set_errno_and_return_minus_one( ETIMEDOUT );
       case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
         break;
     }

diff -u rtems/cpukit/posix/src/semtimedwait.c:1.11 rtems/cpukit/posix/src/semtimedwait.c:1.11.2.1
--- rtems/cpukit/posix/src/semtimedwait.c:1.11	Thu Sep  4 10:23:12 2008
+++ rtems/cpukit/posix/src/semtimedwait.c	Mon Jun 21 11:38:40 2010
@@ -76,10 +76,10 @@
   if ( !do_wait && (lock_status == EBUSY) ) {
     switch (lock_status) {
       case POSIX_ABSOLUTE_TIMEOUT_INVALID:
-        return EINVAL;
+        rtems_set_errno_and_return_minus_one( EINVAL );
       case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
       case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
-        return ETIMEDOUT;
+        rtems_set_errno_and_return_minus_one( ETIMEDOUT );
       case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
         break;
     }

diff -u rtems/cpukit/posix/src/semtimedwait.c:1.13 rtems/cpukit/posix/src/semtimedwait.c:1.13.2.1
--- rtems/cpukit/posix/src/semtimedwait.c:1.13	Mon Nov 30 09:44:21 2009
+++ rtems/cpukit/posix/src/semtimedwait.c	Mon Jun 21 11:38:34 2010
@@ -72,10 +72,10 @@
   if ( !do_wait && (lock_status == EBUSY) ) {
     switch (lock_status) {
       case POSIX_ABSOLUTE_TIMEOUT_INVALID:
-        return EINVAL;
+        rtems_set_errno_and_return_minus_one( EINVAL );
       case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
       case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
-        return ETIMEDOUT;
+        rtems_set_errno_and_return_minus_one( ETIMEDOUT );
       case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
         break;
     }


 *joel*:
2010-06-21	Joel Sherrill <joel.sherrill at oarcorp.com>

	* Makefile.am, configure.ac: New test for barrier create, ident, and
	delete.
	* tm30/.cvsignore, tm30/Makefile.am, tm30/init.c, tm30/tm30.doc: New
	files.

M   1.88  testsuites/tmtests/ChangeLog
M   1.15  testsuites/tmtests/Makefile.am
M   1.22  testsuites/tmtests/configure.ac
A    1.1  testsuites/tmtests/tm30/.cvsignore
A    1.1  testsuites/tmtests/tm30/Makefile.am
A    1.1  testsuites/tmtests/tm30/init.c
A    1.1  testsuites/tmtests/tm30/tm30.doc

diff -u rtems/testsuites/tmtests/ChangeLog:1.87 rtems/testsuites/tmtests/ChangeLog:1.88
--- rtems/testsuites/tmtests/ChangeLog:1.87	Tue Dec  8 11:53:00 2009
+++ rtems/testsuites/tmtests/ChangeLog	Mon Jun 21 11:53:50 2010
@@ -1,3 +1,10 @@
+2010-06-21	Joel Sherrill <joel.sherrill at oarcorp.com>
+
+	* Makefile.am, configure.ac: New test for barrier create, ident, and
+	delete.
+	* tm30/.cvsignore, tm30/Makefile.am, tm30/init.c, tm30/tm30.doc: New
+	files.
+
 2009-12-08	Joel Sherrill <joel.sherrill at oarcorp.com>
 
 	* tm20/task1.c: Use rtems_test_assert() consistently instead of system

diff -u rtems/testsuites/tmtests/Makefile.am:1.14 rtems/testsuites/tmtests/Makefile.am:1.15
--- rtems/testsuites/tmtests/Makefile.am:1.14	Tue Nov  8 08:17:00 2005
+++ rtems/testsuites/tmtests/Makefile.am	Mon Jun 21 11:53:50 2010
@@ -6,7 +6,7 @@
 
 SUBDIRS = tmck tmoverhd tm01 tm02 tm03 tm04 tm05 tm06 tm07 tm08 tm09 tm10 \
     tm11 tm12 tm13 tm14 tm15 tm16 tm17 tm18 tm19 tm20 tm21 tm22 tm23 tm24 \
-    tm25 tm26 tm27 tm28 tm29
+    tm25 tm26 tm27 tm28 tm29 tm30
 
 include $(top_srcdir)/../automake/subdirs.am
 include $(top_srcdir)/../automake/local.am

diff -u rtems/testsuites/tmtests/configure.ac:1.21 rtems/testsuites/tmtests/configure.ac:1.22
--- rtems/testsuites/tmtests/configure.ac:1.21	Mon Oct 19 23:14:56 2009
+++ rtems/testsuites/tmtests/configure.ac	Mon Jun 21 11:53:50 2010
@@ -61,5 +61,6 @@
 tm27/Makefile
 tm28/Makefile
 tm29/Makefile
+tm30/Makefile
 ])
 AC_OUTPUT

diff -u /dev/null rtems/testsuites/tmtests/tm30/.cvsignore:1.1
--- /dev/null	Mon Jun 21 12:11:59 2010
+++ rtems/testsuites/tmtests/tm30/.cvsignore	Mon Jun 21 11:53:50 2010
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in

diff -u /dev/null rtems/testsuites/tmtests/tm30/Makefile.am:1.1
--- /dev/null	Mon Jun 21 12:11:59 2010
+++ rtems/testsuites/tmtests/tm30/Makefile.am	Mon Jun 21 11:53:50 2010
@@ -0,0 +1,29 @@
+##
+## $Id$
+##
+
+MANAGERS = io rate_monotonic semaphore
+
+rtems_tests_PROGRAMS = tm30
+tm30_SOURCES = init.c ../include/timesys.h \
+    ../../support/src/tmtests_empty_function.c \
+    ../../support/src/tmtests_support.c
+
+dist_rtems_tests_DATA = tm30.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+OPERATION_COUNT = @OPERATION_COUNT@
+AM_CPPFLAGS += -I$(top_srcdir)/include -DOPERATION_COUNT=$(OPERATION_COUNT)
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(tm30_OBJECTS) $(tm30_LDADD)
+LINK_LIBS = $(tm30_LDLIBS)
+
+tm30$(EXEEXT): $(tm30_OBJECTS) $(tm30_DEPENDENCIES)
+	@rm -f tm30$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am

diff -u /dev/null rtems/testsuites/tmtests/tm30/init.c:1.1
--- /dev/null	Mon Jun 21 12:11:59 2010
+++ rtems/testsuites/tmtests/tm30/init.c	Mon Jun 21 11:53:50 2010
@@ -0,0 +1,106 @@
+/*
+ *  COPYRIGHT (c) 1989-2010.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#include <bsp.h>
+#include <coverhd.h>
+#include <tmacros.h>
+#include <timesys.h>
+#include "test_support.h"
+
+rtems_id barrier[ OPERATION_COUNT ];
+
+void benchmark_barrier_create(
+  int    iteration,
+  void  *argument
+)
+{
+  rtems_status_code status;
+
+  status = rtems_barrier_create(
+    iteration + 1,
+    RTEMS_LOCAL | RTEMS_FIFO,
+    2,
+    &barrier[iteration]
+  );
+  directive_failed(status, "rtems_barrier_create");
+}
+
+void benchmark_barrier_ident(
+  int    iteration,
+  void  *argument
+)
+{
+  rtems_status_code status;
+  rtems_id          id;
+
+  status = rtems_barrier_ident( iteration+1, &id );
+  directive_failed(status, "rtems_barrier_ident");
+}
+
+void benchmark_barrier_delete(
+  int    iteration,
+  void  *argument
+)
+{
+  rtems_status_code status;
+
+  status = rtems_barrier_delete( barrier[iteration] );
+  directive_failed(status, "rtems_barrier_delete");
+}
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  puts( "\n\n*** TIME TEST 30 ***" );
+
+  rtems_time_test_measure_operation(
+    "rtems_barrier_create",
+    benchmark_barrier_create,
+    NULL,
+    OPERATION_COUNT,
+    0
+  );
+  
+  rtems_time_test_measure_operation(
+    "rtems_barrier_ident",
+    benchmark_barrier_ident,
+    NULL,
+    OPERATION_COUNT,
+    0
+  );
+  
+  rtems_time_test_measure_operation(
+    "rtems_barrier_delete",
+    benchmark_barrier_delete,
+    NULL,
+    OPERATION_COUNT,
+    0
+  );
+  
+  puts( "*** END OF TIME TEST 30 ***" );
+
+  rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS             1
+#define CONFIGURE_MAXIMUM_BARRIERS          OPERATION_COUNT
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */

diff -u /dev/null rtems/testsuites/tmtests/tm30/tm30.doc:1.1
--- /dev/null	Mon Jun 21 12:11:59 2010
+++ rtems/testsuites/tmtests/tm30/tm30.doc	Mon Jun 21 11:53:50 2010
@@ -0,0 +1,15 @@
+#
+#  $Id$
+#
+#  COPYRIGHT (c) 1989-2010.
+#  On-Line Applications Research Corporation (OAR).
+#
+#  The license and distribution terms for this file may be
+#  found in the file LICENSE in this distribution or at
+#  http://www.rtems.com/license/LICENSE.
+#
+
+This test benchmarks the following operations:
+
++ rtems_barrier_create
++ rtems_barrier_delete


 *joel*:
2010-06-21	Joel Sherrill <joel.sherrill at oarcorp.com>

	* support/include/test_support.h, support/src/tmtests_empty_function.c:
	Add helper so it is easier to write a basic repeated operation
	tmtest.
	* support/src/tmtests_support.c: New file.

M  1.167  testsuites/ChangeLog
M    1.4  testsuites/support/include/test_support.h
M    1.3  testsuites/support/src/tmtests_empty_function.c
A    1.1  testsuites/support/src/tmtests_support.c

diff -u rtems/testsuites/ChangeLog:1.166 rtems/testsuites/ChangeLog:1.167
--- rtems/testsuites/ChangeLog:1.166	Thu Jun 17 11:02:31 2010
+++ rtems/testsuites/ChangeLog	Mon Jun 21 11:54:17 2010
@@ -1,3 +1,10 @@
+2010-06-21	Joel Sherrill <joel.sherrill at oarcorp.com>
+
+	* support/include/test_support.h, support/src/tmtests_empty_function.c:
+	Add helper so it is easier to write a basic repeated operation
+	tmtest.
+	* support/src/tmtests_support.c: New file.
+
 2010-06-17	Ralf Corsépius <ralf.corsepius at rtems.org>
 
 	* configure.ac: Remove itron.

diff -u rtems/testsuites/support/include/test_support.h:1.3 rtems/testsuites/support/include/test_support.h:1.4
--- rtems/testsuites/support/include/test_support.h:1.3	Tue Dec  8 15:39:21 2009
+++ rtems/testsuites/support/include/test_support.h	Mon Jun 21 11:54:17 2010
@@ -46,6 +46,31 @@
  */
 void rtems_test_spin_until_next_tick( void );
 
+/*********************************************************************/
+/*********************************************************************/
+/**************              TMTEST SUPPORT             **************/
+/*********************************************************************/
+/*********************************************************************/
+
+/*
+ *  Type of method used for timing operations
+ */
+typedef void (*rtems_time_test_method_t)(
+  int    iteration,
+  void  *argument
+);
+
+/*
+ *  Obtain baseline timing information for benchmark tests.
+ */
+void rtems_time_test_measure_operation(
+  const char               *description,
+  rtems_time_test_method_t  operation,
+  void                     *argument,
+  int                       iterations,
+  int                       overhead
+);
+
 #ifdef __cplusplus
 };
 #endif

diff -u rtems/testsuites/support/src/tmtests_empty_function.c:1.2 rtems/testsuites/support/src/tmtests_empty_function.c:1.3
--- rtems/testsuites/support/src/tmtests_empty_function.c:1.2	Sun May 10 09:43:44 2009
+++ rtems/testsuites/support/src/tmtests_empty_function.c	Mon Jun 21 11:54:17 2010
@@ -20,3 +20,10 @@
 {
   return RTEMS_SUCCESSFUL;
 }
+
+void benchmark_timer_empty_operation(
+  int    iteration,
+  void  *argument
+)
+{
+}

diff -u /dev/null rtems/testsuites/support/src/tmtests_support.c:1.1
--- /dev/null	Mon Jun 21 12:12:00 2010
+++ rtems/testsuites/support/src/tmtests_support.c	Mon Jun 21 11:54:17 2010
@@ -0,0 +1,53 @@
+/*
+ *  COPYRIGHT (c) 1989-2010.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/timerdrv.h>
+#include "test_support.h"
+#include "timesys.h"
+
+extern void benchmark_timer_empty_operation(
+  int    iteration,
+  void  *argument
+);
+
+void rtems_time_test_measure_operation(
+  const char               *description,
+  rtems_time_test_method_t  operation,
+  void                     *argument,
+  int                       iterations,
+  int                       overhead
+)
+{
+  int i;
+  int loop_overhead;
+  int end_time;
+
+  benchmark_timer_initialize();
+    for (i=0 ; i<iterations ; i++ ) {
+      benchmark_timer_empty_operation( i, argument );
+    }
+  loop_overhead = benchmark_timer_read();
+
+  benchmark_timer_initialize();
+    for (i=0 ; i<iterations ; i++ ) {
+      (*operation)( i, argument );
+    }
+  end_time = benchmark_timer_read();
+
+  put_time(
+    description,
+    end_time,
+    iterations,
+    loop_overhead,
+    overhead
+  );
+}



--

Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20100621/887ef2e9/attachment.html>


More information about the vc mailing list