@echo "Linking platform/$(PLATFORM)..."
@cd internals && ln -s ../platform/$(PLATFORM)/internals/_PDCLIB_config.h
@cd includes && ln -s ../platform/$(PLATFORM)/includes/float.h
- @cd testing && ln -s ../platform/$(PLATFORM)/testing/printf_reference.txt
@cd functions/_PDCLIB && for file in $(PATCHFILES1); do basfile=`basename $$file`; if [ ! -f $$basfile ]; then ln -s `ls ../../$$file` .; fi; done
@cd functions/stdlib && for file in $(PATCHFILES2); do basfile=`basename $$file`; if [ ! -f $$basfile ]; then ln -s `ls ../../$$file` .; fi; done
@cd functions/stdio && for file in $(PATCHFILES3); do basfile=`basename $$file`; if [ ! -f $$basfile ]; then ln -s `ls ../../$$file` .; fi; done
@echo "Unlinking platform files..."
@if [ -f internals/_PDCLIB_config.h ]; then rm internals/_PDCLIB_config.h; fi
@if [ -f includes/float.h ]; then rm includes/float.h; fi
- @if [ -f testing/printf_reference.txt ]; then rm testing/printf_reference.txt; fi
@cd functions/_PDCLIB && for file in $(PATCHFILES1); do basfile=`basename $$file`; if [ -f $$basfile ]; then rm $$basfile; fi; done
@cd functions/stdlib && for file in $(PATCHFILES2); do basfile=`basename $$file`; if [ -f $$basfile ]; then rm $$basfile; fi; done
@cd functions/stdio && for file in $(PATCHFILES3); do basfile=`basename $$file`; if [ -f $$basfile ]; then rm $$basfile; fi; done
int main( void )
{
FILE * fh;
- remove( "testing/testfile" );
- TESTCASE( ( fh = fopen( "testing/testfile", "w+" ) ) != NULL );
+ TESTCASE( ( fh = tmpfile() ) != NULL );
/* Flags should be clear */
TESTCASE( ! ferror( fh ) );
TESTCASE( ! feof( fh ) );
TESTCASE( ! ferror( fh ) );
TESTCASE( ! feof( fh ) );
TESTCASE( fclose( fh ) == 0 );
- remove( "testing/testfile" );
return TEST_RESULTS;
}
int main( void )
{
FILE * target;
- TESTCASE( ( target = fopen( "testing/testfile", "wb+" ) ) != NULL );
+ TESTCASE( ( target = tmpfile() ) != NULL );
#include "printf_testcases.incl"
TESTCASE( fclose( target ) == 0 );
- TESTCASE( remove( "testing/testfile" ) == 0 );
return TEST_RESULTS;
}
{
char const * const message = "SUCCESS testing fputs()";
FILE * fh;
- remove( testfile );
- TESTCASE( ( fh = fopen( testfile, "w+" ) ) != NULL );
+ TESTCASE( ( fh = tmpfile() ) != NULL );
TESTCASE( fputs( message, fh ) >= 0 );
rewind( fh );
for ( size_t i = 0; i < 23; ++i )
TESTCASE( fgetc( fh ) == message[i] );
}
TESTCASE( fclose( fh ) == 0 );
- TESTCASE( remove( testfile ) == 0 );
return TEST_RESULTS;
}
int main( void )
{
FILE * fh;
- remove( testfile );
- TESTCASE( ( fh = fopen( testfile, "w" ) ) != NULL );
+ TESTCASE( ( fh = tmpfile() ) != NULL );
TESTCASE( fwrite( "SUCCESS testing fwrite()\n", 1, 25, fh ) == 25 );
- TESTCASE( fclose( fh ) == 0 );
/* TODO: Add readback test. */
- TESTCASE( remove( testfile ) == 0 );
+ TESTCASE( fclose( fh ) == 0 );
return TEST_RESULTS;
}
*/
char * buffer = (char*)malloc( 4 );
FILE * fh;
- remove( testfile );
- TESTCASE( ( fh = fopen( testfile, "w+" ) ) != NULL );
+ TESTCASE( ( fh = tmpfile() ) != NULL );
TESTCASE( setvbuf( fh, buffer, _IOLBF, 4 ) == 0 );
TESTCASE( fputc( '1', fh ) == '1' );
TESTCASE( fputc( '2', fh ) == '2' );
TESTCASE_NOREG( fh->bufidx == 0 );
/* Reading back first character after rewind for basic read check */
TESTCASE( fgetc( fh ) == '1' );
- TESTCASE( fclose( fh ) == 0 );
/* TODO: t.b.c. */
- remove( testfile );
+ TESTCASE( fclose( fh ) == 0 );
return TEST_RESULTS;
}
int main( void )
{
FILE * fh;
- remove( testfile );
- TESTCASE( ( fh = fopen( testfile, "w" ) ) != NULL );
+ TESTCASE( ( fh = tmpfile() ) != NULL );
TESTCASE( fwrite( "SUCCESS testing fwrite()\n", 1, 25, fh ) == 25 );
- TESTCASE( fclose( fh ) == 0 );
/* TODO: Add readback test. */
- TESTCASE( remove( testfile ) == 0 );
+ TESTCASE( fclose( fh ) == 0 );
return TEST_RESULTS;
}
#ifndef REGTEST
char buffer[ BUFSIZ + 1 ];
FILE * fh;
- remove( testfile );
/* full buffered */
- TESTCASE( ( fh = fopen( testfile, "w" ) ) != NULL );
+ TESTCASE( ( fh = tmpfile() ) != NULL );
setbuf( fh, buffer );
TESTCASE( fh->buffer == buffer );
TESTCASE( fh->bufsize == BUFSIZ );
TESTCASE( ( fh->status & ( _IOFBF | _IONBF | _IOLBF ) ) == _IOFBF );
TESTCASE( fclose( fh ) == 0 );
- TESTCASE( remove( testfile ) == 0 );
/* not buffered */
- TESTCASE( ( fh = fopen( testfile, "w" ) ) != NULL );
+ TESTCASE( ( fh = tmpfile() ) != NULL );
setbuf( fh, NULL );
TESTCASE( ( fh->status & ( _IOFBF | _IONBF | _IOLBF ) ) == _IONBF );
TESTCASE( fclose( fh ) == 0 );
- TESTCASE( remove( testfile ) == 0 );
#else
puts( " NOTEST setbuf() test driver is PDCLib-specific." );
#endif
#ifndef REGTEST
char buffer[ BUFFERSIZE ];
FILE * fh;
- remove( testfile );
/* full buffered, user-supplied buffer */
- TESTCASE( ( fh = fopen( testfile, "w" ) ) != NULL );
+ TESTCASE( ( fh = tmpfile() ) != NULL );
TESTCASE( setvbuf( fh, buffer, _IOFBF, BUFFERSIZE ) == 0 );
TESTCASE( fh->buffer == buffer );
TESTCASE( fh->bufsize == BUFFERSIZE );
TESTCASE( ( fh->status & ( _IOFBF | _IONBF | _IOLBF ) ) == _IOFBF );
TESTCASE( fclose( fh ) == 0 );
- TESTCASE( remove( testfile ) == 0 );
/* line buffered, lib-supplied buffer */
- TESTCASE( ( fh = fopen( testfile, "w" ) ) != NULL );
+ TESTCASE( ( fh = tmpfile() ) != NULL );
TESTCASE( setvbuf( fh, NULL, _IOLBF, BUFFERSIZE ) == 0 );
TESTCASE( fh->buffer != NULL );
TESTCASE( fh->bufsize == BUFFERSIZE );
TESTCASE( ( fh->status & ( _IOFBF | _IONBF | _IOLBF ) ) == _IOLBF );
TESTCASE( fclose( fh ) == 0 );
- TESTCASE( remove( testfile ) == 0 );
/* not buffered, user-supplied buffer */
- TESTCASE( ( fh = fopen( testfile, "w" ) ) != NULL );
+ TESTCASE( ( fh = tmpfile() ) != NULL );
TESTCASE( setvbuf( fh, buffer, _IONBF, BUFFERSIZE ) == 0 );
TESTCASE( ( fh->status & ( _IOFBF | _IONBF | _IOLBF ) ) == _IONBF );
TESTCASE( fclose( fh ) == 0 );
- TESTCASE( remove( testfile ) == 0 );
#else
puts( " NOTEST setvbuf() test driver is PDCLib-specific." );
#endif
int main( void )
{
FILE * target;
- TESTCASE( ( target = fopen( testfile, "wb+" ) ) != NULL );
+ TESTCASE( ( target = tmpfile() ) != NULL );
#include "printf_testcases.incl"
TESTCASE( fclose( target ) == 0 );
- TESTCASE( remove( testfile ) == 0 );
return TEST_RESULTS;
}