From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 6AF17C3A6 for ; Mon, 11 May 2015 08:25:10 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 10 May 2015 23:25:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,404,1427785200"; d="scan'208";a="723828566" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 10 May 2015 23:25:09 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t4B6P5JJ029467; Mon, 11 May 2015 14:25:05 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t4B6P3ub015775; Mon, 11 May 2015 14:25:05 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t4B6P3cu015771; Mon, 11 May 2015 14:25:03 +0800 From: Yong Liu To: dts@dpdk.org Date: Mon, 11 May 2015 14:25:01 +0800 Message-Id: <1431325501-15737-1-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1430232992-6798-1-git-send-email-yong.liu@intel.com> References: <1430232992-6798-1-git-send-email-yong.liu@intel.com> Subject: [dts] [PATCH] framework: add argument for debug mode enable and disable X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2015 06:25:11 -0000 From: Marvin Liu When debug mode enable, before and after every send_expect function will change signal handler. Althrough it only toke 0.x second, hundreds call of send_expect will also take few minutes. This patch add one argument of dts to enable and disable debug mode, and default debug mode will be disabled. Signed-off-by: Marvin Liu diff --git a/framework/debugger.py b/framework/debugger.py index a2bfe7f..a5f3e84 100644 --- a/framework/debugger.py +++ b/framework/debugger.py @@ -131,6 +131,9 @@ def ignore_keyintr(): """ Temporary disable interrupt handler. """ + if dts.debug_mode is False: + return + global debug_cmd signal.siginterrupt(signal.SIGINT, True) # if there's waiting request, first handler it @@ -144,4 +147,7 @@ def aware_keyintr(): """ Reenable interrupt handler. """ + if dts.debug_mode is False: + return + return signal.signal(signal.SIGINT, keyboard_handle) diff --git a/framework/dts.py b/framework/dts.py index ae12dc9..c9ecccb 100644 --- a/framework/dts.py +++ b/framework/dts.py @@ -58,6 +58,7 @@ reload(sys) sys.setdefaultencoding('UTF8') +debug_mode = False config = None table = None results_table_rows = [] @@ -385,7 +386,7 @@ def dts_run_suite(crbInst, test_suites, target, nic): def run_all(config_file, pkgName, git, patch, skip_setup, read_cache, project, suite_dir, test_cases, - base_dir, output_dir, verbose): + base_dir, output_dir, verbose, debug): """ Main process of DTS, it will run all test suites in the config file. """ @@ -398,6 +399,7 @@ def run_all(config_file, pkgName, git, patch, skip_setup, global excel_report global stats global log_handler + global debug_mode # prepare the output folder if not os.path.exists(output_dir): @@ -408,6 +410,10 @@ def run_all(config_file, pkgName, git, patch, skip_setup, sys.path.append(folder) sys.path.append(suite_dir) + # enable debug mode + if debug is True: + debug_mode = True + # init log_handler handler if verbose is True: logger.set_verbose() diff --git a/framework/main.py b/framework/main.py index 11b7513..3e467d0 100755 --- a/framework/main.py +++ b/framework/main.py @@ -117,6 +117,10 @@ parser.add_argument('-v', '--verbose', action='store_true', help='enable verbose output, all message output on screen') +parser.add_argument('--debug', + action='store_true', + help='enable debug mode, user can enter debug mode in process') + args = parser.parse_args() @@ -132,4 +136,4 @@ if args.git is not None: dts.run_all(args.config_file, args.snapshot, args.git, args.patch, args.skip_setup, args.read_cache, args.project, args.suite_dir, args.test_cases, - args.dir, args.output, args.verbose) + args.dir, args.output, args.verbose, args.debug) -- 1.9.3