diff --git a/proxy.cpp b/proxy.cpp index 4c6ee3f88ebc01e4780233cd5cc12ebfad89be22..03dbfa0631629a2a952aea2f01d8af7650fc74ab 100755 --- a/proxy.cpp +++ b/proxy.cpp @@ -238,7 +238,7 @@ int32_t RunTests::run_single_test(unit_test & curr_test) cout << "Running " << curr_test.name << " [worth " << curr_test.points << " points, output below]" << endl; - bool is_parent_process = UnitTestContainer(curr_test, environment).execute(false); + bool is_parent_process = execute_test(curr_test, environment, false); if (!is_parent_process) return environment.cleanup_globals(); @@ -289,7 +289,7 @@ int RunTests::run_all_tests() unit_test & curr_test = tests[test_i]; output::testname(curr_test, max_testname_len, max_points_len); - bool is_parent_process = UnitTestContainer(curr_test, environment).execute(true); + bool is_parent_process = execute_test(curr_test, environment, true); // Check for the child process // This is unfortunately necessary (instead of an exit) to clean up // all the memory in use in main and the global space for valgrind @@ -458,7 +458,7 @@ void test_execution::aborted_exit() } -bool UnitTestContainer::execute(bool enable_valgrind_call) +bool RunTests::execute_test(unit_test & _test, RunTimeEnvironment & environment, bool enable_valgrind_call) { cout << std::flush; test_execution executor(test, environment, enable_valgrind_call); @@ -680,11 +680,5 @@ long test_execution::end_timeout() -UnitTestContainer::UnitTestContainer(unit_test & _test, RunTimeEnvironment & env) - : environment(env), test(_test) { } - - - - } // namespace proxy diff --git a/proxy.h b/proxy.h index 15320b4c6365b5d377bd9c6e5519891106f62172..461437fbcf0991fdd4e37c3bf4f5ffc8361da444 100755 --- a/proxy.h +++ b/proxy.h @@ -106,26 +106,13 @@ namespace proxy void output_detailed_info_if_any_failed(int32_t score); void output_detailed_tests_info(int32_t score); + execute_test(unit_test & _test, RunTimeEnvironment & env, bool enable_valgrind_call); + private: RunTests(const RunTests & other); RunTests & operator=(const RunTests & other); }; - class UnitTestContainer - { - private: - RunTimeEnvironment & environment; - unit_test & test; - - public: - UnitTestContainer(unit_test & _test, RunTimeEnvironment & env); - bool execute(bool enable_valgrind_call); - - private: - UnitTestContainer(const UnitTestContainer & other); - UnitTestContainer & operator=(const UnitTestContainer & other); - }; - template <typename F> bool fork_execute(F & executor);