Commits

Armin Rigo committed ded4fba

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

Comments (0)

Files changed (2)

rpython/translator/c/src/debug_print.c

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

rpython/translator/c/test/test_standalone.py

             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,