1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-05 18:31:12 +01:00

workloads/rt_app: Update to use python3

Update the workload generation script to be python3 compatible and
invoke with python3.
This commit is contained in:
Marc Bonnici 2019-09-06 10:38:45 +01:00 committed by setrofim
parent 1a15f5c761
commit d27443deb5
2 changed files with 14 additions and 14 deletions

View File

@ -260,9 +260,9 @@ class RtApp(Workload):
# use workgen dry run option to generate a use case
# file with proper JSON grammar on host first
try:
check_output('python {} -d -o {} {}'.format(self.workgen_script,
output_file,
user_file),
check_output('python3 {} -d -o {} {}'.format(self.workgen_script,
output_file,
user_file),
shell=True)
except CalledProcessError as e:
message = 'Could not generate config using workgen, got "{}"'

View File

@ -9,12 +9,12 @@ import re
def check_unikid_json(infile, outfile, verbose=0):
if not os.path.exists(infile):
print "WARN: %s does not exist", infile
print("WARN: %s does not exist", infile)
try:
fi = open(infile, "r")
except IOError:
print "WARN: Unable to open %s", infile
print("WARN: Unable to open %s", infile)
sys.exit(2)
lines = fi.readlines()
@ -23,7 +23,7 @@ def check_unikid_json(infile, outfile, verbose=0):
try:
fo = open(outfile, "w+")
except IOError:
print "WARN: Unable to open %s", f
print("WARN: Unable to open %s", f)
sys.exit(2)
curid = 1
@ -58,7 +58,7 @@ def check_unikid_json(infile, outfile, verbose=0):
newkey_id = key_id + str(curid)
if verbose:
print "level ", refcount, " : key ", key_id, " changed into ", newkey_id
print("level ", refcount, " : key ", key_id, " changed into ", newkey_id)
myline = myline.replace(key_id, newkey_id, 1)
key_id = newkey_id
@ -72,12 +72,12 @@ def check_unikid_json(infile, outfile, verbose=0):
def check_suspend_json(infile, outfile, verbose=0):
if not os.path.exists(infile):
print "WARN: %s does not exist", infile
print("WARN: %s does not exist", infile)
try:
fi = open(infile, "r")
except IOError:
print "WARN: Unable to open %s", infile
print("WARN: Unable to open %s", infile)
sys.exit(2)
lines = fi.readlines()
@ -86,7 +86,7 @@ def check_suspend_json(infile, outfile, verbose=0):
try:
fo = open(outfile, "w+")
except IOError:
print "WARN: Unable to open %s", f
print("WARN: Unable to open %s", f)
sys.exit(2)
@ -123,7 +123,7 @@ def check_suspend_json(infile, outfile, verbose=0):
exception == 1:
if verbose:
print "value ", curid, " added to suspend key"
print("value ", curid, " added to suspend key")
if "," in myline:
myline = myline.replace(",", " : " + "\"" + curid + "\",", 1)
@ -142,7 +142,7 @@ def remove_trailing_commas(outfile):
try:
f = open(outfile, 'r+')
except IOError:
print "WARN: Unable to open %s", f
print("WARN: Unable to open %s", f)
sys.exit(2)
lines = f.read()
@ -180,7 +180,7 @@ def remove_all_comments(outfile):
try:
f = open(outfile, 'r+')
except IOError:
print "WARN: Unable to open %s", f
print("WARN: Unable to open %s", f)
sys.exit(2)
lines = f.read()
@ -210,7 +210,7 @@ if __name__ == '__main__':
try:
opts, args = getopt.getopt(sys.argv[1:], "o:avd")
except getopt.GetoptError as err:
print str(err) # will print something like "option -a not recognized"
print(str(err)) # will print something like "option -a not recognized"
sys.exit(2)
for o, a in opts: