diff --git a/.monadid b/.monadid index 98219dad83eaa130cf74f0b2c230752f3fd85206..5f6c6df098dd005468dd8301c7a7f24088521af5 100644 --- a/.monadid +++ b/.monadid @@ -1,4 +1,4 @@ monad identification file This file is used for monad directory identification -Built by toole1 on linux3.ews.illinois.edu -Build Date: Sun Sep 4 14:15:12 CDT 2011 +Built by toole1 on linux2.ews.illinois.edu +Build Date: Tue Sep 13 12:58:29 CDT 2011 diff --git a/proxy.cpp b/proxy.cpp index 709a5bd3626750d7cde40bb6c2e1e22f035f37a5..65aa99a53443629521a3655512ef0ec61b9851b1 100755 --- a/proxy.cpp +++ b/proxy.cpp @@ -36,6 +36,12 @@ namespace proxy output_check_map * global_output_checks = NULL; } +namespace opts +{ + bool verbose = true; + bool redirect_test_output = true; +} + OUTPUT_CHECK(equals) { @@ -245,7 +251,7 @@ int32_t RunTests::run_single_test(unit_test & curr_test) return environment.cleanup_globals(); string & error = curr_test.errormsg; - + handle_single_test_output(curr_test.output); if (error == "") @@ -357,7 +363,7 @@ void RunTests::output_detailed_info_if_any_failed(int32_t score) if (!tests[test_i].passed()) any_failed = true; - if (any_failed) + if (any_failed || opts::verbose) output_detailed_tests_info(score); } @@ -371,7 +377,7 @@ void RunTests::output_detailed_tests_info(int32_t score) vector<unit_test> & tests = *environment.heap_tests; for (size_t test_i = 0; test_i < tests.size(); test_i++) - if (!tests[test_i].passed()) + if (!tests[test_i].passed() || opts::verbose) output::detailed_info(tests[test_i]); cout << endl << "--------------------------------" << endl; @@ -401,8 +407,11 @@ void test_execution::child() nums_pipe.close_read(); // Redirect stdout/stderr to pipe - cout_pipe.steal_output(STDOUT_FILENO); - cout_pipe.steal_output(STDERR_FILENO); + if (opts::redirect_test_output) + { + cout_pipe.steal_output(STDOUT_FILENO); + cout_pipe.steal_output(STDERR_FILENO); + } if (do_valgrind) { @@ -423,7 +432,11 @@ void test_execution::parent() test.checkstream->close_write(); // Read stdout/stderr pipe while process is running - cout_pipe >> setmax(environment.max_output_length) >> test.output; + if (opts::redirect_test_output) + cout_pipe >> setmax(environment.max_output_length) >> test.output; + else + test.output = "Test output was displayed above instead of being buffered\n"; + cout_pipe.close_read(); } @@ -535,7 +548,12 @@ void test_execution::after_valgrind_success(int8_t return_code) size_t last_endl = findNthLast(test.output, '\n', 2); if (last_endl == string::npos) - test.errormsg = "Test did not complete"; + { + if (opts::redirect_test_output) + test.errormsg = "Valgrind test did not complete"; + else + test.errormsg = "Valgrind test output was not redirected to pipe because opts::redirect_test_output was set."; + } else { test.errormsg = test.output.substr(last_endl + 1, @@ -547,6 +565,9 @@ void test_execution::after_valgrind_success(int8_t return_code) test.valgrind_flags = return_code; if (test.errormsg == environment.single_test_passed_string) test.errormsg = get_valgrind_string(test.valgrind_flags); + // This will always be unit_test::pass_string unless someone tried to hack monad, in which case + // basing our passing on the return code (valgrind flags) rather than string parsing is the + // right thing to do } } @@ -583,6 +604,10 @@ void test_execution::after_test_success() test.errormsg = "Incorrect Terminal Output"; } } + + if (test.passed()) + test.errormsg = get_valgrind_string(test.valgrind_flags); + delete test.checkstream; }