fix main_test.function to use polarssl (f)printf functions
diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function
index 9ebd9c3..4a5e104 100644
--- a/tests/suites/main_test.function
+++ b/tests/suites/main_test.function
@@ -5,6 +5,7 @@
#include "polarssl/platform.h"
#else
#define polarssl_printf printf
+#define polarssl_fprintf fprintf
#define polarssl_malloc malloc
#define polarssl_free free
#endif
@@ -25,8 +26,8 @@
test_errors++;
if( test_errors == 1 )
- printf( "FAILED\n" );
- printf( " %s\n", test );
+ polarssl_printf( "FAILED\n" );
+ polarssl_printf( " %s\n", test );
return( 1 );
}
@@ -41,7 +42,7 @@
if( (*str)[0] != '"' ||
(*str)[strlen( *str ) - 1] != '"' )
{
- printf( "Expected string (with \"\") for parameter and got: %s\n", *str );
+ polarssl_printf( "Expected string (with \"\") for parameter and got: %s\n", *str );
return( -1 );
}
@@ -94,7 +95,7 @@
MAPPING_CODE
- printf( "Expected integer for parameter and got: %s\n", str );
+ polarssl_printf( "Expected integer for parameter and got: %s\n", str );
return( -1 );
}
@@ -120,7 +121,7 @@
#if defined(TEST_SUITE_ACTIVE)
DISPATCH_FUNCTION
{
- fprintf( stdout, "FAILED\nSkipping unknown test function '%s'\n", params[0] );
+ polarssl_fprintf( stdout, "FAILED\nSkipping unknown test function '%s'\n", params[0] );
fflush( stdout );
return( 1 );
}
@@ -224,7 +225,7 @@
file = fopen( filename, "r" );
if( file == NULL )
{
- fprintf( stderr, "Failed to open\n" );
+ polarssl_fprintf( stderr, "Failed to open\n" );
return( 1 );
}
@@ -234,11 +235,11 @@
if( ( ret = get_line( file, buf, sizeof(buf) ) ) != 0 )
break;
- fprintf( stdout, "%s%.66s", test_errors ? "\n" : "", buf );
- fprintf( stdout, " " );
+ polarssl_fprintf( stdout, "%s%.66s", test_errors ? "\n" : "", buf );
+ polarssl_fprintf( stdout, " " );
for( i = strlen( buf ) + 1; i < 67; i++ )
- fprintf( stdout, "." );
- fprintf( stdout, " " );
+ polarssl_fprintf( stdout, "." );
+ polarssl_fprintf( stdout, " " );
fflush( stdout );
total_tests++;
@@ -267,17 +268,17 @@
if( skip == 1 || ret == 3 )
{
total_skipped++;
- fprintf( stdout, "----\n" );
+ polarssl_fprintf( stdout, "----\n" );
fflush( stdout );
}
else if( ret == 0 && test_errors == 0 )
{
- fprintf( stdout, "PASS\n" );
+ polarssl_fprintf( stdout, "PASS\n" );
fflush( stdout );
}
else if( ret == 2 )
{
- fprintf( stderr, "FAILED: FATAL PARSE ERROR\n" );
+ polarssl_fprintf( stderr, "FAILED: FATAL PARSE ERROR\n" );
fclose(file);
exit( 2 );
}
@@ -288,19 +289,19 @@
break;
if( strlen(buf) != 0 )
{
- fprintf( stderr, "Should be empty %d\n", (int) strlen(buf) );
+ polarssl_fprintf( stderr, "Should be empty %d\n", (int) strlen(buf) );
return( 1 );
}
}
fclose(file);
- fprintf( stdout, "\n----------------------------------------------------------------------------\n\n");
+ polarssl_fprintf( stdout, "\n----------------------------------------------------------------------------\n\n");
if( total_errors == 0 )
- fprintf( stdout, "PASSED" );
+ polarssl_fprintf( stdout, "PASSED" );
else
- fprintf( stdout, "FAILED" );
+ polarssl_fprintf( stdout, "FAILED" );
- fprintf( stdout, " (%d / %d tests (%d skipped))\n",
+ polarssl_fprintf( stdout, " (%d / %d tests (%d skipped))\n",
total_tests - total_errors, total_tests, total_skipped );
#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && \