Convert all python code to use four-space indents instead of eight-space tabs.
Signed-off-by: John Admanski <jadmanski@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@1658 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/samples/autoserv_console.srv b/server/samples/autoserv_console.srv
index 50bb62a..b0c69e6 100755
--- a/server/samples/autoserv_console.srv
+++ b/server/samples/autoserv_console.srv
@@ -9,12 +9,12 @@
# -Steve Howard (showard@google.com)
if machines:
- host = hosts.SSHHost(machines[0])
+ host = hosts.SSHHost(machines[0])
try:
- import IPython
- ipshell = IPython.Shell.IPShellEmbed(argv=[])
- ipshell()
+ import IPython
+ ipshell = IPython.Shell.IPShellEmbed(argv=[])
+ ipshell()
except ImportError:
- import code
- code.interact("Autoserv console", raw_input, locals())
+ import code
+ code.interact("Autoserv console", raw_input, locals())
diff --git a/server/samples/continuous_reboot.srv b/server/samples/continuous_reboot.srv
index 900273b..adbfc43 100644
--- a/server/samples/continuous_reboot.srv
+++ b/server/samples/continuous_reboot.srv
@@ -1,6 +1,6 @@
def run(machine):
- host = hosts.SSHHost(machine)
- while True:
- host.reboot()
+ host = hosts.SSHHost(machine)
+ while True:
+ host.reboot()
job.parallel_simple(run, machines)
diff --git a/server/samples/failtest.srv b/server/samples/failtest.srv
index 975ab83..a793e59 100644
--- a/server/samples/failtest.srv
+++ b/server/samples/failtest.srv
@@ -1,6 +1,6 @@
def run(machine):
- host = hosts.SSHHost(machine)
- at = autotest.Autotest(host)
- at.run_test('failtest')
+ host = hosts.SSHHost(machine)
+ at = autotest.Autotest(host)
+ at.run_test('failtest')
job.parallel_simple(run, machines)
diff --git a/server/samples/info.srv b/server/samples/info.srv
index 0dd7f88..a5d2350 100644
--- a/server/samples/info.srv
+++ b/server/samples/info.srv
@@ -1,8 +1,8 @@
def run(machine):
- host = hosts.SSHHost(machine, initialize = False)
- print 'Uptime: ' + host.check_uptime()
- print 'Arch: ' + host.get_arch()
- print 'Kernel ver: ' + host.get_kernel_ver()
- print 'Kernel cmdline: ' + host.get_cmdline()
+ host = hosts.SSHHost(machine, initialize = False)
+ print 'Uptime: ' + host.check_uptime()
+ print 'Arch: ' + host.get_arch()
+ print 'Kernel ver: ' + host.get_kernel_ver()
+ print 'Kernel cmdline: ' + host.get_cmdline()
job.parallel_simple(run, machines)
diff --git a/server/samples/kernbench.srv b/server/samples/kernbench.srv
index 174e6e7..a8d84e3 100644
--- a/server/samples/kernbench.srv
+++ b/server/samples/kernbench.srv
@@ -1,6 +1,6 @@
def run(machine):
- host = hosts.SSHHost(machine)
- at = autotest.Autotest(host)
- at.run_test('kernbench', iterations=2, threads=5)
+ host = hosts.SSHHost(machine)
+ at = autotest.Autotest(host)
+ at.run_test('kernbench', iterations=2, threads=5)
job.parallel_simple(run, machines)
diff --git a/server/samples/netperf-guest-to-host-far.srv b/server/samples/netperf-guest-to-host-far.srv
index 57b67ae..10ac8c7 100644
--- a/server/samples/netperf-guest-to-host-far.srv
+++ b/server/samples/netperf-guest-to-host-far.srv
@@ -2,19 +2,19 @@
def check_kernel(host, version, package):
- if host.run("uname -r").stdout.strip() != version:
- print "XXXX installing kernel on %s" % (host.hostname,)
- package.install(host)
-
- host.reboot()
- host.wait_up()
+ if host.run("uname -r").stdout.strip() != version:
+ print "XXXX installing kernel on %s" % (host.hostname,)
+ package.install(host)
+
+ host.reboot()
+ host.wait_up()
def install_kvm(kvm_on_host_var_name, host, source, addresses):
- exec ("global %(var_name)s\n"
- "%(var_name)s= kvm.KVM(host)\n"
- "%(var_name)s.get(source)\n"
- "%(var_name)s.install(addresses)\n" % {"var_name": kvm_on_host_var_name})
+ exec ("global %(var_name)s\n"
+ "%(var_name)s= kvm.KVM(host)\n"
+ "%(var_name)s.get(source)\n"
+ "%(var_name)s.install(addresses)\n" % {"var_name": kvm_on_host_var_name})
print "XXXX creating SSHHost objects"
diff --git a/server/samples/parallel.srv b/server/samples/parallel.srv
index 2fdfc57..24dc1f0 100644
--- a/server/samples/parallel.srv
+++ b/server/samples/parallel.srv
@@ -1,7 +1,7 @@
at = autotest.Autotest()
def run(machine):
- host = hosts.SSHHost(machine)
- at.run_test('sleeptest', host = host)
+ host = hosts.SSHHost(machine)
+ at.run_test('sleeptest', host = host)
job.parallel_simple(run, machines)
diff --git a/server/samples/parallel_kvm.srv b/server/samples/parallel_kvm.srv
index 682c020..101b51d 100644
--- a/server/samples/parallel_kvm.srv
+++ b/server/samples/parallel_kvm.srv
@@ -21,9 +21,9 @@
num_guests= 5
g= []
for i in range(num_guests):
- g.append(hosts.KVMGuest(kvm_on_remote_host, qemu_options))
+ g.append(hosts.KVMGuest(kvm_on_remote_host, qemu_options))
for i in range(num_guests):
- g[i].wait_up()
+ g[i].wait_up()
print "XXXX running transfers"
@@ -35,10 +35,10 @@
args= range(1, num_guests)
def f(i):
- print "This is %s" % i
- tmp_dir= g[i].get_tmp_dir()
- g[i].run('scp "%s":"%s" "%s"' % (g[0].hostname, big_file, tmp_dir,))
- print g[i].run('sha1sum "%s"' % (os.path.join(tmp_dir, "big_file"),)).stdout.strip()
+ print "This is %s" % i
+ tmp_dir= g[i].get_tmp_dir()
+ g[i].run('scp "%s":"%s" "%s"' % (g[0].hostname, big_file, tmp_dir,))
+ print g[i].run('sha1sum "%s"' % (os.path.join(tmp_dir, "big_file"),)).stdout.strip()
job.parallel_simple(f, args)
diff --git a/server/samples/parallel_sleeptest.srv b/server/samples/parallel_sleeptest.srv
index 49bb0d1..c46353e 100644
--- a/server/samples/parallel_sleeptest.srv
+++ b/server/samples/parallel_sleeptest.srv
@@ -22,34 +22,34 @@
# Specify the path to the client control files and the tag names
# for the respective jobs here.
tests = [("client/tests/sleeptest/control", "sleeptag0"),
- ("client/tests/sleeptest/control", "sleeptag1"),
- ]
+ ("client/tests/sleeptest/control", "sleeptag1"),
+ ]
def run_client(at, machine_name, machine_num, instance):
- control = open(os.path.join(job.autodir,tests[instance][0])).read()
- '''
- The get_sync_control_file method basically does the setup of the barriers
- required to start these multiple tests at the same time and returns the
- modified control file (that contains the barrier code added to it)
- Check client/common_lib/utils.py for detailed documentation of how this
- method sets up the barriers.
- '''
- control_new = utils.get_sync_control_file(control, machine_name,
- machine_num, instance, len(tests))
- '''
- This control file is now simply passed in to the run method along with
- a tag name of the test and a 'parallel_flag' that identifies this scenario
- of running multiple tests on the same machine at the same time.
- '''
- at.run(control_new, tag='%s' % tests[instance][1], parallel_flag=True)
+ control = open(os.path.join(job.autodir,tests[instance][0])).read()
+ '''
+ The get_sync_control_file method basically does the setup of the barriers
+ required to start these multiple tests at the same time and returns the
+ modified control file (that contains the barrier code added to it)
+ Check client/common_lib/utils.py for detailed documentation of how this
+ method sets up the barriers.
+ '''
+ control_new = utils.get_sync_control_file(control, machine_name,
+ machine_num, instance, len(tests))
+ '''
+ This control file is now simply passed in to the run method along with
+ a tag name of the test and a 'parallel_flag' that identifies this scenario
+ of running multiple tests on the same machine at the same time.
+ '''
+ at.run(control_new, tag='%s' % tests[instance][1], parallel_flag=True)
def main(machine_name, machine_num):
- host = hosts.SSHHost(machine_name)
- at = autotest.Autotest(host)
- at.install()
+ host = hosts.SSHHost(machine_name)
+ at = autotest.Autotest(host)
+ at.install()
- parallel([subcommand(run_client, [at, machine_name, machine_num, i])
- for i in range(len(tests))])
+ parallel([subcommand(run_client, [at, machine_name, machine_num, i])
+ for i in range(len(tests))])
parallel([subcommand(main, [machines[i], i], machines[i])
- for i in range(len(machines))])
+ for i in range(len(machines))])
diff --git a/server/samples/profilertest.srv b/server/samples/profilertest.srv
index 2743b76..42f32f2 100644
--- a/server/samples/profilertest.srv
+++ b/server/samples/profilertest.srv
@@ -5,63 +5,63 @@
def add_profilers(at, profilers, timeout_sync, timeout_start, timeout_stop,
- machines, name):
- control_file = []
- for profiler in profilers:
- control_file.append("job.profilers.add(%s)"
- % str(profiler)[1:-1])
+ machines, name):
+ control_file = []
+ for profiler in profilers:
+ control_file.append("job.profilers.add(%s)"
+ % str(profiler)[1:-1])
- control_file.append("job.run_test('barriertest',%d,%d,%d,'%s','%s',%s)"
- % (timeout_sync, timeout_start, timeout_stop,
- at.host.hostname, "PROF_MASTER", str(machines)))
+ control_file.append("job.run_test('barriertest',%d,%d,%d,'%s','%s',%s)"
+ % (timeout_sync, timeout_start, timeout_stop,
+ at.host.hostname, "PROF_MASTER", str(machines)))
- for profiler in profilers:
- control_file.append("job.profilers.delete('%s')" % profiler[0])
+ for profiler in profilers:
+ control_file.append("job.profilers.delete('%s')" % profiler[0])
- params = ["\n".join(control_file), "profile-" + profiler[0], at.host]
- return subcommand(at.run, params, name)
+ params = ["\n".join(control_file), "profile-" + profiler[0], at.host]
+ return subcommand(at.run, params, name)
def wait_for_profilers(machines, timeout = 180):
- # wait until the profilers have started
- sync_bar = barrier("PROF_MASTER", "sync_profilers",
- timeout, port=63100)
- sync_bar.rendevous_servers("PROF_MASTER", *machines)
+ # wait until the profilers have started
+ sync_bar = barrier("PROF_MASTER", "sync_profilers",
+ timeout, port=63100)
+ sync_bar.rendevous_servers("PROF_MASTER", *machines)
def start_profilers(machines, timeout = 180):
- # wait until the profilers have started
- start_bar = barrier("PROF_MASTER", "start_profilers",
- timeout, port=63100)
- start_bar.rendevous_servers("PROF_MASTER", *machines)
+ # wait until the profilers have started
+ start_bar = barrier("PROF_MASTER", "start_profilers",
+ timeout, port=63100)
+ start_bar.rendevous_servers("PROF_MASTER", *machines)
def stop_profilers(machines, timeout = 120):
- stop_bar = barrier("PROF_MASTER", "stop_profilers", timeout, port=63100)
- stop_bar.rendevous_servers("PROF_MASTER", *machines)
+ stop_bar = barrier("PROF_MASTER", "stop_profilers", timeout, port=63100)
+ stop_bar.rendevous_servers("PROF_MASTER", *machines)
def server_sleep_test(seconds):
- wait_for_profilers(machines)
- start_profilers(machines)
- for i in range(seconds):
- print "%d of %d" % (i, seconds)
- time.sleep(1)
- stop_profilers(machines)
+ wait_for_profilers(machines)
+ start_profilers(machines)
+ for i in range(seconds):
+ print "%d of %d" % (i, seconds)
+ time.sleep(1)
+ stop_profilers(machines)
def main():
- timeout_sync = 180
- timeout_start = 60
- timeout_stop = 60
- profilers = [["vmstat"], ["iostat"]]
+ timeout_sync = 180
+ timeout_start = 60
+ timeout_stop = 60
+ profilers = [["vmstat"], ["iostat"]]
- tests = [subcommand(server_sleep_test, [20], "server_sleep_test")]
- for at in at_hosts:
- name = "profiled-%s" % at.host.hostname
- tests.append(add_profilers(at, profilers, timeout_sync,
- timeout_start, timeout_stop, machines, name))
- parallel(tests)
+ tests = [subcommand(server_sleep_test, [20], "server_sleep_test")]
+ for at in at_hosts:
+ name = "profiled-%s" % at.host.hostname
+ tests.append(add_profilers(at, profilers, timeout_sync,
+ timeout_start, timeout_stop, machines, name))
+ parallel(tests)
main()
diff --git a/server/samples/reboot.srv b/server/samples/reboot.srv
index 670bf5c..5837570 100644
--- a/server/samples/reboot.srv
+++ b/server/samples/reboot.srv
@@ -1,6 +1,6 @@
def run(machine):
- host = hosts.SSHHost(machine)
- print host.is_up()
- host.reboot()
+ host = hosts.SSHHost(machine)
+ print host.is_up()
+ host.reboot()
job.parallel_simple(run, machines)
diff --git a/server/samples/run_test.srv b/server/samples/run_test.srv
index 1220445..e8b1f36 100644
--- a/server/samples/run_test.srv
+++ b/server/samples/run_test.srv
@@ -5,38 +5,38 @@
def usage():
- print "usage: -t <test name> -m <machines> -l <log dir>"
+ print "usage: -t <test name> -m <machines> -l <log dir>"
def run(client):
- m = hosts.SSHHost(client)
- at = autotest.Autotest()
+ m = hosts.SSHHost(client)
+ at = autotest.Autotest()
- results_dir = os.path.join(logdir, client)
- at.run_test(test, results_dir, m)
+ results_dir = os.path.join(logdir, client)
+ at.run_test(test, results_dir, m)
def main():
- global test, logdir, args
+ global test, logdir, args
- try:
- opts, args = getopt.getopt(args, 't:l:', [])
- except getopt.GetoptError, e:
- usage()
- print e
- sys.exit(1)
+ try:
+ opts, args = getopt.getopt(args, 't:l:', [])
+ except getopt.GetoptError, e:
+ usage()
+ print e
+ sys.exit(1)
- for flag, value in opts:
- if flag == '-t':
- test = value
- elif flag == '-l':
- logdir = value
-
- if test == None or logdir == None:
- usage()
- sys.exit(1)
+ for flag, value in opts:
+ if flag == '-t':
+ test = value
+ elif flag == '-l':
+ logdir = value
- print "Going to launch %s on %r with log dir of %s." % (test, machines, logdir)
- parallel_simple(run, machines)
+ if test == None or logdir == None:
+ usage()
+ sys.exit(1)
+
+ print "Going to launch %s on %r with log dir of %s." % (test, machines, logdir)
+ parallel_simple(run, machines)
main()
diff --git a/server/samples/sleeptest.srv b/server/samples/sleeptest.srv
index 805ac097..85cbf08 100644
--- a/server/samples/sleeptest.srv
+++ b/server/samples/sleeptest.srv
@@ -1,6 +1,6 @@
def run(machine):
- host = hosts.SSHHost(machine)
- at = autotest.Autotest(host)
- at.run_test('sleeptest')
+ host = hosts.SSHHost(machine)
+ at = autotest.Autotest(host)
+ at.run_test('sleeptest')
job.parallel_simple(run, machines)
diff --git a/server/samples/uname.srv b/server/samples/uname.srv
index b141d5c..f67d626 100644
--- a/server/samples/uname.srv
+++ b/server/samples/uname.srv
@@ -1,5 +1,5 @@
hosts = [hosts.SSHHost(h, initialize=False) for h in machines]
for host in hosts:
- print host.hostname
- print host.run('uname -a').stdout.rstrip()
+ print host.hostname
+ print host.run('uname -a').stdout.rstrip()