| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> |
| | | |
| | | This software is provided 'as-is', without any express or implied |
| | | warranty. In no event will the authors be held liable for any damages |
| | |
| | | * \return Timer id or -1 on failure. |
| | | */ |
| | | static SDL_TimerID |
| | | SDLTest_SetTestTimeout(int timeout, void (*callback)()) |
| | | SDLTest_SetTestTimeout(int timeout, void (*callback)(void)) |
| | | { |
| | | Uint32 timeoutInMilliseconds; |
| | | SDL_TimerID timerID; |
| | |
| | | #pragma aux SDLTest_BailOut aborts; |
| | | #endif |
| | | static SDL_NORETURN void |
| | | SDLTest_BailOut() |
| | | SDLTest_BailOut(void) |
| | | { |
| | | SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run."); |
| | | exit(TEST_ABORTED); /* bail out from the test */ |
| | |
| | | SDL_bool forceTestRun = SDL_FALSE; |
| | | int testResult = 0; |
| | | int runResult = 0; |
| | | Uint32 totalTestFailedCount = 0; |
| | | Uint32 totalTestPassedCount = 0; |
| | | Uint32 totalTestSkippedCount = 0; |
| | | Uint32 testFailedCount = 0; |
| | | Uint32 testPassedCount = 0; |
| | | Uint32 testSkippedCount = 0; |
| | | Uint32 countSum = 0; |
| | | int totalTestFailedCount = 0; |
| | | int totalTestPassedCount = 0; |
| | | int totalTestSkippedCount = 0; |
| | | int testFailedCount = 0; |
| | | int testPassedCount = 0; |
| | | int testSkippedCount = 0; |
| | | int countSum = 0; |
| | | const SDLTest_TestCaseReference **failedTests; |
| | | |
| | | /* Sanitize test iterations */ |
| | |
| | | /* Count the total number of tests */ |
| | | suiteCounter = 0; |
| | | while (testSuites[suiteCounter]) { |
| | | testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter]; |
| | | testSuite = testSuites[suiteCounter]; |
| | | suiteCounter++; |
| | | testCounter = 0; |
| | | while (testSuite->testCases[testCounter]) |
| | |
| | | /* Loop over all suites to check if we have a filter match */ |
| | | suiteCounter = 0; |
| | | while (testSuites[suiteCounter] && suiteFilter == 0) { |
| | | testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter]; |
| | | testSuite = testSuites[suiteCounter]; |
| | | suiteCounter++; |
| | | if (testSuite->name != NULL && SDL_strcmp(filter, testSuite->name) == 0) { |
| | | /* Matched a suite name */ |
| | |
| | | /* Loop over all suites */ |
| | | suiteCounter = 0; |
| | | while(testSuites[suiteCounter]) { |
| | | testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter]; |
| | | currentSuiteName = (char *)((testSuite->name) ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT); |
| | | testSuite = testSuites[suiteCounter]; |
| | | currentSuiteName = (testSuite->name ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT); |
| | | suiteCounter++; |
| | | |
| | | /* Filter suite if flag set and we have a name */ |
| | |
| | | while(testSuite->testCases[testCounter]) |
| | | { |
| | | testCase = testSuite->testCases[testCounter]; |
| | | currentTestName = (char *)((testCase->name) ? testCase->name : SDLTEST_INVALID_NAME_FORMAT); |
| | | currentTestName = (testCase->name ? testCase->name : SDLTEST_INVALID_NAME_FORMAT); |
| | | testCounter++; |
| | | |
| | | /* Filter tests if flag set and we have a name */ |