* [PATCH] perf testsuite: python 3 fixes
@ 2016-01-07 21:43 Simon Marchi
2016-01-08 11:29 ` Yao Qi
0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2016-01-07 21:43 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
There are a few errors when trying to run the performance testsuite with
Python 3. This commit fixes them.
In Python 2, it was possible to use relative imports (importing a module
relative to the current one). In Python 3 it isn't. So I use
absolute_import from the __future__ module, which allows Python 2 to
behave like Python 3, and use the Python 3 syntax.
In Python 3, dict.iterkeys doesn't exist anymore. Using dict.keys is a
good compromise in this case.
gdb/testsuite/ChangeLog:
* gdb.perf/lib/perftest/perftest.py: Change relative imports to
absolute.
(SingleStatisticTestResult.report): Use dict.keys instead of
dict.iterkeys.
---
gdb/testsuite/gdb.perf/lib/perftest/perftest.py | 15 +++++++++------
gdb/testsuite/gdb.perf/lib/perftest/testresult.py | 2 +-
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/gdb/testsuite/gdb.perf/lib/perftest/perftest.py b/gdb/testsuite/gdb.perf/lib/perftest/perftest.py
index b78f83b..26d4425 100644
--- a/gdb/testsuite/gdb.perf/lib/perftest/perftest.py
+++ b/gdb/testsuite/gdb.perf/lib/perftest/perftest.py
@@ -13,12 +13,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import testresult
-import reporter
-from measure import Measure
-from measure import MeasurementCpuTime
-from measure import MeasurementWallTime
-from measure import MeasurementVmSize
+from __future__ import absolute_import
+
+import perftest.testresult as testresult
+import perftest.reporter as reporter
+from perftest.measure import Measure
+from perftest.measure import MeasurementCpuTime
+from perftest.measure import MeasurementWallTime
+from perftest.measure import MeasurementVmSize
+
class TestCase(object):
"""Base class of all performance testing cases.
diff --git a/gdb/testsuite/gdb.perf/lib/perftest/testresult.py b/gdb/testsuite/gdb.perf/lib/perftest/testresult.py
index 4a62cf5..6747dcc 100644
--- a/gdb/testsuite/gdb.perf/lib/perftest/testresult.py
+++ b/gdb/testsuite/gdb.perf/lib/perftest/testresult.py
@@ -42,7 +42,7 @@ class SingleStatisticTestResult(TestResult):
def report(self, reporter, name):
reporter.start()
- for key in sorted(self.results.iterkeys()):
+ for key in sorted(self.results.keys()):
reporter.report(name, key, self.results[key])
reporter.end()
--
2.5.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf testsuite: python 3 fixes
2016-01-07 21:43 [PATCH] perf testsuite: python 3 fixes Simon Marchi
@ 2016-01-08 11:29 ` Yao Qi
2016-01-08 15:23 ` Simon Marchi
0 siblings, 1 reply; 3+ messages in thread
From: Yao Qi @ 2016-01-08 11:29 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb-patches
Simon Marchi <simon.marchi@ericsson.com> writes:
> There are a few errors when trying to run the performance testsuite with
> Python 3. This commit fixes them.
>
> In Python 2, it was possible to use relative imports (importing a module
> relative to the current one). In Python 3 it isn't. So I use
> absolute_import from the __future__ module, which allows Python 2 to
> behave like Python 3, and use the Python 3 syntax.
>
> In Python 3, dict.iterkeys doesn't exist anymore. Using dict.keys is a
> good compromise in this case.
>
> gdb/testsuite/ChangeLog:
>
> * gdb.perf/lib/perftest/perftest.py: Change relative imports to
> absolute.
> (SingleStatisticTestResult.report): Use dict.keys instead of
> dict.iterkeys.
Patch is fine with me.
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf testsuite: python 3 fixes
2016-01-08 11:29 ` Yao Qi
@ 2016-01-08 15:23 ` Simon Marchi
0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2016-01-08 15:23 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
On 16-01-08 06:29 AM, Yao Qi wrote:
> Patch is fine with me.
Thanks, pushed.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-08 15:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-07 21:43 [PATCH] perf testsuite: python 3 fixes Simon Marchi
2016-01-08 11:29 ` Yao Qi
2016-01-08 15:23 ` Simon Marchi
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).