[dts] [PATCH] framework: add argument for debug mode enable and disable
Yong Liu
yong.liu at intel.com
Mon May 11 08:25:01 CEST 2015
From: Marvin Liu <yong.liu at intel.com>
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 <yong.liu at intel.com>
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
More information about the dts
mailing list