Revision: 7548 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7548&view=rev Author: astraw Date: 2009年08月24日 02:37:21 +0000 (2009年8月24日) Log Message: ----------- buildbot: add script to consolidate failed images Added Paths: ----------- trunk/matplotlib/test/_buildbot_test_postmortem.py Added: trunk/matplotlib/test/_buildbot_test_postmortem.py =================================================================== --- trunk/matplotlib/test/_buildbot_test_postmortem.py (rev 0) +++ trunk/matplotlib/test/_buildbot_test_postmortem.py 2009年08月24日 02:37:21 UTC (rev 7548) @@ -0,0 +1,104 @@ +"""For all failed image comparisons, gather the baseline image, the +current image and the absdiff image into a single directory specified +by target_dir. + +This is meant to be run from the mplroot directory.""" + +import os, sys, glob, shutil + +roots = ['test_matplotlib','test_plots'] +savedresults_dir = 'saved-results' +baseline_dir = 'baseline' +basename = 'failed-diff-' +target_dir = os.path.abspath('status_images') +nbase = len(basename) + +def listFiles(root, patterns='*', recurse=1, return_folders=0): + """ + Recursively list files + + from Parmar and Martelli in the Python Cookbook + """ + import os.path, fnmatch + # Expand patterns from semicolon-separated string to list + pattern_list = patterns.split(';') + # Collect input and output arguments into one bunch + class Bunch: + def __init__(self, **kwds): self.__dict__.update(kwds) + arg = Bunch(recurse=recurse, pattern_list=pattern_list, + return_folders=return_folders, results=[]) + + def visit(arg, dirname, files): + # Append to arg.results all relevant files (and perhaps folders) + for name in files: + fullname = os.path.normpath(os.path.join(dirname, name)) + if arg.return_folders or os.path.isfile(fullname): + for pattern in arg.pattern_list: + if fnmatch.fnmatch(name, pattern): + arg.results.append(fullname) + break + # Block recursion if recursion was disallowed + if not arg.recurse: files[:]=[] + + os.path.walk(root, visit, arg) + + return arg.results + +def get_recursive_filelist(args): + """ + Recurse all the files and dirs in *args* ignoring symbolic links + and return the files as a list of strings + """ + files = [] + + for arg in args: + if os.path.isfile(arg): + files.append(arg) + continue + if os.path.isdir(arg): + newfiles = listFiles(arg, recurse=1, return_folders=1) + files.extend(newfiles) + + return [f for f in files if not os.path.islink(f)] + +def path_split_all(fname): + """split a file path into a list of directories and filename""" + pieces = [fname] + previous_tails = [] + while 1: + head,tail = os.path.split(pieces[0]) + if head=='': + return pieces + previous_tails + pieces = [head] + previous_tails.insert(0,tail) + +if 1: + if os.path.exists(target_dir): + shutil.rmtree(target_dir) + os.chdir('test') + for fpath in get_recursive_filelist(roots): + # only images + if not fpath.endswith('.png'): continue + + pieces = path_split_all( fpath ) + if pieces[1]!=savedresults_dir: + continue + root = pieces[0] + testclass = pieces[2] + fname = pieces[3] + if not fname.startswith(basename): + # only failed images + continue + origname = fname[nbase:] + testname = os.path.splitext(origname)[0] + + # make a name for the test + teststr = '%s.%s.%s'%(root,testclass,testname) + this_targetdir = os.path.join(target_dir,teststr) + os.makedirs( this_targetdir ) + shutil.copy( os.path.join(root,baseline_dir,testclass,origname), + os.path.join(this_targetdir,'baseline.png') ) + shutil.copy( os.path.join(root,savedresults_dir,testclass,origname), + os.path.join(this_targetdir,'actual.png') ) + shutil.copy( os.path.join(root,savedresults_dir,testclass,fname), + os.path.join(this_targetdir,'absdiff.png') ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7549 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7549&view=rev Author: astraw Date: 2009年08月24日 03:21:12 +0000 (2009年8月24日) Log Message: ----------- buildbot: set file permissions on files to upload Modified Paths: -------------- trunk/matplotlib/test/_buildbot_test_postmortem.py Modified: trunk/matplotlib/test/_buildbot_test_postmortem.py =================================================================== --- trunk/matplotlib/test/_buildbot_test_postmortem.py 2009年08月24日 02:37:21 UTC (rev 7548) +++ trunk/matplotlib/test/_buildbot_test_postmortem.py 2009年08月24日 03:21:12 UTC (rev 7549) @@ -102,3 +102,8 @@ os.path.join(this_targetdir,'actual.png') ) shutil.copy( os.path.join(root,savedresults_dir,testclass,fname), os.path.join(this_targetdir,'absdiff.png') ) + + os.chmod(this_targetdir,0755) + os.chmod(os.path.join(this_targetdir,'baseline.png'),0744) + os.chmod(os.path.join(this_targetdir,'actual.png'),0744) + os.chmod(os.path.join(this_targetdir,'absdiff.png'),0744) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7550 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7550&view=rev Author: astraw Date: 2009年08月24日 03:23:40 +0000 (2009年8月24日) Log Message: ----------- buildbot: set file permissions on files to upload (fix) Modified Paths: -------------- trunk/matplotlib/test/_buildbot_test_postmortem.py Modified: trunk/matplotlib/test/_buildbot_test_postmortem.py =================================================================== --- trunk/matplotlib/test/_buildbot_test_postmortem.py 2009年08月24日 03:21:12 UTC (rev 7549) +++ trunk/matplotlib/test/_buildbot_test_postmortem.py 2009年08月24日 03:23:40 UTC (rev 7550) @@ -103,6 +103,7 @@ shutil.copy( os.path.join(root,savedresults_dir,testclass,fname), os.path.join(this_targetdir,'absdiff.png') ) + os.chmod(target_dir,0755) os.chmod(this_targetdir,0755) os.chmod(os.path.join(this_targetdir,'baseline.png'),0744) os.chmod(os.path.join(this_targetdir,'actual.png'),0744) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7551 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7551&view=rev Author: astraw Date: 2009年08月24日 03:26:13 +0000 (2009年8月24日) Log Message: ----------- buildbot: revert set file permissions Modified Paths: -------------- trunk/matplotlib/test/_buildbot_test_postmortem.py Modified: trunk/matplotlib/test/_buildbot_test_postmortem.py =================================================================== --- trunk/matplotlib/test/_buildbot_test_postmortem.py 2009年08月24日 03:23:40 UTC (rev 7550) +++ trunk/matplotlib/test/_buildbot_test_postmortem.py 2009年08月24日 03:26:13 UTC (rev 7551) @@ -102,9 +102,3 @@ os.path.join(this_targetdir,'actual.png') ) shutil.copy( os.path.join(root,savedresults_dir,testclass,fname), os.path.join(this_targetdir,'absdiff.png') ) - - os.chmod(target_dir,0755) - os.chmod(this_targetdir,0755) - os.chmod(os.path.join(this_targetdir,'baseline.png'),0744) - os.chmod(os.path.join(this_targetdir,'actual.png'),0744) - os.chmod(os.path.join(this_targetdir,'absdiff.png'),0744) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7605 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7605&view=rev Author: astraw Date: 2009年08月30日 18:30:29 +0000 (2009年8月30日) Log Message: ----------- buildbot: prevent DirectoryUpload failure when all tests pass Modified Paths: -------------- trunk/matplotlib/test/_buildbot_test_postmortem.py Modified: trunk/matplotlib/test/_buildbot_test_postmortem.py =================================================================== --- trunk/matplotlib/test/_buildbot_test_postmortem.py 2009年08月30日 18:05:43 UTC (rev 7604) +++ trunk/matplotlib/test/_buildbot_test_postmortem.py 2009年08月30日 18:30:29 UTC (rev 7605) @@ -75,6 +75,7 @@ if 1: if os.path.exists(target_dir): shutil.rmtree(target_dir) + os.makedirs( target_dir ) # prevent buildbot DirectoryUpload failure os.chdir('test') for fpath in get_recursive_filelist(roots): # only images This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7963 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7963&view=rev Author: astraw Date: 2009年11月13日 00:44:11 +0000 (2009年11月13日) Log Message: ----------- testing bugfix: buildbot postmortem uses new file locations from r7830 Modified Paths: -------------- trunk/matplotlib/test/_buildbot_test_postmortem.py Modified: trunk/matplotlib/test/_buildbot_test_postmortem.py =================================================================== --- trunk/matplotlib/test/_buildbot_test_postmortem.py 2009年11月13日 00:44:03 UTC (rev 7962) +++ trunk/matplotlib/test/_buildbot_test_postmortem.py 2009年11月13日 00:44:11 UTC (rev 7963) @@ -81,9 +81,13 @@ # new matplotlib.testing infrastructure os.chdir('test') - for fname in glob.glob('*.png'): - absdiff_fname = diff_basename + fname - expected_fname = expected_basename + fname + for fname in get_recursive_filelist(['result_images']): + # only images + if not fname.endswith('.png'): continue + + result_dir, result_fname = os.path.split(fname) + absdiff_fname = os.path.join( result_dir, diff_basename + result_fname) + expected_fname = os.path.join( result_dir, expected_basename + result_fname) if not os.path.exists(absdiff_fname): continue if not os.path.exists(expected_fname): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.