def run_once(self): ext_path = os.path.join(os.path.dirname(__file__), 'extension') ck = os.path.join(os.path.dirname(__file__), 'chromium-browser-killer') utils.run_parallel([ 'DISPLAY=:0 chromium-browser --user-data-dir=/home/bradf --load-extension=%s' % ext_path, ck ])
def run_scale_test(): """ Try to start and stop domain many times. """ prepare_hook_file(hook_script) loop_num = int(params.get("loop_num", 30)) loop_timeout = int(params.get("loop_timeout", 600)) cmd1 = ("for i in {1..%s};do echo $i 'start guest -';" "virsh start %s;sleep 1;echo $i 'stop guest -';" "virsh destroy %s;sleep 1;done;" % (loop_num, vm_name, vm_name)) cmd2 = ("for i in {1..%s};do virsh list;sleep 1;done;" % loop_num * 2) utils.run_parallel([cmd1, cmd2], timeout=loop_timeout)
def client(self, server_ip, test, test_time, num_streams, test_specific_args, cpu_affinity): args = '-H %s -t %s -l %d' % (server_ip, test, test_time) if self.wait_time: args += ' -s %d ' % self.wait_time # Append the test specific arguments. if test_specific_args: args += ' ' + test_specific_args cmd = '%s %s' % (self.client_prog, args) if cpu_affinity: cmd = 'taskset %s %s' % (cpu_affinity, cmd) try: cmds = [] # Get 5 mpstat samples. Since tests with large number of streams # take a long time to start up all the streams, we'll toss out the # first and last sample when recording results interval = max(1, test_time / 5) cmds.append('sleep %d && mpstat -P ALL %s 5' % (self.wait_time, interval)) # Add the netperf commands for i in xrange(num_streams): cmds.append(cmd) if self.bidi and test == 'TCP_STREAM': cmds.append(cmd.replace('TCP_STREAM', 'TCP_MAERTS')) t0 = time.time() # Launch all commands in parallel out = utils.run_parallel(cmds, timeout=test_time + 500, ignore_status=True) t1 = time.time() self.results.append(out) self.actual_times.append(t1 - t0 - self.wait_time) # Log test output logging.info(out) except error.CmdError, e: """ Catch errors due to timeout, but raise others The actual error string is: "Command did not complete within %d seconds" called in function join_bg_job in the file shared/utils.py Looking for 'within' is probably not the best way to do this but works for now""" if ('within' in e.additional_text or 'non-zero' in e.additional_text): logging.debug(e.additional_text) self.results.append(None) self.actual_times.append(1) else: raise
def client(self, server_ip, test_time, num_streams): args = '-t %d -P %d ' % (test_time, num_streams) if self.udp: args += '-u ' if self.bidirectional: args += '-d ' try: cmds = [] # Get 5 mpstat samples. Since tests with large number of streams # take a long time to start up all the streams, we'll toss out the # first and last sample when recording results interval = max(1, test_time / 5) cmds.append('mpstat -P ALL %s 5' % interval) # Add the iperf command cmd = self.client_path % (server_ip, args) cmds.append(cmd) t0 = time.time() out = utils.run_parallel(cmds, timeout=test_time + 60) t1 = time.time() self.results.append(out) self.actual_times.append(t1 - t0) except error.CmdError, e: """ Catch errors due to timeout, but raise others The actual error string is: "Command did not complete within %d seconds" called in function join_bg_job in the file shared/utils.py Looking for 'within' is probably not the best way to do this but works for now""" if 'within' in e.additional_text: self.results.append(None) self.actual_times.append(1) else: raise
def client(self, server_ip, test_time, num_streams): args = '-t %d -P %d ' % (test_time, num_streams) if self.udp: args += '-u ' if self.bidirectional: args += '-d ' try: cmds = [] # Get 5 mpstat samples. Since tests with large number of streams # take a long time to start up all the streams, we'll toss out the # first and last sample when recording results interval = max(1, test_time / 5) cmds.append('mpstat -P ALL %s 5' % interval) # Add the iperf command cmd = self.client_path % (server_ip, args) cmds.append(cmd) t0 = time.time() out = utils.run_parallel(cmds, timeout = test_time + 60) t1 = time.time() self.results.append(out) self.actual_times.append(t1 - t0) except error.CmdError, e: """ Catch errors due to timeout, but raise others The actual error string is: "Command did not complete within %d seconds" called in function join_bg_job in the file shared/utils.py Looking for 'within' is probably not the best way to do this but works for now""" if 'within' in e.additional_text: self.results.append(None) self.actual_times.append(1) else: raise