This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC 2/3] Perf test framework


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 (éå)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]