This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC 2/3] Perf test framework
- From: Yao Qi <yao at codesourcery dot com>
- To: "Agovic, Sanimir" <sanimir dot agovic at intel dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 3 Sep 2013 09:44:29 +0800
- Subject: Re: [RFC 2/3] Perf test framework
- Authentication-results: sourceware.org; auth=none
- References: <520B7F70 dot 6070207 at codesourcery dot com> <1377663394-4975-1-git-send-email-yao at codesourcery dot com> <1377663394-4975-3-git-send-email-yao at codesourcery dot com> <0377C58828D86C4588AEEC42FC3B85A71765866D at IRSMSX105 dot ger dot corp dot intel dot com>
Sanimir,
Thanks for the review.
On 08/28/2013 05:57 PM, Agovic, Sanimir wrote:
I would put a copyright header and a module __doc__ into __init__.py
What do you mean by "put a module __doc__ into __init__.py"?
>diff --git a/gdb/testsuite/gdb.perf/lib/perftest/perftest.py
>b/gdb/testsuite/gdb.perf/lib/perftest/perftest.py
>new file mode 100644
>index 0000000..b15fd39
>--- /dev/null
>+++ b/gdb/testsuite/gdb.perf/lib/perftest/perftest.py
>@@ -0,0 +1,49 @@
[...]
>+
>+class TestCase(gdb.Function):
>+ """Base class of all performance testing cases. It registers a GDB
>+ convenience function 'perftest'. Invoke this convenience function
>+ in GDB will call method 'invoke'."""
>+
>+ def __init__(self, result):
>+ # Each test case registers a convenience function 'perftest'.
>+ super (TestCase, self).__init__ ("perftest")
>+ self.result = result
>+
>+ def execute_test(self):
>+ """Abstract method to do the actual tests."""
>+ raise RuntimeError("Abstract Method.")
>
You may use module abc instead:
| class TestCase(gdb.Function):
| __metaclass__ = abc.ABCMeta
| @abc.abstractmethod
| def execute_test(self): pass
Instantiating TestCase and subclasses without overriding execute_test will fail.
Abstract Base Class should be useful here. It was introduced in python
2.6, but GDB should support some older pythons. I don't know what are
the versions of python GDB support, 2.4 ~ 3.0?, but some code in
gdb/python/ is written with 2.4 considered.
Other comments are addressed, and I'll post the updated patch in next
round.
--
Yao (éå)