*** empty log message *** expecco_head_5844
authorsr
Tue, 21 Mar 2017 16:03:37 +0100
changeset 329 6a3fe7cea4e1
parent 328 1bf7295a0b9a
child 330 44fde0482a1c
*** empty log message ***
quickSelfTest/README
quickSelfTest/RunUnitTests.st
quickSelfTest/Start.st
quickSelfTest/run.bat
quickSelfTest/run.sh
--- a/quickSelfTest/README	Sat Mar 18 04:55:07 2017 +0000
+++ b/quickSelfTest/README	Tue Mar 21 16:03:37 2017 +0100
@@ -6,8 +6,17 @@
 or
     run.bat (windows)
 
-executes the tests found in ~/exept/regression/*
+executes the tests found in ~/stx/goodies/regression/*
 and generates a junit-xml compatible output file 'testresult.xml',
 (to be consumed by jenkins).
 
-Also some metric info is written to 'metrics.xml'
+the cmd script will start stx with Start.st
+Start.st will prepare the stx environment required for the unit test.
+For e.g. loading required packages.
+
+The last command of Start.st will file in RunUnitTest.st class and send #run.
+The RunUnitTest class will perform all (or a subset when use the --runOnlyExpeccoUnitTests paramter) unit tests
+and create the report file ""
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/quickSelfTest/RunUnitTests.st	Tue Mar 21 16:03:37 2017 +0100
@@ -0,0 +1,162 @@
+'From Smalltalk/X, Version:7.1.0.0 on 21-03-2017 at 14:52:37'                   !
+
+"{ Package: 'stx:goodies/regression' }"
+
+"{ NameSpace: Smalltalk }"
+
+Object subclass:#RunUnitTests
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'tests-Regression'
+!
+
+!RunUnitTests class methodsFor:'documentation'!
+
+documentation
+"
+    documentation to be added.
+
+    [author:]
+        sr
+
+    [instance variables:]
+
+    [class variables:]
+
+    [see also:]
+
+"
+! !
+
+!RunUnitTests class methodsFor:'actions'!
+
+run
+    |doRunSpecificUnitTests unitTestSuiteName excludedUnitTestClassNames corruptedUnitTestClassNames
+     cmdArgs 
+     unitTestSuite 
+     eachClassName eachClass
+     result|
+
+    doRunSpecificUnitTests := false.
+    unitTestSuiteName := 'All Unit Tests'. 
+    excludedUnitTestClassNames := self excludedUnitTestClassNamesForAll.
+    corruptedUnitTestClassNames := self corruptedUnitTestClassNames.
+
+    cmdArgs := Smalltalk commandLineArguments.
+    (cmdArgs includes:'--runOnlyExpeccoUnitTests') ifTrue:[
+        self logInfo:'configured to run expecco unit tests only'.
+        doRunSpecificUnitTests := true.
+        unitTestSuiteName := 'expecco Unit Tests'. 
+        excludedUnitTestClassNames := self excludedUnitTestClassNamesForExpecco.
+    ].
+
+    doRunSpecificUnitTests ifFalse:[
+        self logInfo:'configured to run all available unit tests'.
+    ].
+
+    self logInfo:'collecting unit test classes to run'.
+    unitTestSuite := TestSuite named:unitTestSuiteName.
+    (Smalltalk at: #'stx_goodies_regression') classNamesAndAttributes do:[:eachClassNameAndAttributes |
+        eachClassNameAndAttributes isSymbol ifTrue:[
+            eachClassName := eachClassNameAndAttributes.
+        ] ifFalse:[
+            eachClassName := eachClassNameAndAttributes 
+                firstIfEmpty:nil.
+        ].
+
+        (corruptedUnitTestClassNames includes:eachClassName) ifTrue:[
+            self 
+                logWarning:('corrupted unit test class detected, please fix #%1' 
+                    bindWith:eachClassName).
+        ] ifFalse:[
+            (excludedUnitTestClassNames includes:eachClassName) ifFalse:[
+                eachClassName notNil ifTrue:[
+                    eachClass := Smalltalk 
+                        fileInClass:eachClassName 
+                        package:'stx:goodies/regression'.
+
+                    eachClass notNil ifTrue:[
+                        eachClass isTestCaseLike ifTrue:[
+                            unitTestSuite addTest:eachClass suite.
+                        ].
+                    ].
+                ].
+            ].
+        ].
+    ].
+
+    self 
+        logInfo:('%1 unit test classes collected'
+            bindWith:unitTestSuite tests size).
+
+    self logInfo:'starting unit tests'.
+    result := unitTestSuite
+        run:TestResultStX new
+        beforeEachDo:[:test | self logInfo:'performing unit test ', test printString]
+        afterEachDo:[:test| ]
+        debug:(cmdArgs includes:'--debug').
+
+    self logInfo:'generating report'.
+    TestResultReporter
+        report:result
+        format:#xml_jUnit
+        as:'testresult.xml'.
+
+    self logInfo:'summary:'.
+    self logInfo:('%1 tests' bindWith:result runCount).
+    self logInfo:('%1 passed' bindWith:result passedCount).
+    self logInfo:('%1 failed' bindWith:result failureCount).
+    self logInfo:('%1 errors' bindWith:result errorCount).
+! !
+
+!RunUnitTests class methodsFor:'constants'!
+
+corruptedUnitTestClassNames
+    ^ #(
+        #'RegressionTests::ExternalInterfaceTests'
+        #'RegressionTests::Win32OLETests'
+        #'RegressionTests::HTTPServerTests'
+        #'RegressionTests::SocketTests'
+        #'RegressionTests::DelayTest'
+        #'RegressionTests::ContextTest2'
+        #'RegressionTests::DebuggerTest'
+        #'RegressionTests::OperatingSystem'
+    )
+!
+
+excludedUnitTestClassNamesForAll
+    ^ #()
+!
+
+excludedUnitTestClassNamesForExpecco 
+    ^ self excludedUnitTestClassNamesForAll
+        , #(
+
+        )
+! !
+
+!RunUnitTests class methodsFor:'logging'!
+
+log:aString
+    type:aType
+
+    Stdout 
+        showCR:('%1 [%2] : %3'
+            bindWith:Timestamp now printString
+            with:(aType printString asLowercase paddedTo:'warning' size)
+            with:aString).
+!
+
+logInfo:aString
+    self
+        log:aString
+        type:'INFO'
+!
+
+logWarning:aString
+    self
+        log:aString
+        type:'WARNING'
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/quickSelfTest/Start.st	Tue Mar 21 16:03:37 2017 +0100
@@ -0,0 +1,40 @@
+"
+	install a global handler, 
+	which suppresses the updating of the change file
+"	
+Processor activeProcess exceptionHandlerSet
+    on:(Class updateChangeFileQuerySignal)
+    do:[:ex | ex proceedWith:false ].
+
+	
+"
+	ensure that required packages are present
+"
+Smalltalk loadPackage:'stx:goodies/sunit'.
+(TestCase notNil and:[TestCase isLoaded]) ifFalse:[
+	Stdout showCR:'error: missing #TestCase class after sunit package load'.
+	Smalltalk exit:1.
+].
+
+Smalltalk 
+	fileInClass:#'stx_goodies_regression' 
+	package:'stx:goodies/regression'.
+(Smalltalk at:#'stx_goodies_regression') isNil ifTrue:[
+	Stdout showCR:'error: missing #stx_goodies_regression'.
+    Smalltalk exit:1.
+].
+
+'RunUnitTests.st' asFilename fileIn. 
+(Smalltalk at:#'RunUnitTests') isNil ifTrue:[
+	Stdout showCR:'error: missing #RunUnitTests'.
+    Smalltalk exit:1.
+].	
+	
+Smalltalk loadPackage:'stx:libcompat'.
+Smalltalk loadPackage:'stx:libjavascript'.
+
+
+"
+	run the unit tests
+"
+RunUnitTests run.
--- a/quickSelfTest/run.bat	Sat Mar 18 04:55:07 2017 +0000
+++ b/quickSelfTest/run.bat	Tue Mar 21 16:03:37 2017 +0100
@@ -1,1 +1,1 @@
-..\..\..\projects\smalltalk\stx -I --noInfoPrint --noBanner --abortOnInternalError --abortOnMessageSendError --ignoreHalt --execute SelfTest.st
+..\..\..\projects\smalltalk\stx -I --noInfoPrint --noBanner --abortOnInternalError --abortOnMessageSendError --ignoreHalt --execute Start.st
--- a/quickSelfTest/run.sh	Sat Mar 18 04:55:07 2017 +0000
+++ b/quickSelfTest/run.sh	Tue Mar 21 16:03:37 2017 +0100
@@ -1,4 +1,4 @@
 #!/bin/sh
 # use --debug as arg to debug failed test cases
 
-../../../projects/smalltalk/stx -I --noInfoPrint --noBanner --ignoreHalt --abortOnInternalError --abortOnMessageSendError $* --execute SelfTest.st
+../../../projects/smalltalk/stx -I --noInfoPrint --noBanner --ignoreHalt --abortOnInternalError --abortOnMessageSendError $* --execute Start.st