SDL_test: add --no-time option to not log times
Combining this new option with a known seed hash allows easy diff-ing between runs
This commit is contained in:
committed by
Anonymous Maarten
parent
e8065ad9a0
commit
d26fef415e
@@ -43,6 +43,7 @@ static const char *common_usage[] = {
|
|||||||
"[--trackmem]",
|
"[--trackmem]",
|
||||||
"[--randmem]",
|
"[--randmem]",
|
||||||
"[--no-color]",
|
"[--no-color]",
|
||||||
|
"[--no-time]",
|
||||||
"[--info all|video|modes|render|event|event_motion]",
|
"[--info all|video|modes|render|event|event_motion]",
|
||||||
"[--log all|error|system|audio|video|render|input]",
|
"[--log all|error|system|audio|video|render|input]",
|
||||||
NULL
|
NULL
|
||||||
@@ -159,6 +160,10 @@ static int SDLCALL SDLTest_CommonStateParseCommonArguments(void *data, char **ar
|
|||||||
SDLTest_Color = false;
|
SDLTest_Color = false;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if (SDL_strcasecmp(argv[index], "--no-time") == 0) {
|
||||||
|
SDLTest_Time = false;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if (SDL_strcasecmp(argv[index], "--randmem") == 0) {
|
if (SDL_strcasecmp(argv[index], "--randmem") == 0) {
|
||||||
/* Already handled in SDLTest_CommonCreateState() */
|
/* Already handled in SDLTest_CommonCreateState() */
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#define SDL_test_internal_h
|
#define SDL_test_internal_h
|
||||||
|
|
||||||
extern bool SDLTest_Color;
|
extern bool SDLTest_Color;
|
||||||
|
extern bool SDLTest_Time;
|
||||||
|
|
||||||
#define COLOR_RAW_RED "\033[0;31m"
|
#define COLOR_RAW_RED "\033[0;31m"
|
||||||
#define COLOR_RAW_GREEN "\033[0;32m"
|
#define COLOR_RAW_GREEN "\033[0;32m"
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
#include <time.h> /* Needed for localtime() */
|
#include <time.h> /* Needed for localtime() */
|
||||||
|
|
||||||
|
bool SDLTest_Time = true;
|
||||||
|
|
||||||
/* work around compiler warning on older GCCs. */
|
/* work around compiler warning on older GCCs. */
|
||||||
#if (defined(__GNUC__) && (__GNUC__ <= 2))
|
#if (defined(__GNUC__) && (__GNUC__ <= 2))
|
||||||
static size_t strftime_gcc2_workaround(char *s, size_t max, const char *fmt, const struct tm *tm)
|
static size_t strftime_gcc2_workaround(char *s, size_t max, const char *fmt, const struct tm *tm)
|
||||||
@@ -61,6 +63,10 @@ static const char *SDLTest_TimestampToString(const time_t timestamp)
|
|||||||
struct tm *local;
|
struct tm *local;
|
||||||
size_t result = 0;
|
size_t result = 0;
|
||||||
|
|
||||||
|
if (!SDLTest_Time) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
SDL_memset(buffer, 0, sizeof(buffer));
|
SDL_memset(buffer, 0, sizeof(buffer));
|
||||||
copy = timestamp;
|
copy = timestamp;
|
||||||
local = localtime(©);
|
local = localtime(©);
|
||||||
|
|||||||
Reference in New Issue
Block a user