From a39df92d50347177e93a8828d133b57c7056c5f4 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 18 May 2015 18:51:48 -0700 Subject: 1401 - shave 80% off chessboard test time It was all going to laboriously writing out 300+ MB to disk. --- 027debug.cc | 13 +++++++++++++ 050scenario.cc | 2 +- chessboard.mu | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/027debug.cc b/027debug.cc index 7b96e4e9..6b409d0b 100644 --- a/027debug.cc +++ b/027debug.cc @@ -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") diff --git a/050scenario.cc b/050scenario.cc index ee6485a9..c1895689 100644 --- a/050scenario.cc +++ b/050scenario.cc @@ -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(""); diff --git a/chessboard.mu b/chessboard.mu index 80551d21..5faaead5 100644 --- a/chessboard.mu +++ b/chessboard.mu @@ -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 -- cgit 1.4.1-2-gfad0