[v4,gdb/testsuite] update analyze-racy-logs.py to python3

Message ID 20211001205947.38253-1-blarsen@redhat.com
State New
Headers show
Series
  • [v4,gdb/testsuite] update analyze-racy-logs.py to python3
Related show

Commit Message

Lancelot SIX via Gdb-patches Oct. 1, 2021, 8:59 p.m.
Since python 2 is no longer supported on most distributions, update the
script to run under python while while still being runnable under
python2.
---
 gdb/testsuite/analyze-racy-logs.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

-- 
2.27.0

Comments

Lancelot SIX via Gdb-patches Oct. 2, 2021, 1:32 a.m. | #1
On 2021-10-01 16:59, Bruno Larsen via Gdb-patches wrote:
> Since python 2 is no longer supported on most distributions, update the

> script to run under python while while still being runnable under

> python2.


This is ok.  Do you have a Sourceware account to push the patch?  If
not, would you like one (useful if you intend to send patches
regularly), or would you like me to push the patch for you?

Simon
Lancelot SIX via Gdb-patches Oct. 4, 2021, 12:58 p.m. | #2
On 10/1/21 10:32 PM, Simon Marchi wrote:
> On 2021-10-01 16:59, Bruno Larsen via Gdb-patches wrote:

>> Since python 2 is no longer supported on most distributions, update the

>> script to run under python while while still being runnable under

>> python2.

> 

> This is ok.  Do you have a Sourceware account to push the patch?  If

> not, would you like one (useful if you intend to send patches

> regularly), or would you like me to push the patch for you?

> 

> Simon

> 


Thank you for the review! I've pushed the patch

-- 
Cheers!
Bruno Larsen

Patch

diff --git a/gdb/testsuite/analyze-racy-logs.py b/gdb/testsuite/analyze-racy-logs.py
index 604a272831c..4724e1bdbfc 100755
--- a/gdb/testsuite/analyze-racy-logs.py
+++ b/gdb/testsuite/analyze-racy-logs.py
@@ -1,4 +1,4 @@ 
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # Copyright (C) 2016-2021 Free Software Foundation, Inc.
 #
@@ -145,7 +145,7 @@  def identify_racy_tests():
     # to be ignored.  For example, tests both in the PASS and KFAIL
     # states should not be considered racy.
     ignored_tests = set()
-    for s1, s2 in ignore_relations.iteritems():
+    for s1, s2 in ignore_relations.items():
         try:
             ignored_tests |= all_tests[s1] & all_tests[s2]
         except:
@@ -159,16 +159,16 @@  def identify_racy_tests():
     racy_tests = racy_tests - ignored_tests
 
     # Print the header.
-    print "\t\t=== gdb racy tests ===\n"
+    print("\t\t=== gdb racy tests ===\n")
 
     # Print each test.
     for line in sorted(racy_tests):
-        print line
+        print(line)
 
     # Print the summary.
-    print "\n"
-    print "\t\t=== gdb Summary ===\n"
-    print "# of racy tests:\t\t%d" % len(racy_tests)
+    print("\n")
+    print("\t\t=== gdb Summary ===\n")
+    print("# of racy tests:\t\t%d" % len(racy_tests))
 
 
 if __name__ == "__main__":