From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7159 invoked by alias); 3 Sep 2013 01:45:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 7149 invoked by uid 89); 3 Sep 2013 01:45:36 -0000 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 03 Sep 2013 01:45:36 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RDNS_NONE,SPF_HELO_FAIL autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1VGfgO-0002v4-O3 from Yao_Qi@mentor.com ; Mon, 02 Sep 2013 18:45:28 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 2 Sep 2013 18:45:28 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.2.247.3; Mon, 2 Sep 2013 18:45:27 -0700 Message-ID: <52253EFD.6040505@codesourcery.com> Date: Tue, 03 Sep 2013 01:45:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: "Agovic, Sanimir" CC: "gdb-patches@sourceware.org" Subject: Re: [RFC 2/3] Perf test framework References: <520B7F70.6070207@codesourcery.com> <1377663394-4975-1-git-send-email-yao@codesourcery.com> <1377663394-4975-3-git-send-email-yao@codesourcery.com> <0377C58828D86C4588AEEC42FC3B85A71765866D@IRSMSX105.ger.corp.intel.com> In-Reply-To: <0377C58828D86C4588AEEC42FC3B85A71765866D@IRSMSX105.ger.corp.intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00049.txt.bz2 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 (齐尧)