src/test/SDL_test_harness.c
changeset 8975 180271d72b1e
parent 8917 23182cf59f1c
child 9619 b94b6d0bff0f
equal deleted inserted replaced
8974:f813b8b10b55 8975:180271d72b1e
   217 * \brief Execute a test using the given execution key.
   217 * \brief Execute a test using the given execution key.
   218 *
   218 *
   219 * \param testSuite Suite containing the test case.
   219 * \param testSuite Suite containing the test case.
   220 * \param testCase Case to execute.
   220 * \param testCase Case to execute.
   221 * \param execKey Execution key for the fuzzer.
   221 * \param execKey Execution key for the fuzzer.
       
   222 * \param forceTestRun Force test to run even if test was disabled in suite.
   222 *
   223 *
   223 * \returns Test case result.
   224 * \returns Test case result.
   224 */
   225 */
   225 int
   226 int
   226 SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference *testCase, Uint64 execKey)
   227 SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference *testCase, Uint64 execKey, SDL_bool forceTestRun)
   227 {
   228 {
   228     SDL_TimerID timer = 0;
   229     SDL_TimerID timer = 0;
   229     int testCaseResult = 0;
   230     int testCaseResult = 0;
   230     int testResult = 0;
   231     int testResult = 0;
   231     int fuzzerCount;
   232     int fuzzerCount;
   234     {
   235     {
   235         SDLTest_LogError("Setup failure: testSuite or testCase references NULL");
   236         SDLTest_LogError("Setup failure: testSuite or testCase references NULL");
   236         return TEST_RESULT_SETUP_FAILURE;
   237         return TEST_RESULT_SETUP_FAILURE;
   237     }
   238     }
   238 
   239 
   239     if (!testCase->enabled)
   240 	if (!testCase->enabled && forceTestRun == SDL_FALSE)
   240     {
   241     {
   241         SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Skipped (Disabled)");
   242         SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Skipped (Disabled)");
   242         return TEST_RESULT_SKIPPED;
   243         return TEST_RESULT_SKIPPED;
   243     }
   244     }
   244 
       
   245 
   245 
   246     /* Initialize fuzzer */
   246     /* Initialize fuzzer */
   247     SDLTest_FuzzerInit(execKey);
   247     SDLTest_FuzzerInit(execKey);
   248 
   248 
   249     /* Reset assert tracker */
   249     /* Reset assert tracker */
   384     float runtime;
   384     float runtime;
   385     int suiteFilter = 0;
   385     int suiteFilter = 0;
   386     char *suiteFilterName = NULL;
   386     char *suiteFilterName = NULL;
   387     int testFilter = 0;
   387     int testFilter = 0;
   388     char *testFilterName = NULL;
   388     char *testFilterName = NULL;
       
   389 	SDL_bool forceTestRun = SDL_FALSE;
   389     int testResult = 0;
   390     int testResult = 0;
   390     int runResult = 0;
   391     int runResult = 0;
   391     Uint32 totalTestFailedCount = 0;
   392     Uint32 totalTestFailedCount = 0;
   392     Uint32 totalTestPassedCount = 0;
   393     Uint32 totalTestPassedCount = 0;
   393     Uint32 totalTestSkippedCount = 0;
   394     Uint32 totalTestSkippedCount = 0;
   534                             currentTestName);
   535                             currentTestName);
   535                 } else {
   536                 } else {
   536                     /* Override 'disabled' flag if we specified a test filter (i.e. force run for debugging) */
   537                     /* Override 'disabled' flag if we specified a test filter (i.e. force run for debugging) */
   537                     if (testFilter == 1 && !testCase->enabled) {
   538                     if (testFilter == 1 && !testCase->enabled) {
   538                         SDLTest_Log("Force run of disabled test since test filter was set");
   539                         SDLTest_Log("Force run of disabled test since test filter was set");
   539                         testCase->enabled = 1;
   540 						forceTestRun = SDL_TRUE;
   540                     }
   541                     }
   541 
   542 
   542                     /* Take time - test start */
   543                     /* Take time - test start */
   543                     testStartSeconds = GetClock();
   544                     testStartSeconds = GetClock();
   544 
   545 
   563                         } else {
   564                         } else {
   564                             execKey = SDLTest_GenerateExecKey((char *)runSeed, testSuite->name, testCase->name, iterationCounter);
   565                             execKey = SDLTest_GenerateExecKey((char *)runSeed, testSuite->name, testCase->name, iterationCounter);
   565                         }
   566                         }
   566 
   567 
   567                         SDLTest_Log("Test Iteration %i: execKey %" SDL_PRIu64, iterationCounter, execKey);
   568                         SDLTest_Log("Test Iteration %i: execKey %" SDL_PRIu64, iterationCounter, execKey);
   568                         testResult = SDLTest_RunTest(testSuite, testCase, execKey);
   569 						testResult = SDLTest_RunTest(testSuite, testCase, execKey, forceTestRun);
   569 
   570 
   570                         if (testResult == TEST_RESULT_PASSED) {
   571                         if (testResult == TEST_RESULT_PASSED) {
   571                             testPassedCount++;
   572                             testPassedCount++;
   572                             totalTestPassedCount++;
   573                             totalTestPassedCount++;
   573                         } else if (testResult == TEST_RESULT_SKIPPED) {
   574                         } else if (testResult == TEST_RESULT_SKIPPED) {