1401 - shave 80% off chessboard test time

It was all going to laboriously writing out 300+ MB to disk.
This commit is contained in:
Kartik K. Agaram 2015-05-18 18:51:48 -07:00
parent 8ba8f0f6f2
commit a39df92d50
3 changed files with 15 additions and 1 deletions

View File

@ -46,6 +46,19 @@ case _STOP_TRACING: {
break;
}
:(before "End Primitive Recipe Declarations")
_CLOSE_TRACE,
:(before "End Primitive Recipe Numbers")
Recipe_number["$close-trace"] = _CLOSE_TRACE;
:(before "End Primitive Recipe Implementations")
case _CLOSE_TRACE: {
if (Trace_stream) {
delete Trace_stream;
Trace_stream = NULL;
}
break;
}
:(before "End Primitive Recipe Declarations")
_EXIT,
:(before "End Primitive Recipe Numbers")

View File

@ -116,7 +116,7 @@ void run_mu_scenario(const scenario& s) {
setup();
}
run("recipe "+s.name+" [ " + s.to_run + " ]");
if (not_already_inside_test) {
if (not_already_inside_test && Trace_stream) {
teardown();
ofstream fout((Trace_dir+Trace_file).c_str());
fout << Trace_stream->readable_contents("");

View File

@ -26,6 +26,7 @@ recipe main [
# program.
scenario print-board-and-read-move [
$close-trace # this test generates a 300+ MB trace!
# we'll make the screen really wide because the program currently prints out a long line
assume-screen 120:literal/width, 20:literal/height
# initialize keyboard to type in a move