From 2040228f27d623585d339dec175c4e779ca9edb5 Mon Sep 17 00:00:00 2001 From: Martin Baute Date: Thu, 17 Mar 2016 22:04:52 +0100 Subject: [PATCH] No exceptions to regtestdrivers anymore. --- Makefile | 4 +--- functions/_PDCLIB/atomax.c | 7 ++++++- functions/_PDCLIB/closeall.c | 4 ++++ functions/_PDCLIB/filemode.c | 6 ++++++ functions/_PDCLIB/prepread.c | 3 +++ functions/_PDCLIB/prepwrite.c | 4 ++++ functions/_PDCLIB/print.c | 9 +++++++++ functions/_PDCLIB/scan.c | 7 +++++++ functions/_PDCLIB/strtox_main.c | 7 ++++++- functions/_PDCLIB/strtox_prelim.c | 6 ++++++ platform/example/functions/_PDCLIB/allocpages.c | 6 ++++-- 11 files changed, 56 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 72f8071..0d0c8e0 100644 --- a/Makefile +++ b/Makefile @@ -7,14 +7,12 @@ PROJDIRS := functions includes internals platform/example SRCFILES := $(shell find -L $(PROJDIRS) -type f -name "*.c") # All header files of the project HDRFILES := $(shell find -L $(PROJDIRS) -type f -name "*.h") -# All .c files in functions/_PDCLIB that do not have a regression test driver -INTFILES := _Exit atomax digits open print scan remove rename seed stdinit strtox_main strtox_prelim filemode eol errno seek prepread prepwrite allocpages tmpfilename closeall # All object files in the library OBJFILES := $(patsubst %.c,%.o,$(SRCFILES)) # All test drivers (.t) TSTFILES := $(patsubst %.c,%_t,$(SRCFILES)) # All regression test drivers (.r) -REGFILES := $(filter-out $(patsubst %,functions/_PDCLIB/%_r,$(INTFILES)),$(patsubst %.c,%_r,$(SRCFILES))) +REGFILES := $(patsubst %.c,%_r,$(SRCFILES)) # All library dependency files (.d) DEPFILES := $(patsubst %.c,%.d,$(SRCFILES)) # All test driver dependency files (_t.d) diff --git a/functions/_PDCLIB/atomax.c b/functions/_PDCLIB/atomax.c index 2c860cf..f05a8af 100644 --- a/functions/_PDCLIB/atomax.c +++ b/functions/_PDCLIB/atomax.c @@ -4,10 +4,11 @@ Permission is granted to use, modify, and / or redistribute at will. */ -#include "_PDCLIB_int.h" #include #include +#ifndef REGTEST + _PDCLIB_intmax_t _PDCLIB_atomax( const char * s ) { _PDCLIB_intmax_t rc = 0; @@ -25,15 +26,19 @@ _PDCLIB_intmax_t _PDCLIB_atomax( const char * s ) return ( sign == '+' ) ? rc : -rc; } +#endif + #ifdef TEST #include "_PDCLIB_test.h" int main( void ) { +#ifndef REGTEST /* basic functionality */ TESTCASE( _PDCLIB_atomax( "123" ) == 123 ); /* testing skipping of leading whitespace and trailing garbage */ TESTCASE( _PDCLIB_atomax( " \n\v\t\f123xyz" ) == 123 ); +#endif return TEST_RESULTS; } diff --git a/functions/_PDCLIB/closeall.c b/functions/_PDCLIB/closeall.c index 0bc4278..6c2bed4 100644 --- a/functions/_PDCLIB/closeall.c +++ b/functions/_PDCLIB/closeall.c @@ -6,6 +6,8 @@ #include +#ifndef REGTEST + extern struct _PDCLIB_file_t * _PDCLIB_filelist; void _PDCLIB_closeall( void ) @@ -20,6 +22,8 @@ void _PDCLIB_closeall( void ) } } +#endif + #ifdef TEST #include "_PDCLIB_test.h" diff --git a/functions/_PDCLIB/filemode.c b/functions/_PDCLIB/filemode.c index 0eca392..9c3ec24 100644 --- a/functions/_PDCLIB/filemode.c +++ b/functions/_PDCLIB/filemode.c @@ -6,6 +6,8 @@ #include +#ifndef REGTEST + /* Helper function that parses the C-style mode string passed to fopen() into the PDCLib flags FREAD, FWRITE, FAPPEND, FRW (read-write) and FBIN (binary mode). @@ -52,11 +54,14 @@ unsigned int _PDCLIB_filemode( char const * const mode ) return 0; } +#endif + #ifdef TEST #include "_PDCLIB_test.h" int main( void ) { +#ifndef REGTEST TESTCASE( _PDCLIB_filemode( "r" ) == _PDCLIB_FREAD ); TESTCASE( _PDCLIB_filemode( "w" ) == _PDCLIB_FWRITE ); TESTCASE( _PDCLIB_filemode( "a" ) == ( _PDCLIB_FAPPEND | _PDCLIB_FWRITE ) ); @@ -76,6 +81,7 @@ int main( void ) TESTCASE( _PDCLIB_filemode( "r++" ) == 0 ); TESTCASE( _PDCLIB_filemode( "wbb" ) == 0 ); TESTCASE( _PDCLIB_filemode( "a+bx" ) == 0 ); +#endif return TEST_RESULTS; } diff --git a/functions/_PDCLIB/prepread.c b/functions/_PDCLIB/prepread.c index 345f70b..2c5818a 100644 --- a/functions/_PDCLIB/prepread.c +++ b/functions/_PDCLIB/prepread.c @@ -6,6 +6,7 @@ #include +#ifndef REGTEST #include "_PDCLIB_glue.h" int _PDCLIB_prepread( struct _PDCLIB_file_t * stream ) @@ -33,6 +34,8 @@ int _PDCLIB_prepread( struct _PDCLIB_file_t * stream ) } } +#endif + #ifdef TEST #include "_PDCLIB_test.h" diff --git a/functions/_PDCLIB/prepwrite.c b/functions/_PDCLIB/prepwrite.c index fa46e46..a901ccd 100644 --- a/functions/_PDCLIB/prepwrite.c +++ b/functions/_PDCLIB/prepwrite.c @@ -6,6 +6,8 @@ #include +#ifndef REGTEST + int _PDCLIB_prepwrite( struct _PDCLIB_file_t * stream ) { if ( ( stream->bufidx < stream->bufend ) || ( stream->ungetidx > 0 ) || @@ -24,6 +26,8 @@ int _PDCLIB_prepwrite( struct _PDCLIB_file_t * stream ) return 0; } +#endif + #ifdef TEST #include "_PDCLIB_test.h" diff --git a/functions/_PDCLIB/print.c b/functions/_PDCLIB/print.c index 076cbed..768b4a6 100644 --- a/functions/_PDCLIB/print.c +++ b/functions/_PDCLIB/print.c @@ -10,6 +10,8 @@ #include #include +#ifndef REGTEST + /* Using an integer's bits as flags for both the conversion flags and length modifiers. */ @@ -513,12 +515,16 @@ const char * _PDCLIB_print( const char * spec, struct _PDCLIB_status_t * status return ++spec; } +#endif + #ifdef TEST #define _PDCLIB_FILEID "_PDCLIB/print.c" #define _PDCLIB_STRINGIO #include "_PDCLIB_test.h" +#ifndef REGTEST + static int testprintf( char * buffer, const char * format, ... ) { /* Members: base, flags, n, i, current, s, width, prec, stream, arg */ @@ -542,13 +548,16 @@ static int testprintf( char * buffer, const char * format, ... ) va_end( status.arg ); return status.i; } +#endif #define TEST_CONVERSION_ONLY int main( void ) { +#ifndef REGTEST char target[100]; #include "printf_testcases.h" +#endif return TEST_RESULTS; } diff --git a/functions/_PDCLIB/scan.c b/functions/_PDCLIB/scan.c index 5d9d675..7d11a9c 100644 --- a/functions/_PDCLIB/scan.c +++ b/functions/_PDCLIB/scan.c @@ -14,6 +14,8 @@ #include #include +#ifndef REGTEST + /* Using an integer's bits as flags for both the conversion flags and length modifiers. */ @@ -592,6 +594,7 @@ const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status ) return NULL; } +#endif #ifdef TEST #define _PDCLIB_FILEID "_PDCLIB/scan.c" @@ -599,6 +602,7 @@ const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status ) #include "_PDCLIB_test.h" +#ifndef REGTEST static int testscanf( char const * s, char const * format, ... ) { struct _PDCLIB_status_t status; @@ -615,13 +619,16 @@ static int testscanf( char const * s, char const * format, ... ) va_end( status.arg ); return status.n; } +#endif #define TEST_CONVERSION_ONLY int main( void ) { +#ifndef REGTEST char source[100]; #include "scanf_testcases.h" +#endif return TEST_RESULTS; } diff --git a/functions/_PDCLIB/strtox_main.c b/functions/_PDCLIB/strtox_main.c index accdb6f..3bfdbb8 100644 --- a/functions/_PDCLIB/strtox_main.c +++ b/functions/_PDCLIB/strtox_main.c @@ -4,12 +4,13 @@ Permission is granted to use, modify, and / or redistribute at will. */ -#include "_PDCLIB_int.h" #include #include #include #include +#ifndef REGTEST + _PDCLIB_uintmax_t _PDCLIB_strtox_main( const char ** p, unsigned int base, uintmax_t error, uintmax_t limval, int limdigit, char * sign ) { _PDCLIB_uintmax_t rc = 0; @@ -42,12 +43,15 @@ _PDCLIB_uintmax_t _PDCLIB_strtox_main( const char ** p, unsigned int base, uintm return rc; } +#endif + #ifdef TEST #include "_PDCLIB_test.h" #include int main( void ) { +#ifndef REGTEST const char * p; char test[] = "123_"; char fail[] = "xxx"; @@ -75,6 +79,7 @@ int main( void ) sign = '-'; TESTCASE( _PDCLIB_strtox_main( &p, 10u, (uintmax_t)999, (uintmax_t)99, 8, &sign ) == 0 ); TESTCASE( p == NULL ); +#endif return TEST_RESULTS; } diff --git a/functions/_PDCLIB/strtox_prelim.c b/functions/_PDCLIB/strtox_prelim.c index 6762515..98f7fce 100644 --- a/functions/_PDCLIB/strtox_prelim.c +++ b/functions/_PDCLIB/strtox_prelim.c @@ -8,6 +8,8 @@ #include #include +#ifndef REGTEST + const char * _PDCLIB_strtox_prelim( const char * p, char * sign, int * base ) { /* skipping leading whitespace */ @@ -49,11 +51,14 @@ const char * _PDCLIB_strtox_prelim( const char * p, char * sign, int * base ) return ( ( *base >= 2 ) && ( *base <= 36 ) ) ? p : NULL; } +#endif + #ifdef TEST #include "_PDCLIB_test.h" int main( void ) { +#ifndef REGTEST int base = 0; char sign = '\0'; char test1[] = " 123"; @@ -81,6 +86,7 @@ int main( void ) TESTCASE( _PDCLIB_strtox_prelim( test3, &sign, &base ) == NULL ); base = 37; TESTCASE( _PDCLIB_strtox_prelim( test3, &sign, &base ) == NULL ); +#endif return TEST_RESULTS; } diff --git a/platform/example/functions/_PDCLIB/allocpages.c b/platform/example/functions/_PDCLIB/allocpages.c index 081adfb..f3414bb 100644 --- a/platform/example/functions/_PDCLIB/allocpages.c +++ b/platform/example/functions/_PDCLIB/allocpages.c @@ -11,6 +11,8 @@ #include #include +#ifndef REGTEST + int brk( void * ); void * sbrk( intptr_t ); @@ -53,13 +55,14 @@ void * _PDCLIB_allocpages( int const n ) } } +#endif + #ifdef TEST #include "_PDCLIB_test.h" int main( void ) { #ifndef REGTEST - { char * startbreak = sbrk( 0 ); TESTCASE( _PDCLIB_allocpages( 0 ) ); TESTCASE( ( (char *)sbrk( 0 ) - startbreak ) <= _PDCLIB_PAGESIZE ); @@ -70,7 +73,6 @@ int main( void ) TESTCASE( sbrk( 0 ) == startbreak + ( 6 * _PDCLIB_PAGESIZE ) ); TESTCASE( _PDCLIB_allocpages( -3 ) ); TESTCASE( sbrk( 0 ) == startbreak + ( 3 * _PDCLIB_PAGESIZE ) ); - } #endif return TEST_RESULTS; } -- 2.40.0