32 #define SDLTEST_INVALID_NAME_FORMAT "(Invalid)" 35 #define SDLTEST_LOG_SUMMARY_FORMAT "%s Summary: Total=%d Passed=%d Failed=%d Skipped=%d" 38 #define SDLTEST_FINAL_RESULT_FORMAT ">>> %s '%s': %s\n" 67 seed = (
char *)
SDL_malloc((length + 1) *
sizeof(char));
76 for (counter = 0; counter <
length; counter++) {
78 char ch = (char) (number % (91 - 48)) + 48;
79 if (ch >= 58 && ch <= 64) {
105 char iterationString[16];
109 Uint32 iterationStringLength;
110 Uint32 entireStringLength;
113 if (runSeed ==
NULL || runSeed[0] ==
'\0') {
118 if (suiteName ==
NULL || suiteName[0] ==
'\0') {
123 if (testName ==
NULL || testName[0] ==
'\0') {
128 if (iteration <= 0) {
134 SDL_memset(iterationString, 0,
sizeof(iterationString));
135 SDL_snprintf(iterationString,
sizeof(iterationString) - 1,
"%d", iteration);
141 iterationStringLength =
SDL_strlen(iterationString);
142 entireStringLength = runSeedLength + suiteNameLength + testNameLength + iterationStringLength + 1;
143 buffer = (
char *)
SDL_malloc(entireStringLength);
144 if (buffer ==
NULL) {
149 SDL_snprintf(buffer, entireStringLength,
"%s%s%s%d", runSeed, suiteName, testName, iteration);
174 Uint32 timeoutInMilliseconds;
196 timeoutInMilliseconds = timeout * 1000;
230 int testCaseResult = 0;
294 if (fuzzerCount > 0) {
295 SDLTest_Log(
"Fuzzer invocations: %d", fuzzerCount);
325 while(&testSuites[suiteCounter]) {
326 testSuite=&testSuites[suiteCounter];
347 float currentClock = (float)clock();
348 return currentClock / (float)CLOCKS_PER_SEC;
367 int totalNumberOfTests = 0;
368 int failedNumberOfTests = 0;
371 int iterationCounter;
374 const char *runSeed =
NULL;
375 char *currentSuiteName;
376 char *currentTestName;
378 float runStartSeconds;
379 float suiteStartSeconds;
380 float testStartSeconds;
382 float suiteEndSeconds;
383 float testEndSeconds;
386 char *suiteFilterName =
NULL;
388 char *testFilterName =
NULL;
392 Uint32 totalTestFailedCount = 0;
393 Uint32 totalTestPassedCount = 0;
394 Uint32 totalTestSkippedCount = 0;
395 Uint32 testFailedCount = 0;
396 Uint32 testPassedCount = 0;
397 Uint32 testSkippedCount = 0;
402 if (testIterations < 1) {
407 if (userRunSeed ==
NULL || userRunSeed[0] ==
'\0') {
409 if (runSeed ==
NULL) {
414 runSeed = userRunSeed;
419 totalTestFailedCount = 0;
420 totalTestPassedCount = 0;
421 totalTestSkippedCount = 0;
427 SDLTest_Log(
"::::: Test Run /w seed '%s' started\n", runSeed);
431 while (testSuites[suiteCounter]) {
435 while (testSuite->
testCases[testCounter])
438 totalNumberOfTests++;
444 if (failedTests ==
NULL) {
451 if (filter !=
NULL && filter[0] !=
'\0') {
454 while (testSuites[suiteCounter] && suiteFilter == 0) {
460 suiteFilterName = testSuite->
name;
461 SDLTest_Log(
"Filtering: running only suite '%s'", suiteFilterName);
467 while (testSuite->
testCases[testCounter] && testFilter == 0)
474 suiteFilterName = testSuite->
name;
476 testFilterName = testCase->
name;
477 SDLTest_Log(
"Filtering: running only test '%s' in suite '%s'", testFilterName, suiteFilterName);
483 if (suiteFilter == 0 && testFilter == 0) {
493 while(testSuites[suiteCounter]) {
499 if (suiteFilter == 1 && suiteFilterName !=
NULL && testSuite->
name !=
NULL &&
510 testSkippedCount = 0;
529 if (testFilter == 1 && testFilterName !=
NULL && testCase->
name !=
NULL &&
532 SDLTest_Log(
"===== Test Case %i.%i: '%s' skipped\n",
538 if (testFilter == 1 && !testCase->
enabled) {
539 SDLTest_Log(
"Force run of disabled test since test filter was set");
557 iterationCounter = 0;
558 while(iterationCounter < testIterations)
562 if (userExecKey != 0) {
563 execKey = userExecKey;
569 testResult =
SDLTest_RunTest(testSuite, testCase, execKey, forceTestRun);
573 totalTestPassedCount++;
576 totalTestSkippedCount++;
579 totalTestFailedCount++;
585 runtime = testEndSeconds - testStartSeconds;
586 if (runtime < 0.0
f) runtime = 0.0f;
588 if (testIterations > 1) {
590 SDLTest_Log(
"Runtime of %i iterations: %.1f sec", testIterations, runtime);
591 SDLTest_Log(
"Average Test runtime: %.5f sec", runtime / (
float)testIterations);
594 SDLTest_Log(
"Total Test runtime: %.1f sec", runtime);
598 switch (testResult) {
612 failedTests[failedNumberOfTests] = testCase;
613 failedNumberOfTests++;
620 runtime = suiteEndSeconds - suiteStartSeconds;
621 if (runtime < 0.0
f) runtime = 0.0f;
624 SDLTest_Log(
"Total Suite runtime: %.1f sec", runtime);
627 countSum = testPassedCount + testFailedCount + testSkippedCount;
628 if (testFailedCount == 0)
644 runtime = runEndSeconds - runStartSeconds;
645 if (runtime < 0.0
f) runtime = 0.0f;
648 SDLTest_Log(
"Total Run runtime: %.1f sec", runtime);
651 countSum = totalTestPassedCount + totalTestFailedCount + totalTestSkippedCount;
652 if (totalTestFailedCount == 0)
666 if (failedNumberOfTests > 0) {
668 for (testCounter = 0; testCounter < failedNumberOfTests; testCounter++) {
669 SDLTest_Log(
" --seed %s --filter %s", runSeed, failedTests[testCounter]->
name);
#define SDLTEST_INVALID_NAME_FORMAT
void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites)
SDLTest_TestCaseTearDownFp testTearDown
int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations)
Execute a test suite using the given run seed and execution key.
char * SDLTest_GenerateRunSeed(const int length)
Uint32(* SDL_TimerCallback)(Uint32 interval, void *param)
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld [DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp local skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
#define SDLTEST_FINAL_RESULT_FORMAT
#define SDL_InitSubSystem
static Uint32 SDLTest_TestCaseTimeout
void SDLTest_BailOut()
Timeout handler. Aborts test run and exits harness process.
GLuint const GLchar * name
uint32_t Uint32
An unsigned 32-bit integer type.
SDLTest_TestCaseSetUpFp testSetUp
uint64_t Uint64
An unsigned 64-bit integer type.
const SDLTest_TestCaseReference ** testCases
Uint64 SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iteration)
#define TEST_RESULT_FAILED
void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(1)
Prints given message with a timestamp in the TEST category and the ERROR priority.
void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext)
Initialize random number generator based on current system time.
SDL_TimerID SDLTest_SetTestTimeout(int timeout, void(*callback)())
Set timeout handler for test.
void SDLTest_Md5Update(SDLTest_Md5Context *mdContext, unsigned char *inBuf, unsigned int inLen)
update digest from variable length data
void SDLTest_Md5Init(SDLTest_Md5Context *mdContext)
initialize the context
#define TEST_RESULT_SETUP_FAILURE
static Uint32 callback(Uint32 interval, void *param)
#define TEST_RESULT_NO_ASSERT
unsigned int SDLTest_Random(SDLTest_RandomContext *rndContext)
Initialize random number generator based on current system time.
int SDLTest_AssertSummaryToTestResult()
Converts the current assert summary state to a test result.
int SDLTest_GetFuzzerInvocationCount()
#define TEST_RESULT_PASSED
void SDLTest_ResetAssertSummary()
Resets the assert summary counters to zero.
GLbitfield GLuint64 timeout
void SDLTest_Md5Final(SDLTest_Md5Context *mdContext)
complete digest computation
#define SDLTEST_LOG_SUMMARY_FORMAT
int SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference *testCase, Uint64 execKey, SDL_bool forceTestRun)
Execute a test using the given execution key.
void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(1)
Prints given message with a timestamp in the TEST category and INFO priority.
void SDLTest_FuzzerInit(Uint64 execKey)
#define TEST_RESULT_SKIPPED
GLuint GLsizei GLsizei * length
SDLTest_TestCaseFp testCase
void SDLTest_LogAssertSummary()
Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
SDLTest_TestSuiteReference * testSuites[]