mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 02:45:44 +01:00
Parameterised the test suite applications
All test suites can now take an arbitrary test file.
This commit is contained in:
parent
e846b5128f
commit
aad787f1c7
@ -240,10 +240,13 @@ static int run_test_snprintf( void )
|
||||
test_snprintf( 5, "123", 3 ) != 0 );
|
||||
}
|
||||
|
||||
int main()
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
int ret, i, cnt, total_errors = 0, total_tests = 0, total_skipped = 0;
|
||||
const char *filename = "TEST_FILENAME";
|
||||
int testfile_index, testfile_count, ret, i, cnt;
|
||||
int total_errors = 0, total_tests = 0, total_skipped = 0;
|
||||
const char *default_filename = "TEST_FILENAME";
|
||||
const char *test_filename = NULL;
|
||||
const char **test_files = NULL;
|
||||
FILE *file;
|
||||
char buf[5000];
|
||||
char *params[50];
|
||||
@ -276,10 +279,28 @@ int main()
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
file = fopen( filename, "r" );
|
||||
if ( argc <= 1 )
|
||||
{
|
||||
test_files = &default_filename;
|
||||
testfile_count = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
test_files = &argv[1];
|
||||
testfile_count = argc - 1;
|
||||
}
|
||||
|
||||
for ( testfile_index = 0;
|
||||
testfile_index < testfile_count;
|
||||
testfile_index++ )
|
||||
{
|
||||
test_filename = test_files[ testfile_index ];
|
||||
|
||||
file = fopen( test_filename, "r" );
|
||||
if( file == NULL )
|
||||
{
|
||||
mbedtls_fprintf( stderr, "Failed to open\n" );
|
||||
mbedtls_fprintf( stderr, "Failed to open test file: %s\n",
|
||||
test_filename );
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
@ -343,11 +364,13 @@ int main()
|
||||
break;
|
||||
if( strlen(buf) != 0 )
|
||||
{
|
||||
mbedtls_fprintf( stderr, "Should be empty %d\n", (int) strlen(buf) );
|
||||
mbedtls_fprintf( stderr, "Should be empty %d\n",
|
||||
(int) strlen(buf) );
|
||||
return( 1 );
|
||||
}
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
mbedtls_fprintf( stdout, "\n----------------------------------------------------------------------------\n\n");
|
||||
if( total_errors == 0 )
|
||||
|
Loading…
Reference in New Issue
Block a user