Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 29ba580

Browse files
committed
Add valgrind memcheck support to backend_driver.py
svn path=/trunk/matplotlib/; revision=4982
1 parent c3f97a9 commit 29ba580

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

examples/backend_driver.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ def drive(backend, python=['python'], switches = []):
147147
continue
148148

149149
print ('\tdriving %-40s' % (fname)),
150+
sys.stdout.flush()
150151
basename, ext = os.path.splitext(fname)
151152
outfile = os.path.join(path,basename)
152153
tmpfile_name = '_tmp_%s.py' % basename
@@ -180,7 +181,8 @@ def drive(backend, python=['python'], switches = []):
180181

181182
tmpfile.close()
182183
start_time = time.time()
183-
run(python + [tmpfile_name, switchstring])
184+
program = [x % {'name': basename} for x in python]
185+
run(program + [tmpfile_name, switchstring])
184186
end_time = time.time()
185187
print (end_time - start_time)
186188
#os.system('%s %s %s' % (python, tmpfile_name, switchstring))
@@ -192,6 +194,10 @@ def drive(backend, python=['python'], switches = []):
192194
if '--coverage' in sys.argv:
193195
python = ['coverage.py', '-x']
194196
sys.argv.remove('--coverage')
197+
elif '--valgrind' in sys.argv:
198+
python = ['valgrind', '--tool=memcheck', '--leak-check=yes',
199+
'--log-file=%(name)s', 'python']
200+
sys.argv.remove('--valgrind')
195201
elif sys.platform == 'win32':
196202
python = [r'c:\Python24\python.exe']
197203
else:

0 commit comments

Comments
 (0)