[Fuego] [PATCH] Convert the print statement to the print() function
[email protected] Thu, 29 Sep 2022 18:50:02 +0530
| Newsgroups | dev.linux.lists.fuego |
|---|---|
| Message-ID | <[email protected]> |
From: sireesha <[email protected]> Update parentheses for all print statements in python script. It is compatible with both python2 and python3 interpreters. Signed-off-by: sireesha <[email protected]> --- tests/Benchmark.IOzone/parser.py | 4 ++-- tests/Benchmark.Stream/parser.py | 4 ++-- tests/Benchmark.bonnie/parser.py | 8 ++++---- tests/Benchmark.lmbench2/parser.py | 13 ++++++------- 4 files changed, 14 insertions(+), 15 deletions(-) mode change 100755 => 100644 tests/Benchmark.lmbench2/parser.py diff --git a/tests/Benchmark.IOzone/parser.py b/tests/Benchmark.IOzone/parser.py index b1631ae..8a7d5b2 100755 --- a/tests/Benchmark.IOzone/parser.py +++ b/tests/Benchmark.IOzone/parser.py @@ -1,11 +1,11 @@ -#!/usr/bin/python +#!/usr/bin/python3 import os, sys import common as plib measurements = {} cur_file = open(plib.TEST_LOG,'r') -print "Reading current values from " + plib.TEST_LOG +"\n" +print("Reading current values from " + plib.TEST_LOG +"\n") lines = cur_file.readlines() cur_file.close() diff --git a/tests/Benchmark.Stream/parser.py b/tests/Benchmark.Stream/parser.py index a564d74..69edd27 100755 --- a/tests/Benchmark.Stream/parser.py +++ b/tests/Benchmark.Stream/parser.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 import os, re, sys import common as plib @@ -7,7 +7,7 @@ ref_section_pat = "^\[[\w]+.[gle]{2}\]" # groups 1 2 cur_search_str = "^(\w*):\ *([\d]{1,5}.[\d]{1,4}).*" -print "Reading current values from " + plib.TEST_LOG +print("Reading current values from " + plib.TEST_LOG) cur_file = open(plib.TEST_LOG,'r') lines = cur_file.readlines() diff --git a/tests/Benchmark.bonnie/parser.py b/tests/Benchmark.bonnie/parser.py index b68bc3e..5f35af4 100755 --- a/tests/Benchmark.bonnie/parser.py +++ b/tests/Benchmark.bonnie/parser.py @@ -5,16 +5,16 @@ import common as plib measurements = {} -print "Reading current values from " + plib.TEST_LOG + "\n" +print("Reading current values from " + plib.TEST_LOG + "\n") with open(plib.TEST_LOG,'r') as cur_file: raw_values = cur_file.readlines() results = raw_values[-1].rstrip("\n").split(",") if len(results) < 26: - print "\nFuego error reason: No results found\n" + print("\nFuego error reason: No results found\n") sys.exit(2) -print "Bonnie++ raw results: " + str(results) +print("Bonnie++ raw results: " + str(results)) measurements["Sequential_Output.PerChr"] = [] @@ -81,6 +81,6 @@ if not '+' in results[26]: # Add a hint when the spec seems to require a bigger SIZE if '+' in results[4]: - print "\nWARNING: Some test result data is missing. You might need bigger test data size.\nTry the test using the 'more-data' spec for better results.\n" + print("\nWARNING: Some test result data is missing. You might need bigger test data size.\nTry the test using the 'more-data' spec for better results.\n") sys.exit(plib.process(measurements)) diff --git a/tests/Benchmark.lmbench2/parser.py b/tests/Benchmark.lmbench2/parser.py old mode 100755 new mode 100644 index f06f132..5ccfe97 --- a/tests/Benchmark.lmbench2/parser.py +++ b/tests/Benchmark.lmbench2/parser.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 import os, re, sys import common as plib @@ -11,7 +11,7 @@ cur_search_pat = re.compile("^\S+\s+Linux\s[0-9a-z.-]+\s+([\s\d.KMGT-]*)",re.MUL cur_dict = {} cur_file = open(plib.TEST_LOG,'r') -print "Reading current values from " + plib.TEST_LOG +"\n" +print("Reading current values from " + plib.TEST_LOG +"\n") lines = cur_file.readlines() @@ -19,18 +19,17 @@ lines = cur_file.readlines() t_index = 0 sublist = [] -print lines +print(lines) for line in lines: result = cur_search_pat.findall(line) if result and len(result[0]) > 0: - print 'result: ', result + print('result: ', result) # Ugly hack to work around invalid processing of empty cells result[0] = result[0].replace(' ', ' 0 ') test_res = result[0].rstrip('\n').split(' ') - - print "test_res = %s" % (test_res) + print("test_res = %s" % (test_res)) if 0 < t_index < 9: for value in test_res: @@ -104,6 +103,6 @@ cur_dict["Memory_Latencies.Main_mem"] = sublist[48] #cur_dict["Memory_Latencies.Guesses"] = sublist[49] cur_dict["Memory_Latencies.Rand_mem"] = sublist[50] -print "cur_dict = %s" % (cur_dict) +print("cur_dict = %s" % (cur_dict)) sys.exit(plib.process_data(ref_section_pat, cur_dict, 'xl', ' ')) -- 2.20.1