Exemplo n.º 1
0
def main(args):
  trace1 = parse_event_trace(args.trace1)
  trace2 = parse_event_trace(args.trace2)

  if args.ignore_inputs:
    filtered_classes = set(replay_events.all_input_events)
  else:
    filtered_classes = set()

  print "Events in trace1, not in trace2"
  print "================================="
  t1_t2_stats = Stats()
  for e in l_minus_r(trace1, trace2):
    if type(e) not in filtered_classes:
      t1_t2_stats.update(e)
      for field in default_fields:
        field_formatters[field](e)
  print str(t1_t2_stats)

  print "Events in trace2, not in trace1"
  print "================================="
  t2_t1_stats = Stats()
  for e in l_minus_r(trace2, trace1):
    if type(e) not in filtered_classes:
      t2_t1_stats.update(e)
      for field in default_fields:
        field_formatters[field](e)
  print str(t2_t1_stats)
Exemplo n.º 2
0
def main(args):
    # Grab JSON of which subsequences triggered a bug.
    replay_idx_to_violation = parse_json(args.subsequence_violations)

    subsequence_dirs = [
        InterReplayDirectory(d)
        for d in glob.glob(args.directory + "/interreplay_*")
    ]
    assert (subsequence_dirs != [])
    subsequence_dirs.sort(key=lambda d: d.index)

    # First, grab all inputs so we know how to format
    repro_dir = subsequence_dirs.pop(0)
    assert (os.path.basename(
        str(repro_dir)) == "interreplay_0_reproducibility")
    full_trace = parse_event_trace(str(repro_dir) + "/events.trace")
    trace_formatter = TraceFormatter(full_trace)

    # Now format each subsequence
    columns = []
    columns.append(["subsequence", lambda row: row[0]])
    columns.append(["# inputs", lambda row: row[1]])
    columns.append(["MCS size", lambda row: row[2]])
    for idx, e in enumerate(full_trace.input_events):
        # See: http://stackoverflow.com/questions/233673/lexical-closures-in-python
        def bind_closure(index):
            return lambda row: row[index + 3]

        columns.append([e.label, bind_closure(idx)])
    t = Tabular(columns)
    rows = []
    for subsequence_dir in subsequence_dirs:
        try:
            if "_final_mcs" in str(subsequence_dir):
                # Make sure to always print the final MCS
                trace = parse_event_trace(
                    str(subsequence_dir) + "/events.trace")
                rows.append(trace_formatter.format_trace("MCS", trace))
            elif replay_idx_to_violation[subsequence_dir.index]:
                # Otherwise only consider subsequences that resulted in a violation
                trace = parse_event_trace(
                    str(subsequence_dir) + "/events.trace")
                rows.append(
                    trace_formatter.format_trace(subsequence_dir.index, trace))
        except KeyError as e:
            print >> sys.stderr, "WARN: No such subsequence: %s" % str(e)

    t.show(rows)
def main(args):
  # Grab JSON of which subsequences triggered a bug.
  replay_idx_to_violation = parse_json(args.subsequence_violations)

  subsequence_dirs = [ InterReplayDirectory(d) for d in
                       glob.glob(args.directory + "/interreplay_*") ]
  assert(subsequence_dirs != [])
  subsequence_dirs.sort(key=lambda d: d.index)

  # First, grab all inputs so we know how to format
  repro_dir = subsequence_dirs.pop(0)
  assert(os.path.basename(str(repro_dir)) == "interreplay_0_reproducibility")
  full_trace = parse_event_trace(str(repro_dir) + "/events.trace")
  trace_formatter = TraceFormatter(full_trace)

  # Now format each subsequence
  columns = []
  columns.append(["subsequence", lambda row: row[0]])
  columns.append(["# inputs", lambda row: row[1]])
  columns.append(["MCS size", lambda row: row[2]])
  for idx, e in enumerate(full_trace.input_events):
    # See: http://stackoverflow.com/questions/233673/lexical-closures-in-python
    def bind_closure(index):
      return lambda row: row[index+3]
    columns.append([e.label, bind_closure(idx)])
  t = Tabular(columns)
  rows = []
  for subsequence_dir in subsequence_dirs:
    try:
      if "_final_mcs" in str(subsequence_dir):
        # Make sure to always print the final MCS
        trace = parse_event_trace(str(subsequence_dir) + "/events.trace")
        rows.append(trace_formatter.format_trace("MCS", trace))
      elif replay_idx_to_violation[subsequence_dir.index]:
        # Otherwise only consider subsequences that resulted in a violation
        trace = parse_event_trace(str(subsequence_dir) + "/events.trace")
        rows.append(trace_formatter.format_trace(subsequence_dir.index, trace))
    except KeyError as e:
      print >> sys.stderr, "WARN: No such subsequence: %s" % str(e)

  t.show(rows)