From: Brian Warner <warner@allmydata.com>
Date: Sat, 6 Jan 2007 01:12:04 +0000 (-0700)
Subject: disable figleaf tracing during py_ecc, since it takes *forever*, especially on the... 
X-Git-Tag: tahoe_v0.1.0-0-UNSTABLE~396
X-Git-Url: https://git.rkrishnan.org/pf/index.php?a=commitdiff_plain;h=42c0d2e336122b4ac5d84a61581cbbf4d5dd4f97;p=tahoe-lafs%2Ftahoe-lafs.git

disable figleaf tracing during py_ecc, since it takes *forever*, especially on the slow buildslave
---

diff --git a/Makefile b/Makefile
index 515edc76..efac3630 100644
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@ REPORTER=
 test: build
 	$(PP) trial $(REPORTER) $(TEST)
 
-test-figleaf:
+test-figleaf: build
 	$(PP) trial --reporter=bwverbose-figleaf $(TEST)
 
 figleaf-output:
diff --git a/src/allmydata/encode.py b/src/allmydata/encode.py
index ae102789..d337689c 100644
--- a/src/allmydata/encode.py
+++ b/src/allmydata/encode.py
@@ -114,7 +114,7 @@ class PyRSEncoder(object):
     # of 6.7kBps. Zooko's mom's 1.8GHz G5 got 2.2kBps . slave3 took 40s to
     # construct the LUT and encodes at 1.5kBps, and for some reason took more
     # than 20 minutes to run the test_encode_share tests, so I disabled most
-    # of them.
+    # of them. (uh, hello, it's running figleaf)
 
     def set_params(self, data_size, required_shares, total_shares):
         assert required_shares <= total_shares
diff --git a/src/allmydata/test/trial_figleaf.py b/src/allmydata/test/trial_figleaf.py
index 5b00615b..57859f12 100644
--- a/src/allmydata/test/trial_figleaf.py
+++ b/src/allmydata/test/trial_figleaf.py
@@ -60,7 +60,12 @@ from twisted.trial.reporter import TreeReporter, VerboseTextReporter
 # finish in printSummary.
 
 from allmydata.util import figleaf
-figleaf.start()
+# don't cover py_ecc, it takes forever
+from allmydata.py_ecc import rs_code
+import os
+py_ecc_dir = os.path.realpath(os.path.dirname(rs_code.__file__))
+figleaf.start(ignore_prefixes=[py_ecc_dir])
+
 
 class FigleafReporter(TreeReporter):
     def __init__(self, *args, **kwargs):
diff --git a/src/allmydata/util/figleaf.py b/src/allmydata/util/figleaf.py
index 38045ef4..03d8c08d 100644
--- a/src/allmydata/util/figleaf.py
+++ b/src/allmydata/util/figleaf.py
@@ -158,10 +158,10 @@ class CodeTracer:
     """
     Basic code coverage tracking, using sys.settrace.
     """
-    def __init__(self, ignore_prefix=None):
+    def __init__(self, ignore_prefixes=[]):
         self.c = {}
         self.started = False
-        self.ignore_prefix = ignore_prefix
+        self.ignore_prefixes = ignore_prefixes
 
     def start(self):
         """
@@ -187,9 +187,9 @@ class CodeTracer:
         global trace function.
         """
         if e is 'call':
-            if self.ignore_prefix and \
-                   f.f_code.co_filename.startswith(self.ignore_prefix):
-                return
+            for p in self.ignore_prefixes:
+                if f.f_code.co_filename.startswith(p):
+                    return
 
             return self.t
 
@@ -316,7 +316,7 @@ def annotate_coverage(in_fp, out_fp, covered, all_lines,
 
 _t = None
 
-def start(ignore_python_lib=True):
+def start(ignore_python_lib=True, ignore_prefixes=[]):
     """
     Start tracing code coverage.  If 'ignore_python_lib' is True,
     ignore all files that live below the same directory as the 'os'
@@ -324,10 +324,10 @@ def start(ignore_python_lib=True):
     """
     global _t
     if _t is None:
-        ignore_path = None
+        ignore_prefixes = ignore_prefixes[:]
         if ignore_python_lib:
-            ignore_path = os.path.realpath(os.path.dirname(os.__file__))
-        _t = CodeTracer(ignore_path)
+            ignore_prefixes.append(os.path.realpath(os.path.dirname(os.__file__)))
+        _t = CodeTracer(ignore_prefixes)
 
     _t.start()