| 403 | : tec(tec), initial_seed(initialSeed) {} |
| 404 | |
| 405 | void run(void) override { |
| 406 | // Set up a local source of randomness seeds based on the initial seed supplied. |
| 407 | Gecode::Support::RandomGenerator seed_sequence(initial_seed); |
| 408 | |
| 409 | // Loop runs tests continuously in batches from the test execution control |
| 410 | while (true) { |
| 411 | // Get next batch |
| 412 | const std::pair<size_t, size_t>& start_and_size = tec.next_batch(); |
| 413 | const size_t batch_start = start_and_size.first; |
| 414 | const size_t batch_size = start_and_size.second; |
| 415 | if (batch_start >= tec.tests.size()) { |
| 416 | // No more tests to run |
| 417 | break; |
| 418 | } |
| 419 | // Run each test in the batch, handling output and failures |
| 420 | for (size_t i = batch_start; i < batch_start + batch_size && i < tec.tests.size(); ++i) { |
| 421 | if (!tec.continue_testing()) { |
| 422 | break; |
| 423 | } |
| 424 | auto test = tec.tests[i]; |
| 425 | unsigned int test_seed = seed_sequence.next(); |
| 426 | std::ostringstream test_output; |
| 427 | if (!run_test(test, test_seed, tec.options, test_output)) { |
| 428 | tec.set_failure(); |
| 429 | } |
| 430 | tec.write_output(test_output.str()); |
| 431 | } |
| 432 | if (!tec.continue_testing()) { |
| 433 | break; |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | // Signal that this thread is done. Last one signals the waiting main thread. |
| 438 | tec.thread_done(); |
| 439 | } |
| 440 | }; |
| 441 | |
| 442 | /// Run all the tests with the supplied options i parallel. |
no test coverage detected