From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3] *.py : convert python2 to python3
Date: Wed, 25 Apr 2018 18:22:53 +0800 [thread overview]
Message-ID: <5AE056FD.4000208@cn.fujitsu.com> (raw)
In-Reply-To: <20180424090521.ypic57umpsdfpilg@dell5510>
On 2018/04/24 17:05, Petr Vorel wrote:
> Hi Yosun,
>
>> From: yosun<yosun@suse.com>
>> 1. Convert python code to use python3
>> 2. Make shebang same as standard python shebang
>> 3. Correct format to solve compiling error in python3
>> Signed-off-by: Yong Sun<yosun@suse.com>
>> ---
> Accepted with removing double brackets (see diff bellow; I guess you run 2to3 twice, in
> that case it would be printed as list).
>
> Thanks for your contribution!
Hi Petr,
It seems that many distros still use python2 interpreter instead of python3 by default.
Do you want to install python3 package forcely before testing python code in ltp?
Is it necessary to make sure all python3 code are compatible with python2 interpreter?
Thanks,
Xiao Yang
>
> Kind regards,
> Petr
>
> diff --git a/testcases/kernel/power_management/pm_cpu_consolidation.py b/testcases/kernel/power_management/pm_cpu_consolidation.py
> index fbe262aad..ecd2e4fac 100755
> --- a/testcases/kernel/power_management/pm_cpu_consolidation.py
> +++ b/testcases/kernel/power_management/pm_cpu_consolidation.py
> @@ -136,7 +136,7 @@ sched_smt was enabled. This is pre-requisite to proceed")
> reset_schedsmt()
> return(status)
> except Exception as details:
> - print(("INFO: CPU consolidation failed", details))
> + print("INFO: CPU consolidation failed", details)
> return(1)
>
> if __name__ == "__main__":
> diff --git a/testcases/kernel/power_management/pm_ilb_test.py b/testcases/kernel/power_management/pm_ilb_test.py
> index 412ceb9f7..920c4e354 100755
> --- a/testcases/kernel/power_management/pm_ilb_test.py
> +++ b/testcases/kernel/power_management/pm_ilb_test.py
> @@ -50,7 +50,7 @@ def main(argv=None):
> return(status)
>
> except Exception as details:
> - print(("INFO: Idle Load Balancer test failed", details))
> + print("INFO: Idle Load Balancer test failed", details)
> return(1)
>
> if __name__ == "__main__":
> diff --git a/testcases/kernel/power_management/pm_sched_domain.py b/testcases/kernel/power_management/pm_sched_domain.py
> index 0ada3eea4..d5cd327f3 100755
> --- a/testcases/kernel/power_management/pm_sched_domain.py
> +++ b/testcases/kernel/power_management/pm_sched_domain.py
> @@ -46,7 +46,7 @@ def main(argv=None):
> print("INFO: Invalid arguments given")
> return 1
> except Exception as details:
> - print(("INFO: sched domain test failed: ", details))
> + print("INFO: sched domain test failed: ", details)
> return(1)
>
> # Run test based on the command line arguments
> diff --git a/testcases/network/nfsv4/acl/random_gen.py b/testcases/network/nfsv4/acl/random_gen.py
> index 735dc1de9..37cb17945 100755
> --- a/testcases/network/nfsv4/acl/random_gen.py
> +++ b/testcases/network/nfsv4/acl/random_gen.py
> @@ -33,7 +33,7 @@ class RandomGen(object):
> opts = "-g" + group + " -p" + "1pilot" + " -m " + username
> u = subprocess.getoutput('/usr/sbin/useradd '+ opts)
> if u != "":
> - print(("create user " + username + "failed" + u))
> + print("create user " + username + "failed" + u)
>
> def createFile(self,path,n):
> for i in range(n):
> @@ -143,10 +143,10 @@ class RandomGen(object):
> f.close()
>
> def printUserList(self):
> - print((self.uList))
> + print(self.uList)
>
> def printGroupList(self):
> - print((self.gList))
> + print(self.gList)
>
> """ Create a random name of random length """
> def createOneNameRandomLength(self,maxlength):
> diff --git a/testcases/network/nfsv4/acl/test_long_acl.py b/testcases/network/nfsv4/acl/test_long_acl.py
> index fae640dd5..79e3a96bc 100755
> --- a/testcases/network/nfsv4/acl/test_long_acl.py
> +++ b/testcases/network/nfsv4/acl/test_long_acl.py
> @@ -26,13 +26,13 @@ def test_longacl(l,path):
> test.getUserList()
> testfile = 'testfile' + str(i)
> u = subprocess.getoutput('touch ' + path + "/" + testfile)
> - print(("setfacl with " + str(i) + " entries\n " + u))
> + print("setfacl with " + str(i) + " entries\n " + u)
> for j in range(i):
> user = test.uList.pop()
> mode = test.createRandomMode()
> u = subprocess.getoutput('setfacl -m u:' + user + ':' + mode + " " + path + "/" + testfile)
> if u != "":
> - print(("setfacl -m u:" + user + ':' + mode + " " + path + "/" + testfile))
> + print("setfacl -m u:" + user + ':' + mode + " " + path + "/" + testfile)
> print(u)
> def main():
> parser = OptionParser()
> diff --git a/testcases/network/nfsv4/locks/locktests.py b/testcases/network/nfsv4/locks/locktests.py
> index 42cb18487..80d8c2051 100755
> --- a/testcases/network/nfsv4/locks/locktests.py
> +++ b/testcases/network/nfsv4/locks/locktests.py
> @@ -38,7 +38,7 @@ class Machine:
> self.do()
>
> def printc(self):
> - print(("->"+self.command))
> + print("->"+self.command)
> print("\n")
>
> class Client(Machine):
> @@ -124,7 +124,7 @@ def setup():
> fichier=SRC_PATH+"/"+SRC
> commande=""
> for i in clients:
> - print(("Setting up machine "+i))
> + print("Setting up machine "+i)
> c=Client(i)
> c.mkdir(path)
> c.cp(fichier, path)
> diff --git a/testcases/realtime/tools/ftqviz.py b/testcases/realtime/tools/ftqviz.py
> index 1cd07b408..f331d3375 100644
> --- a/testcases/realtime/tools/ftqviz.py
> +++ b/testcases/realtime/tools/ftqviz.py
> @@ -62,8 +62,8 @@ def smooth_fft(timefile, countfile, sample_hz, wlen):
> # same factor
> ns_per_sample = NS_PER_S / sample_hz
>
> - print(("Interpolated Sample Rate: ", sample_hz, " HZ"))
> - print(("Hamming Window Length: ", wlen))
> + print("Interpolated Sample Rate: ", sample_hz, " HZ")
> + print("Hamming Window Length: ", wlen)
>
> t = fromfile(timefile, dtype=int64, sep='\n')
> x = fromfile(countfile, dtype=int64, sep='\n')
> @@ -121,7 +121,7 @@ def smooth_fft(timefile, countfile, sample_hz, wlen):
>
>
> def usage():
> - print(("usage: "+argv[0]+" -t times-file -c counts-file [-s SAMPLING_HZ] [-w WINDOW_LEN] [-h]"))
> + print("usage: "+argv[0]+" -t times-file -c counts-file [-s SAMPLING_HZ] [-w WINDOW_LEN] [-h]")
>
>
> if __name__=='__main__':
> diff --git a/testscripts/build/ltp-missing-install-files.py b/testscripts/build/ltp-missing-install-files.py
> index 11465a725..232028bd1 100755
> --- a/testscripts/build/ltp-missing-install-files.py
> +++ b/testscripts/build/ltp-missing-install-files.py
> @@ -111,6 +111,6 @@ for logfile in logfiles:
> fd.close()
>
> if len(missing_ents):
> - print(("\n".join(["%s: %s" % (os.path.basename(logfile), i) for i in ["Tag | App"] + missing_ents])))
> + print("\n".join(["%s: %s" % (os.path.basename(logfile), i) for i in ["Tag | App"] + missing_ents]))
> elif opts.verbose:
> - print(("%s: CONGRATULATIONS -- no missing files found!" % os.path.basename(logfile)))
> + print("%s: CONGRATULATIONS -- no missing files found!" % os.path.basename(logfile))
>
next prev parent reply other threads:[~2018-04-25 10:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-19 10:10 [LTP] [PATCH] *.py : convert python2 to python3 Yong Sun
2018-04-19 16:01 ` Cyril Hrubis
2018-04-20 10:09 ` Petr Vorel
2018-04-23 3:06 ` Yong Sun
2018-04-20 9:59 ` Petr Vorel
2018-04-20 10:00 ` Yong Sun
2018-04-23 3:32 ` [LTP] [PATCH v2] " Yong Sun
2018-04-23 6:55 ` Petr Vorel
2018-04-23 8:12 ` [LTP] [PATCH v3] " Yong Sun
2018-04-24 9:05 ` Petr Vorel
2018-04-25 10:22 ` Xiao Yang [this message]
2018-04-25 13:58 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5AE056FD.4000208@cn.fujitsu.com \
--to=yangx.jy@cn.fujitsu.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox