* [PATCH] [gdb/testsuite] updated analyze-racy-logs.py to python3
@ 2021-10-01 18:24 Bruno Larsen
2021-10-01 18:38 ` Lancelot SIX
0 siblings, 1 reply; 2+ messages in thread
From: Bruno Larsen @ 2021-10-01 18:24 UTC (permalink / raw)
To: gdb-patches
Since python 2 is no longer supported on most distributions, updated the
script to run under python while while still being runnable under
python2.
---
gdb/testsuite/analyze-racy-logs.py | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/gdb/testsuite/analyze-racy-logs.py b/gdb/testsuite/analyze-racy-logs.py
index 604a272831c..c2cd8169d91 100755
--- a/gdb/testsuite/analyze-racy-logs.py
+++ b/gdb/testsuite/analyze-racy-logs.py
@@ -145,7 +145,8 @@ 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 in ignore_relations:
+ s2 = ignore_relations[s1]
try:
ignored_tests |= all_tests[s1] & all_tests[s2]
except:
@@ -159,16 +160,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__":
--
2.27.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] [gdb/testsuite] updated analyze-racy-logs.py to python3
2021-10-01 18:24 [PATCH] [gdb/testsuite] updated analyze-racy-logs.py to python3 Bruno Larsen
@ 2021-10-01 18:38 ` Lancelot SIX
0 siblings, 0 replies; 2+ messages in thread
From: Lancelot SIX @ 2021-10-01 18:38 UTC (permalink / raw)
To: Bruno Larsen; +Cc: gdb-patches
On Fri, Oct 01, 2021 at 03:24:17PM -0300, Bruno Larsen via Gdb-patches wrote:
> Since python 2 is no longer supported on most distributions, updated the
> script to run under python while while still being runnable under
> python2.
> ---
> gdb/testsuite/analyze-racy-logs.py | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/gdb/testsuite/analyze-racy-logs.py b/gdb/testsuite/analyze-racy-logs.py
> index 604a272831c..c2cd8169d91 100755
> --- a/gdb/testsuite/analyze-racy-logs.py
> +++ b/gdb/testsuite/analyze-racy-logs.py
> @@ -145,7 +145,8 @@ 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 in ignore_relations:
> + s2 = ignore_relations[s1]
Hi,
In python3 you can use .items() to replace what used to be .iteritems()
in python2:
for s1, s2 in ignore_relations.items():
It does not change much, but it simplifies your patch.
Best,
Lancelot.
> try:
> ignored_tests |= all_tests[s1] & all_tests[s2]
> except:
> @@ -159,16 +160,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__":
> --
> 2.27.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-01 18:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01 18:24 [PATCH] [gdb/testsuite] updated analyze-racy-logs.py to python3 Bruno Larsen
2021-10-01 18:38 ` Lancelot SIX
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).