@@ -122,6 +122,9 @@ def run_all_op_tests(ops_dir=None, specific_ops=None, extra_args=None):
122122
123123 results = {}
124124
125+ # Check if verbose mode is enabled
126+ verbose_mode = extra_args and "--verbose" in extra_args
127+
125128 for test_file in operator_test_files :
126129 test_name = test_file .stem
127130
@@ -199,14 +202,27 @@ def run_all_op_tests(ops_dir=None, specific_ops=None, extra_args=None):
199202 f"{ status_icon } { test_name } : { status_text } (return code: { returncode } )"
200203 )
201204
205+ # In verbose mode, stop execution on first failure
206+ if verbose_mode and not success and returncode not in [- 2 , - 3 ]:
207+ break
208+
202209 except Exception as e :
203210 print (f"💥 { test_name } : ERROR - { str (e )} " )
204211 results [test_name ] = (False , - 1 , "" , str (e ))
205212
213+ # In verbose mode, stop execution on any exception
214+ if verbose_mode :
215+ print (f"\n { '!' * 60 } " )
216+ print (
217+ f"VERBOSE MODE: Stopping execution due to exception in { test_name } "
218+ )
219+ print (f"{ '!' * 60 } " )
220+ break
221+
206222 return results
207223
208224
209- def print_summary (results ):
225+ def print_summary (results , verbose_mode = False , total_expected_tests = 0 ):
210226 """Print a comprehensive summary of test results."""
211227 print (f"\n { '=' * 80 } " )
212228 print ("CUMULATIVE TEST SUMMARY" )
@@ -242,7 +258,11 @@ def print_summary(results):
242258
243259 total = len (results )
244260
245- print (f"Total tests: { total } " )
261+ print (f"Total tests run: { total } " )
262+ if total_expected_tests > 0 and total < total_expected_tests :
263+ print (f"Total tests expected: { total_expected_tests } " )
264+ print (f"Tests not executed: { total_expected_tests - total } " )
265+
246266 print (f"Passed: { passed } " )
247267 print (f"Failed: { failed } " )
248268
@@ -290,6 +310,10 @@ def print_summary(results):
290310 success_rate = passed / executed_tests * 100
291311 print (f"\n Success rate: { success_rate :.1f} %" )
292312
313+ if verbose_mode and total < total_expected_tests :
314+ print (f"\n 💡 Verbose mode: Execution stopped after first failure" )
315+ print (f" { total_expected_tests - total } tests were not executed" )
316+
293317 if failed == 0 :
294318 if skipped > 0 or partial > 0 :
295319 print (f"\n ⚠️ Tests completed with some operators not implemented" )
@@ -358,6 +382,11 @@ def generate_help_epilog(ops_dir):
358382 epilog_parts .append (" # Run with debug mode on multiple devices" )
359383 epilog_parts .append (" python run.py --cpu --nvidia --debug" )
360384 epilog_parts .append ("" )
385+ epilog_parts .append (
386+ " # Run with verbose mode to stop on first error with full traceback"
387+ )
388+ epilog_parts .append (" python run.py --cpu --nvidia --verbose" )
389+ epilog_parts .append ("" )
361390 epilog_parts .append (" # List available tests without running" )
362391 epilog_parts .append (" python run.py --list" )
363392 epilog_parts .append ("" )
@@ -386,6 +415,12 @@ def generate_help_epilog(ops_dir):
386415 epilog_parts .append (
387416 " - --bench option is disabled in batch mode (run individual tests for benchmarking)"
388417 )
418+ epilog_parts .append (
419+ " - --verbose mode stops execution on first error and shows full traceback"
420+ )
421+ epilog_parts .append (
422+ " - In verbose mode, subsequent tests are skipped after first failure"
423+ )
389424
390425 return "\n " .join (epilog_parts )
391426
@@ -413,6 +448,11 @@ def main():
413448 action = "store_true" ,
414449 help = "List all available test files without running them" ,
415450 )
451+ parser .add_argument (
452+ "--verbose" ,
453+ action = "store_true" ,
454+ help = "Enable verbose mode to stop on first error with full traceback (passed to individual tests)" ,
455+ )
416456
417457 from framework import get_hardware_args_group
418458
@@ -442,6 +482,10 @@ def main():
442482 print (f"Error: Ops directory '{ ops_dir } ' does not exist." )
443483 sys .exit (1 )
444484
485+ # Add verbose flag to extra arguments if specified
486+ if args .verbose and "--verbose" not in unknown_args :
487+ unknown_args .append ("--verbose" )
488+
445489 # Show what extra arguments will be passed
446490 if unknown_args :
447491 print (f"Passing extra arguments to test scripts: { unknown_args } " )
@@ -453,6 +497,9 @@ def main():
453497 print (f"Operating directory: { ops_dir } " )
454498 print (f"Available operators: { len (available_operators )} " )
455499
500+ if args .verbose :
501+ print (f"Verbose mode: ENABLED (will stop on first error with full traceback)" )
502+
456503 if args .ops :
457504 # Validate requested operators
458505 valid_ops = []
@@ -469,10 +516,13 @@ def main():
469516
470517 if valid_ops :
471518 print (f"Testing operators: { ', ' .join (valid_ops )} " )
519+ total_expected_tests = len (valid_ops )
472520 else :
473521 print ("No valid operators specified. Running all available tests." )
522+ total_expected_tests = len (available_operators )
474523 else :
475524 print ("Testing all available operators" )
525+ total_expected_tests = len (available_operators )
476526
477527 print ()
478528
@@ -484,7 +534,7 @@ def main():
484534 )
485535
486536 # Print summary and exit with appropriate code
487- all_passed = print_summary (results )
537+ all_passed = print_summary (results , args . verbose , total_expected_tests )
488538
489539 # Check if there were any tests with missing implementations
490540 has_missing_implementations = any (
@@ -495,6 +545,18 @@ def main():
495545 print (f"\n ⚠️ Note: Some operators are not fully implemented" )
496546 print (f" Run individual tests for details on missing implementations" )
497547
548+ if args .verbose and not all_passed :
549+ print (
550+ f"\n 💡 Verbose mode tip: Use individual test commands for detailed debugging:"
551+ )
552+ failed_ops = [
553+ name
554+ for name , (success , _ , _ , _ ) in results .items ()
555+ if not success and name in results
556+ ]
557+ for op in failed_ops [:3 ]: # Show first 3 failed operators
558+ print (f" python { ops_dir / (op + '.py' )} --verbose" )
559+
498560 sys .exit (0 if all_passed else 1 )
499561
500562
0 commit comments