test/testplatform.c
changeset 7639 9406b7dd2f2d
parent 7517 965d57022c01
child 7823 4ab3a5ee041d
     1.1 --- a/test/testplatform.c	Mon Aug 12 22:00:21 2013 -0700
     1.2 +++ b/test/testplatform.c	Wed Aug 14 23:30:10 2013 -0700
     1.3 @@ -35,30 +35,30 @@
     1.4  
     1.5      if (badsize(sizeof(Uint8), 1)) {
     1.6          if (verbose)
     1.7 -            printf("sizeof(Uint8) != 1, instead = %u\n",
     1.8 +            SDL_Log("sizeof(Uint8) != 1, instead = %u\n",
     1.9                     (unsigned int)sizeof(Uint8));
    1.10          ++error;
    1.11      }
    1.12      if (badsize(sizeof(Uint16), 2)) {
    1.13          if (verbose)
    1.14 -            printf("sizeof(Uint16) != 2, instead = %u\n",
    1.15 +            SDL_Log("sizeof(Uint16) != 2, instead = %u\n",
    1.16                     (unsigned int)sizeof(Uint16));
    1.17          ++error;
    1.18      }
    1.19      if (badsize(sizeof(Uint32), 4)) {
    1.20          if (verbose)
    1.21 -            printf("sizeof(Uint32) != 4, instead = %u\n",
    1.22 +            SDL_Log("sizeof(Uint32) != 4, instead = %u\n",
    1.23                     (unsigned int)sizeof(Uint32));
    1.24          ++error;
    1.25      }
    1.26      if (badsize(sizeof(Uint64), 8)) {
    1.27          if (verbose)
    1.28 -            printf("sizeof(Uint64) != 8, instead = %u\n",
    1.29 +            SDL_Log("sizeof(Uint64) != 8, instead = %u\n",
    1.30                     (unsigned int)sizeof(Uint64));
    1.31          ++error;
    1.32      }
    1.33      if (verbose && !error)
    1.34 -        printf("All data types are the expected size.\n");
    1.35 +        SDL_Log("All data types are the expected size.\n");
    1.36  
    1.37      return (error ? 1 : 0);
    1.38  }
    1.39 @@ -83,7 +83,7 @@
    1.40      swapped64 |= 0xDEADBEEF;
    1.41  
    1.42      if (verbose) {
    1.43 -        printf("Detected a %s endian machine.\n",
    1.44 +        SDL_Log("Detected a %s endian machine.\n",
    1.45                 (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big");
    1.46      }
    1.47      if ((*((char *) &value) >> 4) == 0x1) {
    1.48 @@ -93,44 +93,44 @@
    1.49      }
    1.50      if (real_byteorder != SDL_BYTEORDER) {
    1.51          if (verbose) {
    1.52 -            printf("Actually a %s endian machine!\n",
    1.53 +            SDL_Log("Actually a %s endian machine!\n",
    1.54                     (real_byteorder == SDL_LIL_ENDIAN) ? "little" : "big");
    1.55          }
    1.56          ++error;
    1.57      }
    1.58      if (verbose) {
    1.59 -        printf("Value 16 = 0x%X, swapped = 0x%X\n", value16,
    1.60 +        SDL_Log("Value 16 = 0x%X, swapped = 0x%X\n", value16,
    1.61                 SDL_Swap16(value16));
    1.62      }
    1.63      if (SDL_Swap16(value16) != swapped16) {
    1.64          if (verbose) {
    1.65 -            printf("16 bit value swapped incorrectly!\n");
    1.66 +            SDL_Log("16 bit value swapped incorrectly!\n");
    1.67          }
    1.68          ++error;
    1.69      }
    1.70      if (verbose) {
    1.71 -        printf("Value 32 = 0x%X, swapped = 0x%X\n", value32,
    1.72 +        SDL_Log("Value 32 = 0x%X, swapped = 0x%X\n", value32,
    1.73                 SDL_Swap32(value32));
    1.74      }
    1.75      if (SDL_Swap32(value32) != swapped32) {
    1.76          if (verbose) {
    1.77 -            printf("32 bit value swapped incorrectly!\n");
    1.78 +            SDL_Log("32 bit value swapped incorrectly!\n");
    1.79          }
    1.80          ++error;
    1.81      }
    1.82      if (verbose) {
    1.83  #ifdef _MSC_VER
    1.84 -        printf("Value 64 = 0x%I64X, swapped = 0x%I64X\n", value64,
    1.85 +        SDL_Log("Value 64 = 0x%I64X, swapped = 0x%I64X\n", value64,
    1.86                 SDL_Swap64(value64));
    1.87  #else
    1.88 -        printf("Value 64 = 0x%llX, swapped = 0x%llX\n",
    1.89 +        SDL_Log("Value 64 = 0x%llX, swapped = 0x%llX\n",
    1.90                 (unsigned long long) value64,
    1.91                 (unsigned long long) SDL_Swap64(value64));
    1.92  #endif
    1.93      }
    1.94      if (SDL_Swap64(value64) != swapped64) {
    1.95          if (verbose) {
    1.96 -            printf("64 bit value swapped incorrectly!\n");
    1.97 +            SDL_Log("64 bit value swapped incorrectly!\n");
    1.98          }
    1.99          ++error;
   1.100      }
   1.101 @@ -142,17 +142,17 @@
   1.102  TestCPUInfo(SDL_bool verbose)
   1.103  {
   1.104      if (verbose) {
   1.105 -        printf("CPU count: %d\n", SDL_GetCPUCount());
   1.106 -        printf("CPU cache line size: %d\n", SDL_GetCPUCacheLineSize());
   1.107 -        printf("RDTSC %s\n", SDL_HasRDTSC()? "detected" : "not detected");
   1.108 -        printf("AltiVec %s\n", SDL_HasAltiVec()? "detected" : "not detected");
   1.109 -        printf("MMX %s\n", SDL_HasMMX()? "detected" : "not detected");
   1.110 -        printf("3DNow! %s\n", SDL_Has3DNow()? "detected" : "not detected");
   1.111 -        printf("SSE %s\n", SDL_HasSSE()? "detected" : "not detected");
   1.112 -        printf("SSE2 %s\n", SDL_HasSSE2()? "detected" : "not detected");
   1.113 -        printf("SSE3 %s\n", SDL_HasSSE3()? "detected" : "not detected");
   1.114 -        printf("SSE4.1 %s\n", SDL_HasSSE41()? "detected" : "not detected");
   1.115 -        printf("SSE4.2 %s\n", SDL_HasSSE42()? "detected" : "not detected");
   1.116 +        SDL_Log("CPU count: %d\n", SDL_GetCPUCount());
   1.117 +        SDL_Log("CPU cache line size: %d\n", SDL_GetCPUCacheLineSize());
   1.118 +        SDL_Log("RDTSC %s\n", SDL_HasRDTSC()? "detected" : "not detected");
   1.119 +        SDL_Log("AltiVec %s\n", SDL_HasAltiVec()? "detected" : "not detected");
   1.120 +        SDL_Log("MMX %s\n", SDL_HasMMX()? "detected" : "not detected");
   1.121 +        SDL_Log("3DNow! %s\n", SDL_Has3DNow()? "detected" : "not detected");
   1.122 +        SDL_Log("SSE %s\n", SDL_HasSSE()? "detected" : "not detected");
   1.123 +        SDL_Log("SSE2 %s\n", SDL_HasSSE2()? "detected" : "not detected");
   1.124 +        SDL_Log("SSE3 %s\n", SDL_HasSSE3()? "detected" : "not detected");
   1.125 +        SDL_Log("SSE4.1 %s\n", SDL_HasSSE41()? "detected" : "not detected");
   1.126 +        SDL_Log("SSE4.2 %s\n", SDL_HasSSE42()? "detected" : "not detected");
   1.127      }
   1.128      return (0);
   1.129  }
   1.130 @@ -176,7 +176,7 @@
   1.131      {
   1.132          const SDL_assert_data *item = SDL_GetAssertionReport();
   1.133          while (item) {
   1.134 -            printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
   1.135 +            SDL_Log("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
   1.136                  item->condition, item->function, item->filename,
   1.137                  item->linenum, item->trigger_count,
   1.138                  item->always_ignore ? "yes" : "no");
   1.139 @@ -192,11 +192,14 @@
   1.140      SDL_bool verbose = SDL_TRUE;
   1.141      int status = 0;
   1.142  
   1.143 +    /* Enable standard application logging */
   1.144 +    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
   1.145 +
   1.146      if (argv[1] && (SDL_strcmp(argv[1], "-q") == 0)) {
   1.147          verbose = SDL_FALSE;
   1.148      }
   1.149      if (verbose) {
   1.150 -        printf("This system is running %s\n", SDL_GetPlatform());
   1.151 +        SDL_Log("This system is running %s\n", SDL_GetPlatform());
   1.152      }
   1.153  
   1.154      status += TestTypes(verbose);