mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-18 20:11:20 +00: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:
parent
1a15f5c761
commit
d27443deb5
@ -260,9 +260,9 @@ class RtApp(Workload):
|
|||||||
# use workgen dry run option to generate a use case
|
# use workgen dry run option to generate a use case
|
||||||
# file with proper JSON grammar on host first
|
# file with proper JSON grammar on host first
|
||||||
try:
|
try:
|
||||||
check_output('python {} -d -o {} {}'.format(self.workgen_script,
|
check_output('python3 {} -d -o {} {}'.format(self.workgen_script,
|
||||||
output_file,
|
output_file,
|
||||||
user_file),
|
user_file),
|
||||||
shell=True)
|
shell=True)
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
message = 'Could not generate config using workgen, got "{}"'
|
message = 'Could not generate config using workgen, got "{}"'
|
||||||
|
@ -9,12 +9,12 @@ import re
|
|||||||
|
|
||||||
def check_unikid_json(infile, outfile, verbose=0):
|
def check_unikid_json(infile, outfile, verbose=0):
|
||||||
if not os.path.exists(infile):
|
if not os.path.exists(infile):
|
||||||
print "WARN: %s does not exist", infile
|
print("WARN: %s does not exist", infile)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
fi = open(infile, "r")
|
fi = open(infile, "r")
|
||||||
except IOError:
|
except IOError:
|
||||||
print "WARN: Unable to open %s", infile
|
print("WARN: Unable to open %s", infile)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
lines = fi.readlines()
|
lines = fi.readlines()
|
||||||
@ -23,7 +23,7 @@ def check_unikid_json(infile, outfile, verbose=0):
|
|||||||
try:
|
try:
|
||||||
fo = open(outfile, "w+")
|
fo = open(outfile, "w+")
|
||||||
except IOError:
|
except IOError:
|
||||||
print "WARN: Unable to open %s", f
|
print("WARN: Unable to open %s", f)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
curid = 1
|
curid = 1
|
||||||
@ -58,7 +58,7 @@ def check_unikid_json(infile, outfile, verbose=0):
|
|||||||
newkey_id = key_id + str(curid)
|
newkey_id = key_id + str(curid)
|
||||||
|
|
||||||
if verbose:
|
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)
|
myline = myline.replace(key_id, newkey_id, 1)
|
||||||
key_id = newkey_id
|
key_id = newkey_id
|
||||||
@ -72,12 +72,12 @@ def check_unikid_json(infile, outfile, verbose=0):
|
|||||||
|
|
||||||
def check_suspend_json(infile, outfile, verbose=0):
|
def check_suspend_json(infile, outfile, verbose=0):
|
||||||
if not os.path.exists(infile):
|
if not os.path.exists(infile):
|
||||||
print "WARN: %s does not exist", infile
|
print("WARN: %s does not exist", infile)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
fi = open(infile, "r")
|
fi = open(infile, "r")
|
||||||
except IOError:
|
except IOError:
|
||||||
print "WARN: Unable to open %s", infile
|
print("WARN: Unable to open %s", infile)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
lines = fi.readlines()
|
lines = fi.readlines()
|
||||||
@ -86,7 +86,7 @@ def check_suspend_json(infile, outfile, verbose=0):
|
|||||||
try:
|
try:
|
||||||
fo = open(outfile, "w+")
|
fo = open(outfile, "w+")
|
||||||
except IOError:
|
except IOError:
|
||||||
print "WARN: Unable to open %s", f
|
print("WARN: Unable to open %s", f)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ def check_suspend_json(infile, outfile, verbose=0):
|
|||||||
exception == 1:
|
exception == 1:
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print "value ", curid, " added to suspend key"
|
print("value ", curid, " added to suspend key")
|
||||||
|
|
||||||
if "," in myline:
|
if "," in myline:
|
||||||
myline = myline.replace(",", " : " + "\"" + curid + "\",", 1)
|
myline = myline.replace(",", " : " + "\"" + curid + "\",", 1)
|
||||||
@ -142,7 +142,7 @@ def remove_trailing_commas(outfile):
|
|||||||
try:
|
try:
|
||||||
f = open(outfile, 'r+')
|
f = open(outfile, 'r+')
|
||||||
except IOError:
|
except IOError:
|
||||||
print "WARN: Unable to open %s", f
|
print("WARN: Unable to open %s", f)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
lines = f.read()
|
lines = f.read()
|
||||||
@ -180,7 +180,7 @@ def remove_all_comments(outfile):
|
|||||||
try:
|
try:
|
||||||
f = open(outfile, 'r+')
|
f = open(outfile, 'r+')
|
||||||
except IOError:
|
except IOError:
|
||||||
print "WARN: Unable to open %s", f
|
print("WARN: Unable to open %s", f)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
lines = f.read()
|
lines = f.read()
|
||||||
@ -210,7 +210,7 @@ if __name__ == '__main__':
|
|||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(sys.argv[1:], "o:avd")
|
opts, args = getopt.getopt(sys.argv[1:], "o:avd")
|
||||||
except getopt.GetoptError as err:
|
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)
|
sys.exit(2)
|
||||||
|
|
||||||
for o, a in opts:
|
for o, a in opts:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user