Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r72045:ded4fbaff95a
Date: 2014-06-13 15:45 +0200
http://bitbucket.org/pypy/pypy/changeset/ded4fbaff95a/

Log:    Support "PYPYLOG=+filename", equivalent to "PYPYLOG=filename" but
        works also if the file name happens to contain a colon.

diff --git a/rpython/translator/c/src/debug_print.c 
b/rpython/translator/c/src/debug_print.c
--- a/rpython/translator/c/src/debug_print.c
+++ b/rpython/translator/c/src/debug_print.c
@@ -32,9 +32,14 @@
   if (filename && filename[0])
     {
       char *colon = strchr(filename, ':');
+      if (filename[0] == '+')
+        {
+          filename += 1;
+          colon = NULL;
+        }
       if (!colon)
         {
-          /* PYPYLOG=filename --- profiling version */
+          /* PYPYLOG=+filename (or just 'filename') --- profiling version */
           debug_profile = 1;
           pypy_setup_profiling();
         }
diff --git a/rpython/translator/c/test/test_standalone.py 
b/rpython/translator/c/test/test_standalone.py
--- a/rpython/translator/c/test/test_standalone.py
+++ b/rpython/translator/c/test/test_standalone.py
@@ -397,6 +397,22 @@
             assert 'cat2}' in data
             assert 'baz' not in data
             assert 'bok' not in data
+        # check with PYPYLOG=+somefilename
+        path = udir.join('test_debug_xxx_prof_2.log')
+        out, err = cbuilder.cmdexec("", err=True, env={'PYPYLOG': '+%s' % 
path})
+        size = os.stat(str(path)).st_size
+        assert out.strip() == 'got:a.' + str(size) + '.'
+        assert not err
+        assert path.check(file=1)
+        data = path.read()
+        assert 'toplevel' in data
+        assert '{mycat' in data
+        assert 'mycat}' in data
+        assert 'foo 2 bar 3' not in data
+        assert '{cat2' in data
+        assert 'cat2}' in data
+        assert 'baz' not in data
+        assert 'bok' not in data
         # check with PYPYLOG=myc:somefilename   (includes mycat but not cat2)
         path = udir.join('test_debug_xxx_myc.log')
         out, err = cbuilder.cmdexec("", err=True,
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to