about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-18 18:51:48 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-18 18:51:48 -0700
commita39df92d50347177e93a8828d133b57c7056c5f4 (patch)
tree011cba4cbc093f0a496ca035ea14e5785a422f7d
parent8ba8f0f6f268ede8f16f5b7f6c7b2470c836964c (diff)
downloadmu-a39df92d50347177e93a8828d133b57c7056c5f4.tar.gz
1401 - shave 80% off chessboard test time
It was all going to laboriously writing out 300+ MB to disk.
-rw-r--r--027debug.cc13
-rw-r--r--050scenario.cc2
-rw-r--r--chessboard.mu1
3 files changed, 15 insertions, 1 deletions
diff --git a/027debug.cc b/027debug.cc
index 7b96e4e9..6b409d0b 100644
--- a/027debug.cc
+++ b/027debug.cc
@@ -47,6 +47,19 @@ case _STOP_TRACING: {
 }
 
 :(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")
 Recipe_number["$exit"] = _EXIT;
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