| OLD | NEW |
| 1 import os, time, re, logging | 1 import os, time, re, logging |
| 2 from autotest_lib.client.bin import test, utils | 2 from autotest_lib.client.bin import test, utils |
| 3 from autotest_lib.client.bin.net import net_utils | 3 from autotest_lib.client.bin.net import net_utils |
| 4 from autotest_lib.client.common_lib import error | 4 from autotest_lib.client.common_lib import error |
| 5 | 5 |
| 6 MPSTAT_IX = 0 | 6 MPSTAT_IX = 0 |
| 7 NETPERF_IX = 1 | 7 NETPERF_IX = 1 |
| 8 | 8 |
| 9 class netperf2(test.test): | 9 class netperf2(test.test): |
| 10 version = 3 | 10 version = 4 |
| 11 | 11 |
| 12 # ftp://ftp.netperf.org/netperf/netperf-2.4.4.tar.gz | 12 # ftp://ftp.netperf.org/netperf/netperf-2.4.4.tar.gz |
| 13 def setup(self, tarball = 'netperf-2.4.4.tar.gz'): | 13 def setup(self, tarball = 'netperf-2.4.4.tar.gz'): |
| 14 self.job.require_gcc() | 14 self.job.require_gcc() |
| 15 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) | 15 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) |
| 16 utils.extract_tarball_to_dir(tarball, self.srcdir) | 16 utils.extract_tarball_to_dir(tarball, self.srcdir) |
| 17 os.chdir(self.srcdir) | 17 os.chdir(self.srcdir) |
| 18 | 18 |
| 19 utils.system('patch -p0 < ../wait_before_data.patch') | 19 utils.system('patch -p0 < ../wait_before_data.patch') |
| 20 # Fixing up a compile issue under newer systems that have | 20 # Fixing up a compile issue under newer systems that have |
| 21 # CPU_SET_S defined on /usr/include/sched.h, backported from | 21 # CPU_SET_S defined on /usr/include/sched.h, backported from |
| 22 # upstream svn trunk | 22 # upstream svn trunk |
| 23 utils.system('patch -p0 < ../fix_netperf_build.patch') | 23 utils.system('patch -p0 < ../fix_netperf_build.patch') |
| 24 utils.system('./configure') | 24 utils.system('./configure') |
| 25 utils.system('make') | 25 utils.system('make') |
| 26 utils.system('sync') | 26 utils.system('sync') |
| 27 | 27 |
| 28 self.job.setup_dep(['sysstat']) |
| 29 |
| 28 | 30 |
| 29 def initialize(self): | 31 def initialize(self): |
| 30 self.server_prog = '%s&' % os.path.join(self.srcdir, 'src/netserver') | 32 self.server_prog = '%s&' % os.path.join(self.srcdir, 'src/netserver') |
| 31 self.client_prog = '%s' % os.path.join(self.srcdir, 'src/netperf') | 33 self.client_prog = '%s' % os.path.join(self.srcdir, 'src/netperf') |
| 32 self.valid_tests = ['TCP_STREAM', 'TCP_MAERTS', 'TCP_RR', 'TCP_CRR', | 34 self.valid_tests = ['TCP_STREAM', 'TCP_MAERTS', 'TCP_RR', 'TCP_CRR', |
| 33 'TCP_SENDFILE', 'UDP_STREAM', 'UDP_RR'] | 35 'TCP_SENDFILE', 'UDP_STREAM', 'UDP_RR'] |
| 34 self.results = [] | 36 self.results = [] |
| 35 self.actual_times = [] | 37 self.actual_times = [] |
| 36 self.netif = '' | 38 self.netif = '' |
| 37 self.network = net_utils.network() | 39 self.network = net_utils.network() |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 self.results.append(utils.system_output(cmd, retain_output=True)) | 140 self.results.append(utils.system_output(cmd, retain_output=True)) |
| 139 | 141 |
| 140 | 142 |
| 141 def server_stop(self): | 143 def server_stop(self): |
| 142 utils.system('killall netserver', ignore_status=True) | 144 utils.system('killall netserver', ignore_status=True) |
| 143 | 145 |
| 144 | 146 |
| 145 def client(self, server_ip, test, test_time, num_streams, | 147 def client(self, server_ip, test, test_time, num_streams, |
| 146 test_specific_args, cpu_affinity): | 148 test_specific_args, cpu_affinity): |
| 147 args = '-H %s -t %s -l %d' % (server_ip, test, test_time) | 149 args = '-H %s -t %s -l %d' % (server_ip, test, test_time) |
| 150 |
| 151 mpstat = os.path.join(self.autodir + 'deps/sysstat/mpstat') |
| 152 |
| 148 if self.wait_time: | 153 if self.wait_time: |
| 149 args += ' -s %d ' % self.wait_time | 154 args += ' -s %d ' % self.wait_time |
| 150 | 155 |
| 151 # Append the test specific arguments. | 156 # Append the test specific arguments. |
| 152 if test_specific_args: | 157 if test_specific_args: |
| 153 args += ' ' + test_specific_args | 158 args += ' ' + test_specific_args |
| 154 | 159 |
| 155 cmd = '%s %s' % (self.client_prog, args) | 160 cmd = '%s %s' % (self.client_prog, args) |
| 156 | 161 |
| 157 if cpu_affinity: | 162 if cpu_affinity: |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 end_time = curr_time + timeout | 338 end_time = curr_time + timeout |
| 334 while curr_time < end_time: | 339 while curr_time < end_time: |
| 335 if not os.system('ping -c 1 ' + ip): | 340 if not os.system('ping -c 1 ' + ip): |
| 336 # Ping succeeded | 341 # Ping succeeded |
| 337 return | 342 return |
| 338 # Ping failed. Lets sleep a bit and try again. | 343 # Ping failed. Lets sleep a bit and try again. |
| 339 time.sleep(5) | 344 time.sleep(5) |
| 340 curr_time = time.time() | 345 curr_time = time.time() |
| 341 | 346 |
| 342 return | 347 return |
| OLD | NEW |