def testGoodInput(self): '''Given correct result data, check that every result being saved has the right parameters''' for resultparams in saveresults.save("pypy", 71212, self.fixture, "", "pypy-c-jit", "tannit", True): self.assertEqual(resultparams['project'], "pypy") self.assertEqual(resultparams['commitid'], 71212) self.assertEqual(resultparams['executable'], "pypy-c-jit") # get dict with correct data for this benchmark fixturedata = [] benchfound = False for res in self.fixture: if res[0] == resultparams['benchmark']: fixturedata = res benchfound = True break self.assertTrue(benchfound) # get correct result value depending on the type of result fixturevalue = 0 if fixturedata[1] == "SimpleComparisonResult": fixturevalue = fixturedata[2]['changed_time'] else: fixturevalue = fixturedata[2]['avg_changed'] self.assertEqual(resultparams['result_value'], fixturevalue)
response = "None" if hasattr(e, 'reason'): response = '\n We failed to reach ' + RESULTS_URL + '\n' response += ' Reason: ' + str(e.reason) elif hasattr(e, 'code'): response = '\n The server couldn\'t fulfill the request\n' response += ' Error code: ' + str(e) print "Results Server (%s) response: %s\n" % (RESULTS_URL, response) sys.exit(1) finally: datasource.close() # read json result and save to speed.pypy.org for filename in filelist: print "Reading %s..." % filename f = urllib2.urlopen(RESULTS_URL + filename) result = simplejson.load(f) f.close() proj = PROJECT revision = result['revision'] interpreter = INTERP int_options = "gc=hybrid" options = "" if result.has_key('options'): options = result['options'] host = 'tannit' saveresults.save(proj, revision, result['results'], options, interpreter, int_options, host) if filename == filelist[len(filelist)-1]: savecpython.save('cpython', '262', result['results'], options, 'cpython', '', host) print "\nOK"
if hasattr(e, 'reason'): response = '\n We failed to reach ' + RESULTS_URL + '\n' response += ' Reason: ' + str(e.reason) elif hasattr(e, 'code'): response = '\n The server couldn\'t fulfill the request\n' response += ' Error code: ' + str(e) print "Results Server (%s) response: %s\n" % (RESULTS_URL, response) sys.exit(1) finally: datasource.close() # read json result and save to speed.pypy.org for filename in filelist: print "Reading %s..." % filename f = urllib2.urlopen(RESULTS_URL + filename) result = simplejson.load(f) f.close() proj = PROJECT revision = result['revision'] interpreter = INTERP int_options = "" options = "" if result.has_key('options'): options = result['options'] host = 'tannit' saveresults.save(proj, revision, result['results'], options, interpreter, int_options, host) #if filename == filelist[len(filelist)-1]: #savecpython.save('cpython', '262', result['results'], options, 'cpython', '', host) print "\nOK"