3101 - purge .traces/ dir from repo history

I'd been toying with this idea for some time now given how large the
repo had been growing. The final straw was noticing that people cloning
the repo were having to wait *5 minutes*! That's not good, particularly
for a project with 'tiny' in its description. After purging .traces/
clone time drops to 7 seconds in my tests.

Major issue: some commits refer to .traces/ but don't really change
anything there. That could get confusing :/

Minor issues:

a) I've linked inside commits on GitHub like a half-dozen times online
or over email. Those links are now liable to eventually break. (I seem
to recall GitHub keeps them around as long as they get used at least
once every 60 days, or something like that.)

b) Numbering of commits is messed up because some commits only had
changes to the .traces/ sub-directory.
This commit is contained in:
Kartik K. Agaram 2016-07-05 00:53:12 -07:00
parent 7e85c3362c
commit f28f2636c6
13 changed files with 17 additions and 50 deletions

View File

@ -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;
}
};

View File

@ -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.

View File

@ -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"

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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"

View File

@ -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())

View File

@ -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

View File

@ -5,4 +5,4 @@
# $ git config alias.ll '!./git_log_filtered'
# $ git ll --stat
git log $* -- . ":(exclude)html" ":(exclude).traces"
git log $* -- . ":(exclude)html"

View File

@ -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.

View File

@ -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)));

View File

@ -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();