Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
More debugging information when test fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbens committed Aug 6, 2009
1 parent 99b4336 commit 65d4f2b
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 46 deletions.
83 changes: 46 additions & 37 deletions test/automated/platform/platform.c
Expand Up @@ -132,71 +132,80 @@ static void plat_testEndian (void)


/**
* @brief Platform test entrypoint.
* @brief Gets the name of the platform.
*/
#ifdef TEST_STANDALONE
int main( int argc, const char *argv[] )
const char *platform_getPlatform (void)
{
(void) argc;
(void) argv;
#else /* TEST_STANDALONE */
int test_platform (void)
{
#endif /* TEST_STANDALONE */

SDL_ATinit( "Platform" );

/* Debug information. */
SDL_ATprintVerbose( 1, "%s System detected\n",
return
#if __AIX__
"AIX"
"AIX"
#elif __BEOS__
"BeOS"
"BeOS"
#elif __BSDI__
"BSDI"
"BSDI"
#elif __DREAMCAST__
"Dreamcast"
"Dreamcast"
#elif __FREEBSD__

"FreeBSD"
"FreeBSD"
#elif __HPUX__
"HP-UX"
"HP-UX"
#elif __IRIX__
"Irix"
"Irix"
#elif __LINUX__
"Linux"
"Linux"
#elif __MINT__
"Atari MiNT"
"Atari MiNT"
#elif __MACOS__
"MacOS Classic"
"MacOS Classic"
#elif __MACOSX__
"Mac OS X"
"Mac OS X"
#elif __NETBSD__
"NetBSD"
"NetBSD"
#elif __OPENBSD__
"OpenBSD"
"OpenBSD"
#elif __OS2__
"OS/2"
"OS/2"
#elif __OSF__
"OSF/1"
"OSF/1"
#elif __QNXNTO__
"QNX Neutrino"
"QNX Neutrino"
#elif __RISCOS__
"RISC OS"
"RISC OS"
#elif __SOLARIS__
"Solaris"
"Solaris"
#elif __WIN32__
#ifdef _WIN32_WCE
"Windows CE"
"Windows CE"
#else
"Windows"
"Windows"
#endif
#elif __IPHONEOS__
"iPhone OS"
"iPhone OS"
#else
"an unknown operating system! (see SDL_platform.h)"
"an unknown operating system! (see SDL_platform.h)"
#endif
);
;
}


/**
* @brief Platform test entrypoint.
*/
#ifdef TEST_STANDALONE
int main( int argc, const char *argv[] )
{
(void) argc;
(void) argv;
#else /* TEST_STANDALONE */
int test_platform (void)
{
#endif /* TEST_STANDALONE */

SDL_ATinit( "Platform" );

/* Debug information. */
SDL_ATprintVerbose( 1, "%s System detected\n", platform_getPlatform() );
SDL_ATprintVerbose( 1, "System is %s endian\n",
#ifdef SDL_LIL_ENDIAN
"little"
Expand Down
1 change: 1 addition & 0 deletions test/automated/platform/platform.h
Expand Up @@ -11,6 +11,7 @@
# define _TEST_PLATFORM


const char *platform_getPlatform (void);
int test_platform (void);


Expand Down
11 changes: 7 additions & 4 deletions test/automated/render/render.c
Expand Up @@ -970,6 +970,7 @@ int main( int argc, const char *argv[] )
int test_render (void)
{
#endif /* TEST_STANDALONE */
int failed;
int i, j, nd, nr;
int ret;
const char *driver, *str;
Expand Down Expand Up @@ -997,6 +998,7 @@ int test_render (void)
* Surface on video mode tests.
*/
/* Run for all video modes. */
failed = 0;
for (i=0; i<nd; i++) {
/* Get video mode. */
driver = SDL_GetVideoDriver(i);
Expand Down Expand Up @@ -1058,7 +1060,8 @@ int test_render (void)
/*
* Run tests.
*/
if (render_runTests())
ret = render_runTests();
if (ret)
continue;

SDL_ATend();
Expand All @@ -1070,16 +1073,16 @@ int test_render (void)
/*
* Finish testsuite.
*/
SDL_ATfinish();
failed += SDL_ATfinish();
}


/* Exit SDL. */
SDL_Quit();

return 0;
return failed;

err:
return -1;
return 1;
}

39 changes: 34 additions & 5 deletions test/automated/testsdl.c
Expand Up @@ -7,6 +7,7 @@
*/


#include "SDL.h"
#include "SDL_at.h"

#include "platform/platform.h"
Expand Down Expand Up @@ -128,22 +129,50 @@ static void parse_options( int argc, char *argv[] )
*/
int main( int argc, char *argv[] )
{
int failed;
int rev;
SDL_version ver;

/* Get options. */
parse_options( argc, argv );

/* Defaults. */
failed = 0;

/* Print some text if verbose. */
SDL_GetVersion( &ver );
rev = SDL_GetRevision();
SDL_ATprintVerbose( 1, "Running tests with SDL %d.%d.%d revision %d\n",
ver.major, ver.minor, ver.patch, rev );

/* Automatic tests. */
if (run_platform)
test_platform();
failed += test_platform();
if (run_rwops)
test_rwops();
failed += test_rwops();
if (run_surface)
test_surface();
failed += test_surface();
if (run_render)
test_render();
failed += test_render();

/* Manual tests. */
if (run_manual) {
}

return 0;
/* Display more information if failed. */
if (failed > 0) {
SDL_ATprintErr( "Tests run with SDL %d.%d.%d revision %d\n",
ver.major, ver.minor, ver.patch, rev );
SDL_ATprintErr( "System is running %s and is %s endian\n",
platform_getPlatform(),
#ifdef SDL_LIL_ENDIAN
"little"
#else
"big"
#endif
);
}

return failed;
}

0 comments on commit 65d4f2b

Please sign in to comment.