+ for (test_st *run= next->tests; run->name; run++)
+ {
+ struct timeval start_time, end_time;
+ long int load_time= 0;
+
+ if (wildcard && fnmatch(wildcard, run->name, 0))
+ {
+ continue;
+ }
+
+ test_return_t return_code;
+ try {
+ if (test_success(return_code= world.item.startup(creators_ptr)))
+ {
+ if (test_success(return_code= world.item.flush(creators_ptr, run)))
+ {
+ // @note pre will fail is SKIPPED is returned
+ if (test_success(return_code= world.item.pre(creators_ptr)))
+ {
+ { // Runner Code
+ gettimeofday(&start_time, NULL);
+ assert(world.runner());
+ assert(run->test_fn);
+ try
+ {
+ return_code= world.runner()->run(run->test_fn, creators_ptr);
+ }
+ // Special case where check for the testing of the exception
+ // system.
+ catch (libtest::fatal &e)
+ {
+ if (fatal::is_disabled())
+ {
+ fatal::increment_disabled_counter();
+ return_code= TEST_SUCCESS;
+ }
+ else
+ {
+ throw;
+ }
+ }
+
+ gettimeofday(&end_time, NULL);
+ load_time= timedif(end_time, start_time);
+ }
+ }
+
+ // @todo do something if post fails
+ (void)world.item.post(creators_ptr);
+ }
+ else if (return_code == TEST_SKIPPED)
+ { }
+ else if (return_code == TEST_FAILURE)
+ {
+ Error << " item.flush(failure)";
+ signal.set_shutdown(SHUTDOWN_GRACEFUL);
+ }
+ }
+ else if (return_code == TEST_SKIPPED)
+ { }
+ else if (return_code == TEST_FAILURE)
+ {
+ Error << " item.startup(failure)";
+ signal.set_shutdown(SHUTDOWN_GRACEFUL);
+ }
+ }
+
+ catch (libtest::fatal &e)
+ {
+ Error << "Fatal exception was thrown: " << e.what();
+ return_code= TEST_FAILURE;
+ }
+ catch (std::exception &e)
+ {
+ Error << "Exception was thrown: " << e.what();
+ return_code= TEST_FAILURE;
+ }
+ catch (...)
+ {
+ Error << "Unknown exception occurred";
+ return_code= TEST_FAILURE;
+ }
+
+ stats.total++;
+
+ switch (return_code)
+ {
+ case TEST_SUCCESS:
+ Out << "\tTesting " << run->name << "\t\t\t\t\t" << load_time / 1000 << "." << load_time % 1000 << "[ " << test_strerror(return_code) << " ]";
+ stats.success++;
+ break;
+
+ case TEST_FAILURE:
+ stats.failed++;
+ failed= true;
+ Out << "\tTesting " << run->name << "\t\t\t\t\t" << "[ " << test_strerror(return_code) << " ]";
+ break;
+
+ case TEST_SKIPPED:
+ stats.skipped++;
+ skipped= true;
+ Out << "\tTesting " << run->name << "\t\t\t\t\t" << "[ " << test_strerror(return_code) << " ]";
+ break;
+
+ default:
+ fatal_message("invalid return code");
+ }
+
+ if (test_failed(world.on_error(return_code, creators_ptr)))
+ {
+ Error << "Failed while running on_error()";
+ signal.set_shutdown(SHUTDOWN_GRACEFUL);
+ break;
+ }
+ }
+
+ (void) world.runner()->post(next->post, creators_ptr);