def get_sysinfo(self): import platform (system, node, release, version, machine, processor) = platform.uname() sysinfo = {'os.name' : system, 'hostname' : node, 'os.version.number' : version, 'os.version.string' : release, 'arch' : machine} if system == 'Darwin': sysinfo['os.name'] = "Mac OS X" sysinfo['os.version.number'] = platform.mac_ver()[0] sysinfo['os.version.string'] = platform.mac_ver()[0] elif (system == 'linux2') or (system in ('sunos5', 'solaris')): sysinfo['linux_distrobution'] = platform.linux_distrobution() sysinfo['libc_ver'] = platform.libc_ver() return sysinfo
def run_tests(self, test, report=False, sleeptime=4): self.add_listener(self.endTest_listener, eventType='mozmill.endTest') self.add_listener(self.endRunner_listener, eventType='mozmill.endRunner') frame = jsbridge.JSObject(self.bridge, "Components.utils.import('resource://mozmill/modules/frame.js')") sleep(sleeptime) starttime = datetime.utcnow().isoformat() if os.path.isdir(test): frame.runTestDirectory(test) else: frame.runTestFile(test) endtime = datetime.utcnow().isoformat() if report: appInfo = jsbridge.JSObject(self.bridge, appInfoJs) results = {'type':'mozmill-test', 'starttime':starttime, 'endtime':endtime, 'tests':self.alltests} results['appInfo.id'] = str(appInfo.ID) results['buildid'] = str(appInfo.appBuildID) results['appInfo.platformVersion'] = appInfo.platformVersion results['appInfo.platformBuildID'] = appInfo.platformBuildID sysname, nodename, release, version, machine = os.uname() sysinfo = {'os.name':sysname, 'hostname':nodename, 'os.version.number':release, 'os.version.string':version, 'arch':machine} if sys.platform == 'darwin': import platform sysinfo['mac_ver'] = platform.mac_ver() elif sys.platform == 'linux2': import platform sysinfo['linux_distrobution'] = platform.linux_distrobution() sysinfo['libc_ver'] = platform.libc_ver() results['sysinfo'] = sysinfo results['testPath'] = test import httplib2 http = httplib2.Http() response, content = http.request(report, 'POST', body=json.dumps(results)) # Give a second for any callbacks to finish. sleep(1)
def get_sysinfo(self): import platform (system, node, release, version, machine, processor) = platform.uname() sysinfo = { "os.name": system, "hostname": node, "os.version.number": version, "os.version.string": release, "arch": machine, } if system == "Darwin": sysinfo["os.name"] = "Mac OS X" sysinfo["os.version.number"] = platform.mac_ver()[0] sysinfo["os.version.string"] = platform.mac_ver()[0] elif (system == "linux2") or (system == "solaris"): sysinfo["linux_distrobution"] = platform.linux_distrobution() sysinfo["libc_ver"] = platform.libc_ver() return sysinfo