@@ -526,26 +526,33 @@ def display_header(self):
526
526
print ("== CPU count:" , cpu_count )
527
527
print ("== encodings: locale=%s, FS=%s"
528
528
% (locale .getencoding (), sys .getfilesystemencoding ()))
529
+ self .display_sanitizers ()
530
+
531
+ def display_sanitizers (self ):
532
+ # This makes it easier to remember what to set in your local
533
+ # environment when trying to reproduce a sanitizer failure.
529
534
asan = support .check_sanitizer (address = True )
530
535
msan = support .check_sanitizer (memory = True )
531
536
ubsan = support .check_sanitizer (ub = True )
532
- # This makes it easier to remember what to set in your local
533
- # environment when trying to reproduce a sanitizer failure.
534
- if asan or msan or ubsan :
535
- names = [n for n in (asan and "address" ,
536
- msan and "memory" ,
537
- ubsan and "undefined behavior" )
538
- if n ]
539
- print (f"== sanitizers: { ', ' .join (names )} " )
540
- a_opts = os .environ .get ("ASAN_OPTIONS" )
541
- if asan and a_opts is not None :
542
- print (f"== ASAN_OPTIONS={ a_opts } " )
543
- m_opts = os .environ .get ("ASAN_OPTIONS" )
544
- if msan and m_opts is not None :
545
- print (f"== MSAN_OPTIONS={ m_opts } " )
546
- ub_opts = os .environ .get ("UBSAN_OPTIONS" )
547
- if ubsan and ub_opts is not None :
548
- print (f"== UBSAN_OPTIONS={ ub_opts } " )
537
+ sanitizers = []
538
+ if asan :
539
+ sanitizers .append ("address" )
540
+ if msan :
541
+ sanitizers .append ("memory" )
542
+ if ubsan :
543
+ sanitizers .append ("undefined behavior" )
544
+ if not sanitizers :
545
+ return
546
+
547
+ print (f"== sanitizers: { ', ' .join (sanitizers )} " )
548
+ for sanitizer , env_var in (
549
+ (asan , "ASAN_OPTIONS" ),
550
+ (msan , "MSAN_OPTIONS" ),
551
+ (ubsan , "UBSAN_OPTIONS" ),
552
+ ):
553
+ options = os .environ .get (env_var )
554
+ if sanitizer and options is not None :
555
+ print (f"== { env_var } ={ options !r} " )
549
556
550
557
def no_tests_run (self ):
551
558
return not any ((self .good , self .bad , self .skipped , self .interrupted ,
0 commit comments