diff options
author | Arthur She <arthur.she@linaro.org> | 2015-02-09 12:11:41 +0800 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2015-02-26 09:20:20 +0000 |
commit | 450cb6ed9d9d6d615f9a828e73e66658cddb1b5a (patch) | |
tree | 0d02fb7faf04cc8bc7f3f2f74b9274487848763d /ubuntu | |
parent | 502e9259edabcedcdce5d29448c77ed0bfaac54f (diff) |
fix PEP8 issues in python scripts
Change-Id: I4635323eb8fb2ed852ca5e4ab3cbedf866e1269a
Diffstat (limited to 'ubuntu')
-rw-r--r-- | ubuntu/scripts/bootcharttest.py | 3 | ||||
-rwxr-xr-x | ubuntu/scripts/fio-test.py | 10 | ||||
-rwxr-xr-x | ubuntu/scripts/phoronix.py | 10 | ||||
-rwxr-xr-x | ubuntu/scripts/rcutorture.py | 6 | ||||
-rwxr-xr-x | ubuntu/scripts/sata-partition-rw.py | 11 |
5 files changed, 32 insertions, 8 deletions
diff --git a/ubuntu/scripts/bootcharttest.py b/ubuntu/scripts/bootcharttest.py index 31e5527..f5b3d2a 100644 --- a/ubuntu/scripts/bootcharttest.py +++ b/ubuntu/scripts/bootcharttest.py @@ -10,11 +10,10 @@ if __name__ == '__main__': options, args = parser.parse_args(argv) writer = main._mk_writer(options) res = parsing.parse(writer, args, options.prune, options.crop_after, options.annotate) - duration = float(res[3].duration)/100 + duration = float(res[3].duration) / 100 print res[0]['title'] print "uname:", res[0]['system.uname'] print "release:", res[0]['system.release'] print "CPU:", res[0]['system.cpu'] print "kernel options:", res[0]['system.kernel.options'] print "time:", duration - diff --git a/ubuntu/scripts/fio-test.py b/ubuntu/scripts/fio-test.py index c64797e..d8df998 100755 --- a/ubuntu/scripts/fio-test.py +++ b/ubuntu/scripts/fio-test.py @@ -34,6 +34,7 @@ print os.getcwd() commands.getstatusoutput("sudo fdisk -l > partition_layout.txt 2>&1") device_name = sys.argv[1] + def fio_device_existence(): testcase_name = "fio_target_device_existence" if sys.argv[1] == "": @@ -54,6 +55,7 @@ def fio_device_existence(): print testcase_name + ": FAIL" + " 0" + " Inapplicable" + " - Could not locate " + sys.argv[1] + " on target board" sys.exit(1) + def fio_existence(): testcase_name = "fio_binary_existence" run_command = "which fio" @@ -67,6 +69,7 @@ def fio_existence(): print "The FIO binary location is: " + fio_binary_location[1] print testcase_name + ": PASS" + " 0" + " Inapplicable" + def fio_read(): testcase_name = "fio_bs4kread_iops" run_command = "sudo fio -filename=" + device_name + " -rw=read -direct=1 -iodepth 1 -thread -ioengine=psync -bs=4k -numjobs=1 -runtime=10 -group_reporting -name=fio_read > fio_read.txt 2>&1" @@ -97,6 +100,7 @@ def fio_read(): logfile.close() print testcase_name + ": PASS" + " " + iops_result + " " + "IOPS" + def fio_randread(): testcase_name = "fio_randread_iops" run_command = "sudo fio -filename=" + device_name + " -rw=randread -direct=1 -iodepth 1 -thread -ioengine=psync -bs=4k -numjobs=1 -runtime=10 -group_reporting -name=fio_randread > fio_randread.txt 2>&1" @@ -127,6 +131,7 @@ def fio_randread(): logfile.close() print testcase_name + ": PASS" + " " + iops_result + " " + "IOPS" + def fio_write(): testcase_name = "fio_write_iops" run_command = "sudo fio -filename=" + device_name + " -rw=write -direct=1 -iodepth 1 -thread -ioengine=psync -bs=4k -numjobs=1 -runtime=10 -group_reporting -name=fio_write > fio_write.txt 2>&1" @@ -157,6 +162,7 @@ def fio_write(): logfile.close() print testcase_name + ": PASS" + " " + iops_result + " " + "IOPS" + def fio_randwrite(): testcase_name = "fio_randwrite_iops" run_command = "sudo fio -filename=" + device_name + " -rw=randwrite -direct=1 -iodepth 1 -thread -ioengine=psync -bs=4k -numjobs=1 -runtime=10 -group_reporting -name=fio_randwrite > fio_randwrite.txt 2>&1" @@ -187,6 +193,7 @@ def fio_randwrite(): logfile.close() print testcase_name + ": PASS" + " " + iops_result + " " + "IOPS" + def fio_512k_write(): testcase_name = "fio_512k_write_bandwidth" run_command = "sudo fio -filename=" + device_name + " -rw=write -direct=1 -iodepth 1 -thread -ioengine=psync -bs=512k -numjobs=1 -runtime=10 -group_reporting -name=fio_512k_write > fio_512k_write.txt 2>&1" @@ -218,6 +225,7 @@ def fio_512k_write(): logfile.close() print testcase_name + ": PASS" + " " + bandwidth_number + " " + "KB/s" + def fio_512k_read(): testcase_name = "fio_512k_read_bandwidth" run_command = "sudo fio -filename=" + device_name + " -rw=read -direct=1 -iodepth 1 -thread -ioengine=psync -bs=512k -numjobs=1 -runtime=10 -group_reporting -name=fio_512k_read > fio_512k_read.txt 2>&1" @@ -257,4 +265,4 @@ fio_randread() fio_write() fio_randwrite() fio_512k_write() -fio_512k_read()
\ No newline at end of file +fio_512k_read() diff --git a/ubuntu/scripts/phoronix.py b/ubuntu/scripts/phoronix.py index a2fa34c..3b7c174 100755 --- a/ubuntu/scripts/phoronix.py +++ b/ubuntu/scripts/phoronix.py @@ -32,18 +32,22 @@ print os.getcwd() # Result collection for LAVA debug_switcher = False + + def collect_result(testcase, result): - if debug_switcher == False: + if debug_switcher is False: call(['lava-test-case', testcase, '--result', result]) else: print ['lava-test-case', testcase, '--result', result] + def collect_score_with_measurement(testcase, result, score, unit): - if debug_switcher == False: + if debug_switcher is False: call(['lava-test-case', testcase, '--result', result, '--measurement', str(score), '--units', unit]) else: print ['lava-test-case', testcase, '--result', result, '--measurement', str(score), '--units', unit] + # Installation check def phoronix_install_check(): testcase = 'phoronix-install' @@ -96,7 +100,7 @@ call(['cat', home_path + '/.phoronix-test-suite/user-config.xml']) # Get all Ethernet interface name # As the input is trusted, then call the function in this way -eth_interface_list = check_output("ifconfig -a | grep eth | awk '{print $1}'", shell=True).split('\n') +eth_interface_list = check_output("ifconfig -a | grep eth | awk '{print $1}'", shell=True).split('\n') eth_interface_list = filter(None, eth_interface_list) print eth_interface_list diff --git a/ubuntu/scripts/rcutorture.py b/ubuntu/scripts/rcutorture.py index 9e16c3b..6b7d6ac 100755 --- a/ubuntu/scripts/rcutorture.py +++ b/ubuntu/scripts/rcutorture.py @@ -28,8 +28,10 @@ import subprocess # Result collection for LAVA debug_switcher = False + + def collect_result(testcase, result): - if debug_switcher == False: + if debug_switcher is False: subprocess.call(['lava-test-case', testcase, '--result', result]) else: print ['lava-test-case', testcase, '--result', result] @@ -57,7 +59,7 @@ else: lsmod_output = subprocess.check_output(['lsmod']) print lsmod_output lsmod_list = lsmod_output.split() -torture_list = filter(lambda x:x.find('torture')!=-1, lsmod_list) +torture_list = filter(lambda x: x.find('torture') != -1, lsmod_list) if torture_list == []: print 'Cannot find rcutorture module in lsmod, abort!' collect_result('rcutorture-module-check', 'fail') diff --git a/ubuntu/scripts/sata-partition-rw.py b/ubuntu/scripts/sata-partition-rw.py index c772538..64ae6b7 100755 --- a/ubuntu/scripts/sata-partition-rw.py +++ b/ubuntu/scripts/sata-partition-rw.py @@ -36,6 +36,7 @@ print os.getcwd() test_case_list = ["sata_device_existence", "sata_mklabel_msdos", "sata_mklabel_gpt", "sata_first_ext2_partition", "sata_second_ext2_partition", "sata_ext3_format", "sata_ext4_format", "sata_ext4_mount", "sata_ext4_umount", "sata_ext4_file_fill", "sata_ext4_file_edit", "sata_ext4_dd_write", "sata_ext4_dd_read"] print "There are " + str(len(test_case_list)) + " test cases in this test suite." + # All skipped - If test case sata_device_existence failed, then skip all the rest. def all_skipped(): for element in test_case_list[1:]: @@ -45,6 +46,7 @@ def all_skipped(): commands.getstatusoutput("fdisk -l > partition_layout.txt 2>&1") device_name = sys.argv[1] + def sata_device_existence(): testcase_name = "sata_device_existence" if device_name == "": @@ -67,6 +69,7 @@ def sata_device_existence(): all_skipped() sys.exit(1) + def sata_mklabel_msdos(): testcase_name = "sata_mklabel_msdos" label_name = "msdos" @@ -92,6 +95,7 @@ def sata_mklabel_msdos(): else: print testcase_name + ": FAIL" + " 0" + " Inapplicable" + " - Could not find partition table " + label_name + " on " + device_name + def sata_mklabel_gpt(): testcase_name = "sata_mklabel_gpt" label_name = "gpt" @@ -117,6 +121,7 @@ def sata_mklabel_gpt(): else: print testcase_name + ": FAIL" + " 0" + " Inapplicable" + " - Could not find partition table " + label_name + " on " + device_name + def sata_first_ext2_partition(): testcase_name = "sata_first_ext2_partition" label_name = "msdos" @@ -149,6 +154,7 @@ def sata_first_ext2_partition(): else: print testcase_name + ": FAIL" + " 0" + " Inapplicable" + " - Could not find partition " + partition_name_first + " on " + device_name + def sata_second_ext2_partition(): testcase_name = "sata_second_ext2_partition" second_partition_creation = "parted -s " + device_name + " mkpart primary ext2 11% 20%" @@ -174,6 +180,7 @@ def sata_second_ext2_partition(): else: print testcase_name + ": FAIL" + " 0" + " Inapplicable" + " - Could not find partition " + partition_name_second + " on " + device_name + def sata_ext3_format(): testcase_name = "sata_ext3_format" target_partition_name = device_name + "1" @@ -199,6 +206,7 @@ def sata_ext3_format(): else: print testcase_name + ": FAIL" + " 0" + " Inapplicable" + " - Could not find ext3 partition on " + device_name + def sata_ext4_format(): testcase_name = "sata_ext4_format" target_partition_name = device_name + "2" @@ -224,6 +232,7 @@ def sata_ext4_format(): else: print testcase_name + ": FAIL" + " 0" + " Inapplicable" + " - Could not find ext4 partition on " + device_name + def sata_ext4_mount_umount(): testcase_mount = "sata_ext4_mount" testcase_umount = "sata_ext4_umount" @@ -276,6 +285,7 @@ def sata_ext4_mount_umount(): else: print testcase_umount + ": PASS" + " 0" + " Inapplicable" + def sata_ext4_file_fill_edit(): testcase_filefill = "sata_ext4_file_fill" testcase_fileedit = "sata_ext4_file_edit" @@ -335,6 +345,7 @@ def sata_ext4_file_fill_edit(): time.sleep(5) print "mount point cleaned!" + def sata_ext4_dd_write_read(): testcase_dd_write = "sata_ext4_dd_write" testcase_dd_read = "sata_ext4_dd_read" |