about summary refs log tree commit diff stats
path: root/050scenario.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-07-26 10:09:29 -0700
committerKartik Agaram <vc@akkartik.com>2018-07-26 10:09:29 -0700
commit257add0f7e437f0a1a355a748be0c97e03882b0c (patch)
tree917af5e78761b1ce7f6f5e47b3736777b4930896 /050scenario.cc
parent3b798ea2c9dadca94f808f168dc2cb37abcaeb94 (diff)
downloadmu-257add0f7e437f0a1a355a748be0c97e03882b0c.tar.gz
4421
Clean up the rat's nest that all my trace management globals had
gradually turned into.

  a) Get rid of 'Start_tracing'. Horryibly named, I don't know how I
  missed that until now.

  b) Never use START_TRACING_UNTIL_END_OF_SCOPE in main(). It's
  confusing to combine it with atexit(delete Trace_stream), because the
  atexit() never has to run. Instead we'll just manually initialize
  Trace_stream and let atexit() clean up.

  c) If we run tests we only want a trace for the test run itself. So
  delete the Trace_stream that was initialized at the top of main --
  once it's clear we had no load-time errors.

  d) Clean up horribly "Load Recipes" waypoints, combine them with the better
  name, "Mu Prelude".

Putting these together, we have the following manual tests:

  - CFLAGS=-g mu x.mu

    Should not create last_run.

  - CFLAGS=-g mu --trace x.mu

    Should create last_run.
    Should write it out exactly once.

  - CFLAGS=-g mu --trace x.mu  # when x.mu has an error

    Should create last_run.
    Should write it out exactly once.

  - CFLAGS=-g mu --trace test copy_literal  # C test

    Should create last_run.
    Should write it out exactly once.

  - CFLAGS=-g mu --trace test recipe_with_header  # Mu test

    Should create last_run.
    Should write it out exactly once.

I don't know how to automate these scenarios yet. We need a way to run
our build toolchain atop our stack.
Diffstat (limited to '050scenario.cc')
-rw-r--r--050scenario.cc4
1 files changed, 1 insertions, 3 deletions
diff --git a/050scenario.cc b/050scenario.cc
index b4170f8c..9b7d1c2e 100644
--- a/050scenario.cc
+++ b/050scenario.cc
@@ -197,10 +197,8 @@ if (Test_only_app && Num_core_mu_scenarios < SIZE(Scenarios)) {
 :(after "Test Runs")
 for (int i = 0;  i < SIZE(Scenarios);  ++i) {
   if (Scenarios.at(i).name == argv[argc-1]) {
-    if (Start_tracing) {
+    if (Save_trace)
       Trace_stream = new trace_stream;
-      Save_trace = true;
-    }
     run_mu_scenario(Scenarios.at(i));
     if (Passed) cerr << ".\n";
     return 0;