about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--003trace.cc11
-rw-r--r--010vm.cc3
-rw-r--r--011load.cc1
-rw-r--r--020run.cc8
-rw-r--r--029tools.cc4
-rw-r--r--050scenario.cc10
-rw-r--r--056shape_shifting_recipe.cc2
-rw-r--r--091run_interactive.cc3
-rw-r--r--Readme.md6
-rwxr-xr-xgit_log_filtered2
-rw-r--r--sandbox/Readme.md4
-rw-r--r--tangle/003tangle.cc1
-rw-r--r--tangle/003tangle.test.cc12
13 files changed, 17 insertions, 50 deletions
diff --git a/003trace.cc b/003trace.cc
index 2481c0be..23fd8781 100644
--- a/003trace.cc
+++ b/003trace.cc
@@ -181,22 +181,19 @@ ostream& operator<<(ostream& os, unused end) {
 
 #define DUMP(label)  if (Trace_stream) cerr << Trace_stream->readable_contents(label);
 
-// All scenarios save their traces in the repo, just like code. This gives
-// future readers more meat when they try to make sense of a new project.
-static string Trace_dir = ".traces/";
-string Trace_file;
+bool Save_trace = false;
 
 // Trace_stream is a resource, lease_tracer uses RAII to manage it.
 struct lease_tracer {
   lease_tracer() { Trace_stream = new trace_stream; }
   ~lease_tracer() {
     if (!Trace_stream) return;  // in case tests close Trace_stream
-    if (!Trace_file.empty()) {
-      ofstream fout((Trace_dir+Trace_file).c_str());
+    if (Save_trace) {
+      ofstream fout("last_trace");
       fout << Trace_stream->readable_contents("");
       fout.close();
     }
-    delete Trace_stream, Trace_stream = NULL, Trace_file = "";
+    delete Trace_stream, Trace_stream = NULL;
   }
 };
 
diff --git a/010vm.cc b/010vm.cc
index 8599b74d..198244e4 100644
--- a/010vm.cc
+++ b/010vm.cc
@@ -434,8 +434,7 @@ void dump_memory() {
 }
 
 //:: Helpers for converting various values to string
-//: Use to_string() in trace(), and try to avoid relying on unstable codes that
-//: will perturb .traces/ from commit to commit.
+//: Use to_string() in trace(), and try to keep it stable from run to run.
 //: Use debug_string() while debugging, and throw everything into it.
 //: Use inspect() only for emitting a canonical format that can be parsed back
 //: into the value.
diff --git a/011load.cc b/011load.cc
index 3f273d74..3a65586b 100644
--- a/011load.cc
+++ b/011load.cc
@@ -336,7 +336,6 @@ def main [
 //: this test we can't represent with a scenario
 :(code)
 void test_parse_comment_terminated_by_eof() {
-  Trace_file = "parse_comment_terminated_by_eof";
   load("recipe main [\n"
        "  a:number <- copy 34\n"
        "]\n"
diff --git a/020run.cc b/020run.cc
index 228c8e2d..5568b2a4 100644
--- a/020run.cc
+++ b/020run.cc
@@ -134,7 +134,7 @@ inline const vector<instruction>& routine::steps() const {
 //: Step 1: load all .mu files with numeric prefixes (in order)
 :(before "End Load Recipes")
 // Load .mu Core
-//? Trace_file = "interactive";
+//? Save_trace = true;
 //? START_TRACING_UNTIL_END_OF_SCOPE;
 load_file_or_directory("core.mu");
 //? DUMP("");
@@ -168,7 +168,7 @@ save_snapshots();
 if (!Run_tests && contains_key(Recipe_ordinal, "main") && contains_key(Recipe, get(Recipe_ordinal, "main"))) {
   // Running Main
   setup();
-//?   Trace_file = "interactive";
+//?   Save_trace = true;
 //?   START_TRACING_UNTIL_END_OF_SCOPE;
   trace(9990, "run") << "=== Starting to run" << end();
   assert(Num_calls_to_transform_all == 1);
@@ -201,8 +201,8 @@ void dump_profile() {
 
 :(code)
 void cleanup_main() {
-  if (!Trace_file.empty() && Trace_stream) {
-    ofstream fout((Trace_dir+Trace_file).c_str());
+  if (Save_trace && Trace_stream) {
+    ofstream fout("interactive");
     fout << Trace_stream->readable_contents("");
     fout.close();
   }
diff --git a/029tools.cc b/029tools.cc
index c9700752..108fa0ed 100644
--- a/029tools.cc
+++ b/029tools.cc
@@ -179,8 +179,8 @@ case _SAVE_TRACE: {
 }
 :(before "End Primitive Recipe Implementations")
 case _SAVE_TRACE: {
-  if (!Trace_file.empty()) {
-    ofstream fout((Trace_dir+Trace_file).c_str());
+  if (Save_trace) {
+    ofstream fout("last_trace");
     fout << Trace_stream->readable_contents("");
     fout.close();
   }
diff --git a/050scenario.cc b/050scenario.cc
index 8a9a57d4..b177cab9 100644
--- a/050scenario.cc
+++ b/050scenario.cc
@@ -145,7 +145,6 @@ void run_mu_scenario(const scenario& s) {
   bool not_already_inside_test = !Trace_stream;
 //?   cerr << s.name << '\n';
   if (not_already_inside_test) {
-    Trace_file = s.name;
     Trace_stream = new trace_stream;
     setup();
   }
@@ -161,12 +160,13 @@ void run_mu_scenario(const scenario& s) {
   // End Mu Test Teardown
   if (not_already_inside_test && Trace_stream) {
     teardown();
-    ofstream fout((Trace_dir+Trace_file).c_str());
-    fout << Trace_stream->readable_contents("");
-    fout.close();
+    if (Save_trace) {
+      ofstream fout("last_trace");
+      fout << Trace_stream->readable_contents("");
+      fout.close();
+    }
     delete Trace_stream;
     Trace_stream = NULL;
-    Trace_file = "";
   }
   Current_scenario = NULL;
 }
diff --git a/056shape_shifting_recipe.cc b/056shape_shifting_recipe.cc
index 62da296f..ead3296e 100644
--- a/056shape_shifting_recipe.cc
+++ b/056shape_shifting_recipe.cc
@@ -685,8 +685,6 @@ $error: 0
 :(code)
 // this one needs a little more fine-grained control
 void test_shape_shifting_new_ingredient_does_not_pollute_global_namespace() {
-  Trace_file = "shape_shifting_new_ingredient_does_not_pollute_global_namespace";
-
   // if you specialize a shape-shifting recipe that allocates a type-ingredient..
   transform("def barz x:_elem [\n"
             "  local-scope\n"
diff --git a/091run_interactive.cc b/091run_interactive.cc
index 59c17312..f1647c59 100644
--- a/091run_interactive.cc
+++ b/091run_interactive.cc
@@ -123,8 +123,6 @@ void run_code_begin(bool should_stash_snapshots) {
   if (should_stash_snapshots)
     stash_snapshots();
   Save_trace_stream = Trace_stream;
-  Save_trace_file = Trace_file;
-  Trace_file = "";
   Trace_stream = new trace_stream;
   Trace_stream->collect_depth = App_depth;
 }
@@ -135,7 +133,6 @@ void run_code_end() {
   delete Trace_stream;
   Trace_stream = Save_trace_stream;
   Save_trace_stream = NULL;
-  Trace_file = Save_trace_file;
   Save_trace_file.clear();
   Recipe.erase(get(Recipe_ordinal, "interactive"));  // keep past sandboxes from inserting errors
   if (!Recipe_snapshot_stash.empty())
diff --git a/Readme.md b/Readme.md
index 623ed55b..8081ee69 100644
--- a/Readme.md
+++ b/Readme.md
@@ -313,12 +313,6 @@ c) Try running the tests:
   $ ./mu test
   ```
 
-You might also want to peek in the `.traces` directory, which automatically
-includes logs for each test showing you just how it ran on my machine. If Mu
-eventually gets complex enough that you have trouble running examples, these
-logs might help figure out if my system is somehow different from yours or if
-I've just been insufficiently diligent and my documentation is out of date.
-
 d) Try out the programming environment:
 
   ```shell
diff --git a/git_log_filtered b/git_log_filtered
index 0ca96fdf..e896cabd 100755
--- a/git_log_filtered
+++ b/git_log_filtered
@@ -5,4 +5,4 @@
 #   $ git config alias.ll '!./git_log_filtered'
 #   $ git ll --stat
 
-git log $* -- . ":(exclude)html" ":(exclude).traces"
+git log $* -- . ":(exclude)html"
diff --git a/sandbox/Readme.md b/sandbox/Readme.md
index 5a6d6336..f2cb2fd9 100644
--- a/sandbox/Readme.md
+++ b/sandbox/Readme.md
@@ -18,7 +18,3 @@ either side to run the sandbox.
 
 Known issues: you have to explicitly save inside your editor before hitting
 F4, unlike with 'mu edit'.
-
-One problem with a fork of the edit/ app is that many of the tests write to
-the same files under the .traces/ directory. I try to always commit the
-results of edit/ rather than the sandbox/ app, but I haven't been perfect.
diff --git a/tangle/003tangle.cc b/tangle/003tangle.cc
index 086cca23..ff9aa56e 100644
--- a/tangle/003tangle.cc
+++ b/tangle/003tangle.cc
@@ -300,7 +300,6 @@ list<Line>::iterator balancing_curly(list<Line>::iterator curr) {
 // Remember to update is_input below if you add to this format.
 void emit_test(const string& name, list<Line>& lines, list<Line>& result) {
   result.push_back(Line("void test_"+name+"() {", front(lines).filename, front(lines).line_number-1));  // use line number of directive
-  result.push_back(Line("  Trace_file = \""+name+"\";", front(lines).filename, front(lines).line_number-1));
   while (!lines.empty()) {
     while (!lines.empty() && starts_with(front(lines).contents, "% ")) {
       result.push_back(Line("  "+front(lines).contents.substr(strlen("% ")), front(lines)));
diff --git a/tangle/003tangle.test.cc b/tangle/003tangle.test.cc
index 0c7b94f3..9c8c4040 100644
--- a/tangle/003tangle.test.cc
+++ b/tangle/003tangle.test.cc
@@ -170,7 +170,6 @@ void test_tangle_supports_scenarios() {
   list<Line> lines;
   tangle(in, lines);
   CHECK_EQ(lines.front().contents, "void test_does_bar() {");  lines.pop_front();
-  CHECK_EQ(lines.front().contents, "  Trace_file = \"does_bar\";"); lines.pop_front();
   CHECK_EQ(lines.front().contents, "  run(\"abc def\\n\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "  CHECK_TRACE_CONTENTS(\"layer1: pqrlayer2: xyz\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "}");  lines.pop_front();
@@ -182,7 +181,6 @@ void test_tangle_ignores_empty_lines_in_scenarios() {
   list<Line> lines;
   tangle(in, lines);
   CHECK_EQ(lines.front().contents, "void test_does_bar() {");  lines.pop_front();
-  CHECK_EQ(lines.front().contents, "  Trace_file = \"does_bar\";"); lines.pop_front();
   CHECK_EQ(lines.front().contents, "  run(\"abc def\\n\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "  CHECK_TRACE_CONTENTS(\"layer1: pqrlayer2: xyz\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "}");  lines.pop_front();
@@ -201,7 +199,6 @@ void test_tangle_supports_configurable_toplevel() {
   list<Line> lines;
   tangle(in, lines);
   CHECK_EQ(lines.front().contents, "void test_does_bar() {");  lines.pop_front();
-  CHECK_EQ(lines.front().contents, "  Trace_file = \"does_bar\";"); lines.pop_front();
   CHECK_EQ(lines.front().contents, "  foo(\"abc def\\n\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "  CHECK_TRACE_CONTENTS(\"layer1: pqr\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "}");  lines.pop_front();
@@ -216,7 +213,6 @@ void test_tangle_can_hide_warnings_in_scenarios() {
   list<Line> lines;
   tangle(in, lines);
   CHECK_EQ(lines.front().contents, "void test_does_bar() {");  lines.pop_front();
-  CHECK_EQ(lines.front().contents, "  Trace_file = \"does_bar\";"); lines.pop_front();
   CHECK_EQ(lines.front().contents, "  Hide_warnings = true;");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "  run(\"abc def\\n\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "  CHECK_TRACE_CONTENTS(\"layer1: pqrlayer2: xyz\");");  lines.pop_front();
@@ -229,7 +225,6 @@ void test_tangle_supports_strings_in_scenarios() {
   list<Line> lines;
   tangle(in, lines);
   CHECK_EQ(lines.front().contents, "void test_does_bar() {");  lines.pop_front();
-  CHECK_EQ(lines.front().contents, "  Trace_file = \"does_bar\";"); lines.pop_front();
   CHECK_EQ(lines.front().contents, "  run(\"abc \\\"def\\\"\\n\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "  CHECK_TRACE_CONTENTS(\"layer1: pqrlayer2: \\\"xyz\\\"\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "}");  lines.pop_front();
@@ -241,7 +236,6 @@ void test_tangle_supports_strings_in_scenarios2() {
   list<Line> lines;
   tangle(in, lines);
   CHECK_EQ(lines.front().contents, "void test_does_bar() {");  lines.pop_front();
-  CHECK_EQ(lines.front().contents, "  Trace_file = \"does_bar\";"); lines.pop_front();
   CHECK_EQ(lines.front().contents, "  run(\"abc \\\"\\\"\\n\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "  CHECK_TRACE_CONTENTS(\"layer1: pqrlayer2: \\\"\\\"\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "}");  lines.pop_front();
@@ -253,7 +247,6 @@ void test_tangle_supports_multiline_input_in_scenarios() {
   list<Line> lines;
   tangle(in, lines);
   CHECK_EQ(lines.front().contents, "void test_does_bar() {");  lines.pop_front();
-  CHECK_EQ(lines.front().contents, "  Trace_file = \"does_bar\";"); lines.pop_front();
   CHECK_EQ(lines.front().contents, "  run(\"abc def\\n  efg\\n\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "  CHECK_TRACE_CONTENTS(\"layer1: pqrlayer2: \\\"\\\"\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "}");  lines.pop_front();
@@ -265,7 +258,6 @@ void test_tangle_supports_reset_in_scenarios() {
   list<Line> lines;
   tangle(in, lines);
   CHECK_EQ(lines.front().contents, "void test_does_bar() {");  lines.pop_front();
-  CHECK_EQ(lines.front().contents, "  Trace_file = \"does_bar\";"); lines.pop_front();
   CHECK_EQ(lines.front().contents, "  run(\"abc def\\n\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "  CLEAR_TRACE;");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "  run(\"efg\\n\");");  lines.pop_front();
@@ -279,7 +271,6 @@ void test_tangle_can_check_for_absence_at_end_of_scenarios() {
   list<Line> lines;
   tangle(in, lines);
   CHECK_EQ(lines.front().contents, "void test_does_bar() {");  lines.pop_front();
-  CHECK_EQ(lines.front().contents, "  Trace_file = \"does_bar\";"); lines.pop_front();
   CHECK_EQ(lines.front().contents, "  run(\"abc def\\n  efg\\n\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "  CHECK_TRACE_CONTENTS(\"layer1: pqr\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "  CHECK_TRACE_DOESNT_CONTAIN(\"layer1: xyz\");");  lines.pop_front();
@@ -292,7 +283,6 @@ void test_tangle_can_check_for_absence_at_end_of_scenarios2() {
   list<Line> lines;
   tangle(in, lines);
   CHECK_EQ(lines.front().contents, "void test_does_bar() {");  lines.pop_front();
-  CHECK_EQ(lines.front().contents, "  Trace_file = \"does_bar\";"); lines.pop_front();
   CHECK_EQ(lines.front().contents, "  run(\"abc def\\n  efg\\n\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "  CHECK_TRACE_DOESNT_CONTAIN(\"layer1: pqr\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "  CHECK_TRACE_DOESNT_CONTAIN(\"layer1: xyz\");");  lines.pop_front();
@@ -305,7 +295,6 @@ void test_tangle_can_check_for_count_in_scenario() {
   list<Line> lines;
   tangle(in, lines);
   CHECK_EQ(lines.front().contents, "void test_does_bar() {");  lines.pop_front();
-  CHECK_EQ(lines.front().contents, "  Trace_file = \"does_bar\";"); lines.pop_front();
   CHECK_EQ(lines.front().contents, "  run(\"abc def\\n  efg\\n\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "  CHECK_TRACE_COUNT(\"layer1\", 2);");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "}");  lines.pop_front();
@@ -317,7 +306,6 @@ void test_tangle_can_handle_mu_comments_in_scenario() {
   list<Line> lines;
   tangle(in, lines);
   CHECK_EQ(lines.front().contents, "void test_does_bar() {");  lines.pop_front();
-  CHECK_EQ(lines.front().contents, "  Trace_file = \"does_bar\";"); lines.pop_front();
   CHECK_EQ(lines.front().contents, "  run(\"abc def\\n# comment1\\n  efg\\n  # indented comment 2\\n\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "  CHECK_TRACE_CONTENTS(\"layer1: pqrlayer1: xyz\");");  lines.pop_front();
   CHECK_EQ(lines.front().contents, "  CHECK_TRACE_DOESNT_CONTAIN(\"layer1: z\");");  lines.pop_front();