quickSelfTest/RunUnitTests.st
changeset 547 8846155dc785
parent 546 72e5307ece32
child 548 54b9fecb0bc9
equal deleted inserted replaced
546:72e5307ece32 547:8846155dc785
   119 
   119 
   120     (Smalltalk at: #'stx_goodies_regression') classNames do:[:eachClassName |
   120     (Smalltalk at: #'stx_goodies_regression') classNames do:[:eachClassName |
   121 	(excludedUnitTestClassNames includes:eachClassName) ifTrue:[
   121 	(excludedUnitTestClassNames includes:eachClassName) ifTrue:[
   122 	    self logInfo:'exclude test "%1".' with:eachClassName.
   122 	    self logInfo:'exclude test "%1".' with:eachClassName.
   123 	] ifFalse:[
   123 	] ifFalse:[
   124 	    (corruptedUnitTestClassNames includes:eachClassName) ifTrue:[
   124 	    (runTestCases notEmptyOrNil and:[(runTestCases includes:eachClassName) not]) ifTrue:[
   125 		self logWarning:'test "%1" is marked as corrupted, please fix' with:eachClassName.
   125 		self logInfo:'not selected: "%1".' with:eachClassName.
   126 	    ] ifFalse:[
   126 	    ] ifFalse:[
   127 		(eachClassName notNil
   127 		(corruptedUnitTestClassNames includes:eachClassName) ifTrue:[
   128 		and:[
   128 		    self logWarning:'test "%1" is marked as corrupted, please fix' with:eachClassName.
   129 		    "/ skip non test class classes
   129 		] ifFalse:[
   130 		    (#(
   130 		    (eachClassName notNil
   131 			'stx_goodies_regression'
   131 		    and:[
   132 		    ) includes:eachClassName) not
   132 			"/ skip non test class classes
   133 		and:[
   133 			(#(
   134 		    forceTestCase isNil
   134 			    'stx_goodies_regression'
   135 		    or:[forceTestCase = eachClassName
   135 			) includes:eachClassName) not
   136 		    or:[forceTestCase = ((eachClassName subStrings:'::') lastIfEmpty:nil)]]
   136 		    and:[
   137 		]]) ifTrue:[
   137 			forceTestCase isNil
   138 		    eachClass := Smalltalk at:eachClassName.
   138 			or:[forceTestCase = eachClassName
   139 
   139 			or:[forceTestCase = ((eachClassName subStrings:'::') lastIfEmpty:nil)]]
   140 		    useCompiledUnitTestClasses ifFalse:[
   140 		    ]]) ifTrue:[
   141 			"here we want to test the jitter code
   141 			eachClass := Smalltalk at:eachClassName.
   142 			 therfore we file in, exit if the class is already present somwhow"
   142 
       
   143 			useCompiledUnitTestClasses ifFalse:[
       
   144 			    "here we want to test the jitter code
       
   145 			     therfore we file in, exit if the class is already present somwhow"
       
   146 			    eachClass notNil ifTrue:[
       
   147 				self logWarning:'test class "%1" was already present as stc-compiled class before file in.' with:eachClassName.
       
   148 				Smalltalk isSmalltalkDevelopmentSystem ifFalse:[
       
   149 				    Smalltalk exit:1.
       
   150 				].
       
   151 			    ].
       
   152 
       
   153 			    eachClass := Smalltalk
       
   154 				fileInClass:eachClassName
       
   155 				package:'stx:goodies/regression'.
       
   156 			].
       
   157 
   143 			eachClass notNil ifTrue:[
   158 			eachClass notNil ifTrue:[
   144 			    self logWarning:'test class "%1" was already present as stc-compiled class before file in.' with:eachClassName.
   159 			    (eachClass isTestCaseLike
   145 			    Smalltalk isSmalltalkDevelopmentSystem ifFalse:[
   160 			    and:[eachClass isAbstract not]) ifTrue:[
   146 				Smalltalk exit:1.
   161 				self logInfo:'added test "%1".' with:eachClassName.
       
   162 				unitTestSuite addTest:eachClass suite.
       
   163 			    ] ifFalse:[
       
   164 				self logInfo:'not a test "%1" (abstract or something else).'
       
   165 					with:eachClassName.
   147 			    ].
   166 			    ].
   148 			].
       
   149 
       
   150 			eachClass := Smalltalk
       
   151 			    fileInClass:eachClassName
       
   152 			    package:'stx:goodies/regression'.
       
   153 		    ].
       
   154 
       
   155 		    eachClass notNil ifTrue:[
       
   156 			(eachClass isTestCaseLike
       
   157 			and:[eachClass isAbstract not]) ifTrue:[
       
   158 			    self logInfo:'added test "%1".' with:eachClassName.
       
   159 			    unitTestSuite addTest:eachClass suite.
       
   160 			] ifFalse:[
   167 			] ifFalse:[
   161 			    self logInfo:'not a test "%1" (abstract or something else).'
   168 			    self logWarning:'test class "%1" is not loaded.' with:eachClassName.
   162 				    with:eachClassName.
       
   163 			].
   169 			].
   164 		    ] ifFalse:[
   170 		    ] ifFalse:[
   165 			self logWarning:'test class "%1" is not loaded.' with:eachClassName.
   171 			self logInfo:'skipped test "%1".' with:eachClassName.
   166 		    ].
   172 		    ].
   167 		] ifFalse:[
       
   168 		    self logInfo:'skipped test "%1".' with:eachClassName.
       
   169 		].
   173 		].
   170 	    ].
   174 	    ].
   171 	].
   175 	].
   172     ].
   176     ].
   173 
   177 
   342 ! !
   346 ! !
   343 
   347 
   344 !RunUnitTests class methodsFor:'logging'!
   348 !RunUnitTests class methodsFor:'logging'!
   345 
   349 
   346 log:aString type:aType
   350 log:aString type:aType
   347     Transcript notNil ifTrue:[
   351     |fmt msg|
   348 	Transcript showCR:'%1 [%2] : %3'
   352 
   349 		with:Timestamp now printString
   353     fmt := '%1 RunUnitTests [%2]: %3'.
       
   354     fmt := 'RunUnitTests [%2]: %3'.
       
   355 
       
   356     msg := fmt
       
   357 		bindWith:Timestamp now printString
   350 		with:(aType printString asLowercase "paddedTo:'warning' size")
   358 		with:(aType printString asLowercase "paddedTo:'warning' size")
   351 		with:aString.
   359 		with:aString.
       
   360 
       
   361     Transcript notNil ifTrue:[
       
   362 	Transcript showCR:msg.
   352 	^ self
   363 	^ self
   353     ].
   364     ].
   354     Stderr showCR:'%1 [%2] : %3'
   365     Stderr notNil ifTrue:[
   355 	    with:Timestamp now printString
   366 	Stderr showCR:msg.
   356 	    with:(aType printString asLowercase paddedTo:'warning' size)
   367     ].
   357 	    with:aString.
       
   358 
   368 
   359     "Modified: / 26-03-2019 / 18:53:48 / Claus Gittinger"
   369     "Modified: / 26-03-2019 / 18:53:48 / Claus Gittinger"
   360 !
   370 !
   361 
   371 
   362 logInfo:aString
   372 logInfo:aString