def __init__(self, address, authkey, timeout, optimist=True, sock=None, profile=None, home=None): self._connection = None self.address = address self.authkey = authkey self.timeout = timeout or None self.optimist = optimist self.profile = profile self.home = home if sock: self._connection = BlockingConnection(self.address, sock) try: import vcsjob self.job_guid = vcsjob.get_guid() except: # guid not set or vcsjob not even installed. how to log then? self.job_guid = None # don't import ave.panotti every time it is used. can't import it at # the module scope because ave.panotti also imports ave.network.control # which leads to an import error. assign the module to self instead. import ave.panotti as panotti setattr(self, 'panotti', panotti)
def t2(): pretty = '%s t2' % __file__ print(pretty) # unicode version vcsjob.set_guid(u'super_valid_"åäö_@%&#"') try: val = vcsjob.get_guid() except Exception, e: print('FAIL %s: could not get unicode guid: %s' % (pretty, e)) return False
def run_smoke_off_site(report=True): passed = [] failed = [] errors = [] target = 0 logger_broker = Broker() logger_ws = logger_broker.get({'type': 'workspace'}) try: guid = vcsjob.get_guid() except Exception as e: guid = 'local_guid' logger = Logger(logger_ws, guid) b, w, h = allocate_by_profiles() logger.log_it( 'd', 'allocated: %s' % json.dumps([h.profile, w.profile], indent=3)) label = h.get_build_label() t, p, f, e = run_module(tests.popup, (w, h), True, report, logger) target += t passed.extend(p) failed.extend(f) errors.extend(e) t, p, f, e = run_module(tests.adb, (w, h), True, report, logger) target += t passed.extend(p) failed.extend(f) errors.extend(e) t, p, f, e = run_module(tests.android, (w, h, label), True, report, logger) target += t passed.extend(p) failed.extend(f) errors.extend(e) t, p, f, e = run_module(tests.gtest, (w, h), True, report, logger) target += t passed.extend(p) failed.extend(f) errors.extend(e) if len(passed) != target: return vcsjob.FAILURES return vcsjob.OK
def t5(w): pretty = '%s t5' % __file__ print(pretty) # cook a job, preserving sys.path for UNIT/ACCEPTANCE differences job = {'path': 'job', 'tags': ['TAG']} exe = '#! /usr/bin/python2\n' make_job(w, [job], exe) vcsjob.set_guid('previous_value') log_path = w.make_tempfile() # store output from the job somewhere vcsjob.execute_job(w.path, job, log_path=log_path, guid='abc_123') try: value = vcsjob.get_guid() except Exception, e: print('FAIL %s: %s' % (pretty, e)) return False
def t4(w): pretty = '%s t4' % __file__ print(pretty) # cook a job, preserving sys.path for UNIT/ACCEPTANCE differences job = {'path': 'job', 'tags': ['TAG']} exe = '#! /usr/bin/python2\n' make_job(w, [job], exe) vcsjob.set_guid(None) # reset $VCSJOB_GUID log_path = w.make_tempfile() # store output from the job somewhere vcsjob.execute_job(w.path, job, log_path=log_path, guid='abc_123') try: value = vcsjob.get_guid() print('FAIL %s: VCSJOB_GUID remains set: %s' % (pretty, value)) return False except: pass return True
# unicode version vcsjob.set_guid(u'super_valid_"åäö_@%&#"') try: val = vcsjob.get_guid() except Exception, e: print('FAIL %s: could not get unicode guid: %s' % (pretty, e)) return False if val != u'super_valid_"åäö_@%&#"': print('FAIL %s: guid did not survive environment: %s' % (pretty, val)) return False # ascii version vcsjob.set_guid('super_valid_"åäö_@%&#"') try: val = vcsjob.get_guid() except Exception, e: print('FAIL %s: could not get unicode guid: %s' % (pretty, e)) return False if val != u'super_valid_"åäö_@%&#"': print('FAIL %s: guid did not mangle into unicode: %s' % (pretty, val)) return False # reset vcsjob.set_guid(None) try: val = vcsjob.get_guid() print('FAIL %s: getting reset guid did not raise exception' % pretty) return False except Exception, e: if 'guid not set' not in str(e):