def run(ssh): ret, out, err = ssh('kqueue-tests') if ret != 0: return failure('kqueue-tests failed') return success()
def run(ssh): for i in range(0, 30): ret, out, err = ssh('uname -a') if ret == 0: return success() time.sleep(1) return fatal('Cannot reach VM via ssh')
def run(ssh): ret, out, err = ssh('launchctl list') if ret != 0: return failure('launchctl returned non-zero exit code') if 'com.apple.launchctl.System' not in out: return failure('com.apple.launchctl.System not found in "launchctl list" output') return success()
def run(ssh): p_ret = None def waiter(): ret, out, err = ssh('notifyutil -1 foo') p_ret = ret t = threading.Thread(target=waiter) t.start() time.sleep(3) ret, out, err = ssh('notifyutil -p foo') if ret != 0: return failure('notifyutil -p returned non-zero exit code') t.join() if p_ret != 0: return failure('notifyutil -1 returned non-zero exit code') return success()
import time import json from tests import success, failure def run(ssh): time.sleep(10) ret, out, err = ssh('launchctl dump com.apple.notifyd') if ret != 0: return failure('notifyd job isn\t even loaded') # Filter our 'launch_msg() debug lines' lines = out.split('\n') lines = filter(lambda l: 'launchd_msg_recv' not in l, lines) data = '\n'.join(lines) try: job = json.loads(data) except ValueError, e: return failure( '"launchctl dump" returned unreadable json: {0}'.format(data)) if job["Label"] != "com.apple.notifyd": return failure('notifyd job has wrong label') if "PID" not in job: return failure('notifyd is not running') return success()
import time import json from tests import success, failure def run(ssh): time.sleep(10) ret, out, err = ssh('launchctl dump com.apple.notifyd') if ret != 0: return failure('notifyd job isn\t even loaded') # Filter our 'launch_msg() debug lines' lines = out.split('\n') lines = filter(lambda l: 'launchd_msg_recv' not in l, lines) data = '\n'.join(lines) try: job = json.loads(data) except ValueError, e: return failure('"launchctl dump" returned unreadable json: {0}'.format(data)) if job["Label"] != "com.apple.notifyd": return failure('notifyd job has wrong label') if "PID" not in job: return failure('notifyd is not running') return success()