Skip to content
Snippets Groups Projects
Commit bc3409d1 authored by toole1's avatar toole1
Browse files

version Sep 13 12:58:29

git-svn-id: https://subversion.cs.illinois.edu/svn/cs225@4495 6fbd10e7-183d-0410-a318-cb416676e4f2
parent 901d761c
No related branches found
No related tags found
No related merge requests found
monad identification file monad identification file
This file is used for monad directory identification This file is used for monad directory identification
Built by toole1 on linux3.ews.illinois.edu Built by toole1 on linux2.ews.illinois.edu
Build Date: Sun Sep 4 14:15:12 CDT 2011 Build Date: Tue Sep 13 12:58:29 CDT 2011
...@@ -36,6 +36,12 @@ namespace proxy ...@@ -36,6 +36,12 @@ namespace proxy
output_check_map * global_output_checks = NULL; output_check_map * global_output_checks = NULL;
} }
namespace opts
{
bool verbose = true;
bool redirect_test_output = true;
}
OUTPUT_CHECK(equals) OUTPUT_CHECK(equals)
{ {
...@@ -245,7 +251,7 @@ int32_t RunTests::run_single_test(unit_test & curr_test) ...@@ -245,7 +251,7 @@ int32_t RunTests::run_single_test(unit_test & curr_test)
return environment.cleanup_globals(); return environment.cleanup_globals();
string & error = curr_test.errormsg; string & error = curr_test.errormsg;
handle_single_test_output(curr_test.output); handle_single_test_output(curr_test.output);
if (error == "") if (error == "")
...@@ -357,7 +363,7 @@ void RunTests::output_detailed_info_if_any_failed(int32_t score) ...@@ -357,7 +363,7 @@ void RunTests::output_detailed_info_if_any_failed(int32_t score)
if (!tests[test_i].passed()) if (!tests[test_i].passed())
any_failed = true; any_failed = true;
if (any_failed) if (any_failed || opts::verbose)
output_detailed_tests_info(score); output_detailed_tests_info(score);
} }
...@@ -371,7 +377,7 @@ void RunTests::output_detailed_tests_info(int32_t score) ...@@ -371,7 +377,7 @@ void RunTests::output_detailed_tests_info(int32_t score)
vector<unit_test> & tests = *environment.heap_tests; vector<unit_test> & tests = *environment.heap_tests;
for (size_t test_i = 0; test_i < tests.size(); test_i++) 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]); output::detailed_info(tests[test_i]);
cout << endl << "--------------------------------" << endl; cout << endl << "--------------------------------" << endl;
...@@ -401,8 +407,11 @@ void test_execution::child() ...@@ -401,8 +407,11 @@ void test_execution::child()
nums_pipe.close_read(); nums_pipe.close_read();
// Redirect stdout/stderr to pipe // Redirect stdout/stderr to pipe
cout_pipe.steal_output(STDOUT_FILENO); if (opts::redirect_test_output)
cout_pipe.steal_output(STDERR_FILENO); {
cout_pipe.steal_output(STDOUT_FILENO);
cout_pipe.steal_output(STDERR_FILENO);
}
if (do_valgrind) if (do_valgrind)
{ {
...@@ -423,7 +432,11 @@ void test_execution::parent() ...@@ -423,7 +432,11 @@ void test_execution::parent()
test.checkstream->close_write(); test.checkstream->close_write();
// Read stdout/stderr pipe while process is running // 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(); cout_pipe.close_read();
} }
...@@ -535,7 +548,12 @@ void test_execution::after_valgrind_success(int8_t return_code) ...@@ -535,7 +548,12 @@ void test_execution::after_valgrind_success(int8_t return_code)
size_t last_endl = findNthLast(test.output, '\n', 2); size_t last_endl = findNthLast(test.output, '\n', 2);
if (last_endl == string::npos) 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 else
{ {
test.errormsg = test.output.substr(last_endl + 1, test.errormsg = test.output.substr(last_endl + 1,
...@@ -547,6 +565,9 @@ void test_execution::after_valgrind_success(int8_t return_code) ...@@ -547,6 +565,9 @@ void test_execution::after_valgrind_success(int8_t return_code)
test.valgrind_flags = return_code; test.valgrind_flags = return_code;
if (test.errormsg == environment.single_test_passed_string) if (test.errormsg == environment.single_test_passed_string)
test.errormsg = get_valgrind_string(test.valgrind_flags); 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() ...@@ -583,6 +604,10 @@ void test_execution::after_test_success()
test.errormsg = "Incorrect Terminal Output"; test.errormsg = "Incorrect Terminal Output";
} }
} }
if (test.passed())
test.errormsg = get_valgrind_string(test.valgrind_flags);
delete test.checkstream; delete test.checkstream;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment