[PATCH 1/2] sapi: Add <rtems/test.h>

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Mar 11 07:33:47 UTC 2014


On 2014-03-10 20:10, Sebastian Huber wrote:
> On 03/10/2014 06:55 PM, Joel Sherrill wrote:
>> testsuites/support
>
> Ok, I would like to avoid the massive copy and paste in the Makefiles.
>

I would like to move away from the existing test support.  The problem is that 
you have to add at least this in every test Makefile.am:

test_SOURCES += ../../support/src/test_support.c
AM_CPPFLAGS += -I$(top_srcdir)/../support/include

I consider ../ paths in Makefiles as hacks.

You have to compile test_support.c again for each tests which increases the 
build times.

You have also hacks like this in a header file (buffer_test_io.h):

   #if defined(TEST_INIT) || defined(CONFIGURE_INIT)

     char _test_output_buffer[_TEST_OUTPUT_BUFFER_SIZE];
     int _test_output_buffer_index = 0;

     void _test_output_append(char *_buffer)
     {
       char *p;

       for ( p=_buffer ; *p ; p++ ) {
         _test_output_buffer[_test_output_buffer_index++] = *p;
         _test_output_buffer[_test_output_buffer_index]   = '\0';
         #if 0
	  if ( *p == '\n' ) {
	    fprintf( stderr, "BUFFER -- %s", _test_output_buffer );
	    _test_output_buffer_index = 0;
	   _test_output_buffer[0]   = '\0';
	  }
         #endif
	if ( _test_output_buffer_index >= (_TEST_OUTPUT_BUFFER_SIZE - 80) )
	  _test_output_flush();
       }
     }

     #include <termios.h>
     #include <unistd.h>

     void _test_output_flush(void)
     {
       fprintf( stderr, "%s", _test_output_buffer );
       _test_output_buffer_index = 0;
       tcdrain( 2 );
     }

     #endif


What is the disadvantage of moving this into a general purpose library?

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list