*** empty log message *** expecco_head_5844
authorsr
Tue, 21 Mar 2017 16:03:37 +0100
changeset 3306a3fe7cea4e1
parent 329 1bf7295a0b9a
child 331 44fde0482a1c
*** empty log message ***
quickSelfTest/README
quickSelfTest/RunUnitTests.st
quickSelfTest/Start.st
quickSelfTest/run.bat
quickSelfTest/run.sh
     1.1 --- a/quickSelfTest/README	Sat Mar 18 04:55:07 2017 +0000
     1.2 +++ b/quickSelfTest/README	Tue Mar 21 16:03:37 2017 +0100
     1.3 @@ -6,8 +6,17 @@
     1.4  or
     1.5      run.bat (windows)
     1.6  
     1.7 -executes the tests found in ~/exept/regression/*
     1.8 +executes the tests found in ~/stx/goodies/regression/*
     1.9  and generates a junit-xml compatible output file 'testresult.xml',
    1.10  (to be consumed by jenkins).
    1.11  
    1.12 -Also some metric info is written to 'metrics.xml'
    1.13 +the cmd script will start stx with Start.st
    1.14 +Start.st will prepare the stx environment required for the unit test.
    1.15 +For e.g. loading required packages.
    1.16 +
    1.17 +The last command of Start.st will file in RunUnitTest.st class and send #run.
    1.18 +The RunUnitTest class will perform all (or a subset when use the --runOnlyExpeccoUnitTests paramter) unit tests
    1.19 +and create the report file ""
    1.20 +
    1.21 +
    1.22 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/quickSelfTest/RunUnitTests.st	Tue Mar 21 16:03:37 2017 +0100
     2.3 @@ -0,0 +1,162 @@
     2.4 +'From Smalltalk/X, Version:7.1.0.0 on 21-03-2017 at 14:52:37'                   !
     2.5 +
     2.6 +"{ Package: 'stx:goodies/regression' }"
     2.7 +
     2.8 +"{ NameSpace: Smalltalk }"
     2.9 +
    2.10 +Object subclass:#RunUnitTests
    2.11 +	instanceVariableNames:''
    2.12 +	classVariableNames:''
    2.13 +	poolDictionaries:''
    2.14 +	category:'tests-Regression'
    2.15 +!
    2.16 +
    2.17 +!RunUnitTests class methodsFor:'documentation'!
    2.18 +
    2.19 +documentation
    2.20 +"
    2.21 +    documentation to be added.
    2.22 +
    2.23 +    [author:]
    2.24 +        sr
    2.25 +
    2.26 +    [instance variables:]
    2.27 +
    2.28 +    [class variables:]
    2.29 +
    2.30 +    [see also:]
    2.31 +
    2.32 +"
    2.33 +! !
    2.34 +
    2.35 +!RunUnitTests class methodsFor:'actions'!
    2.36 +
    2.37 +run
    2.38 +    |doRunSpecificUnitTests unitTestSuiteName excludedUnitTestClassNames corruptedUnitTestClassNames
    2.39 +     cmdArgs 
    2.40 +     unitTestSuite 
    2.41 +     eachClassName eachClass
    2.42 +     result|
    2.43 +
    2.44 +    doRunSpecificUnitTests := false.
    2.45 +    unitTestSuiteName := 'All Unit Tests'. 
    2.46 +    excludedUnitTestClassNames := self excludedUnitTestClassNamesForAll.
    2.47 +    corruptedUnitTestClassNames := self corruptedUnitTestClassNames.
    2.48 +
    2.49 +    cmdArgs := Smalltalk commandLineArguments.
    2.50 +    (cmdArgs includes:'--runOnlyExpeccoUnitTests') ifTrue:[
    2.51 +        self logInfo:'configured to run expecco unit tests only'.
    2.52 +        doRunSpecificUnitTests := true.
    2.53 +        unitTestSuiteName := 'expecco Unit Tests'. 
    2.54 +        excludedUnitTestClassNames := self excludedUnitTestClassNamesForExpecco.
    2.55 +    ].
    2.56 +
    2.57 +    doRunSpecificUnitTests ifFalse:[
    2.58 +        self logInfo:'configured to run all available unit tests'.
    2.59 +    ].
    2.60 +
    2.61 +    self logInfo:'collecting unit test classes to run'.
    2.62 +    unitTestSuite := TestSuite named:unitTestSuiteName.
    2.63 +    (Smalltalk at: #'stx_goodies_regression') classNamesAndAttributes do:[:eachClassNameAndAttributes |
    2.64 +        eachClassNameAndAttributes isSymbol ifTrue:[
    2.65 +            eachClassName := eachClassNameAndAttributes.
    2.66 +        ] ifFalse:[
    2.67 +            eachClassName := eachClassNameAndAttributes 
    2.68 +                firstIfEmpty:nil.
    2.69 +        ].
    2.70 +
    2.71 +        (corruptedUnitTestClassNames includes:eachClassName) ifTrue:[
    2.72 +            self 
    2.73 +                logWarning:('corrupted unit test class detected, please fix #%1' 
    2.74 +                    bindWith:eachClassName).
    2.75 +        ] ifFalse:[
    2.76 +            (excludedUnitTestClassNames includes:eachClassName) ifFalse:[
    2.77 +                eachClassName notNil ifTrue:[
    2.78 +                    eachClass := Smalltalk 
    2.79 +                        fileInClass:eachClassName 
    2.80 +                        package:'stx:goodies/regression'.
    2.81 +
    2.82 +                    eachClass notNil ifTrue:[
    2.83 +                        eachClass isTestCaseLike ifTrue:[
    2.84 +                            unitTestSuite addTest:eachClass suite.
    2.85 +                        ].
    2.86 +                    ].
    2.87 +                ].
    2.88 +            ].
    2.89 +        ].
    2.90 +    ].
    2.91 +
    2.92 +    self 
    2.93 +        logInfo:('%1 unit test classes collected'
    2.94 +            bindWith:unitTestSuite tests size).
    2.95 +
    2.96 +    self logInfo:'starting unit tests'.
    2.97 +    result := unitTestSuite
    2.98 +        run:TestResultStX new
    2.99 +        beforeEachDo:[:test | self logInfo:'performing unit test ', test printString]
   2.100 +        afterEachDo:[:test| ]
   2.101 +        debug:(cmdArgs includes:'--debug').
   2.102 +
   2.103 +    self logInfo:'generating report'.
   2.104 +    TestResultReporter
   2.105 +        report:result
   2.106 +        format:#xml_jUnit
   2.107 +        as:'testresult.xml'.
   2.108 +
   2.109 +    self logInfo:'summary:'.
   2.110 +    self logInfo:('%1 tests' bindWith:result runCount).
   2.111 +    self logInfo:('%1 passed' bindWith:result passedCount).
   2.112 +    self logInfo:('%1 failed' bindWith:result failureCount).
   2.113 +    self logInfo:('%1 errors' bindWith:result errorCount).
   2.114 +! !
   2.115 +
   2.116 +!RunUnitTests class methodsFor:'constants'!
   2.117 +
   2.118 +corruptedUnitTestClassNames
   2.119 +    ^ #(
   2.120 +        #'RegressionTests::ExternalInterfaceTests'
   2.121 +        #'RegressionTests::Win32OLETests'
   2.122 +        #'RegressionTests::HTTPServerTests'
   2.123 +        #'RegressionTests::SocketTests'
   2.124 +        #'RegressionTests::DelayTest'
   2.125 +        #'RegressionTests::ContextTest2'
   2.126 +        #'RegressionTests::DebuggerTest'
   2.127 +        #'RegressionTests::OperatingSystem'
   2.128 +    )
   2.129 +!
   2.130 +
   2.131 +excludedUnitTestClassNamesForAll
   2.132 +    ^ #()
   2.133 +!
   2.134 +
   2.135 +excludedUnitTestClassNamesForExpecco 
   2.136 +    ^ self excludedUnitTestClassNamesForAll
   2.137 +        , #(
   2.138 +
   2.139 +        )
   2.140 +! !
   2.141 +
   2.142 +!RunUnitTests class methodsFor:'logging'!
   2.143 +
   2.144 +log:aString
   2.145 +    type:aType
   2.146 +
   2.147 +    Stdout 
   2.148 +        showCR:('%1 [%2] : %3'
   2.149 +            bindWith:Timestamp now printString
   2.150 +            with:(aType printString asLowercase paddedTo:'warning' size)
   2.151 +            with:aString).
   2.152 +!
   2.153 +
   2.154 +logInfo:aString
   2.155 +    self
   2.156 +        log:aString
   2.157 +        type:'INFO'
   2.158 +!
   2.159 +
   2.160 +logWarning:aString
   2.161 +    self
   2.162 +        log:aString
   2.163 +        type:'WARNING'
   2.164 +! !
   2.165 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/quickSelfTest/Start.st	Tue Mar 21 16:03:37 2017 +0100
     3.3 @@ -0,0 +1,40 @@
     3.4 +"
     3.5 +	install a global handler, 
     3.6 +	which suppresses the updating of the change file
     3.7 +"	
     3.8 +Processor activeProcess exceptionHandlerSet
     3.9 +    on:(Class updateChangeFileQuerySignal)
    3.10 +    do:[:ex | ex proceedWith:false ].
    3.11 +
    3.12 +	
    3.13 +"
    3.14 +	ensure that required packages are present
    3.15 +"
    3.16 +Smalltalk loadPackage:'stx:goodies/sunit'.
    3.17 +(TestCase notNil and:[TestCase isLoaded]) ifFalse:[
    3.18 +	Stdout showCR:'error: missing #TestCase class after sunit package load'.
    3.19 +	Smalltalk exit:1.
    3.20 +].
    3.21 +
    3.22 +Smalltalk 
    3.23 +	fileInClass:#'stx_goodies_regression' 
    3.24 +	package:'stx:goodies/regression'.
    3.25 +(Smalltalk at:#'stx_goodies_regression') isNil ifTrue:[
    3.26 +	Stdout showCR:'error: missing #stx_goodies_regression'.
    3.27 +    Smalltalk exit:1.
    3.28 +].
    3.29 +
    3.30 +'RunUnitTests.st' asFilename fileIn. 
    3.31 +(Smalltalk at:#'RunUnitTests') isNil ifTrue:[
    3.32 +	Stdout showCR:'error: missing #RunUnitTests'.
    3.33 +    Smalltalk exit:1.
    3.34 +].	
    3.35 +	
    3.36 +Smalltalk loadPackage:'stx:libcompat'.
    3.37 +Smalltalk loadPackage:'stx:libjavascript'.
    3.38 +
    3.39 +
    3.40 +"
    3.41 +	run the unit tests
    3.42 +"
    3.43 +RunUnitTests run.
     4.1 --- a/quickSelfTest/run.bat	Sat Mar 18 04:55:07 2017 +0000
     4.2 +++ b/quickSelfTest/run.bat	Tue Mar 21 16:03:37 2017 +0100
     4.3 @@ -1,1 +1,1 @@
     4.4 -..\..\..\projects\smalltalk\stx -I --noInfoPrint --noBanner --abortOnInternalError --abortOnMessageSendError --ignoreHalt --execute SelfTest.st
     4.5 +..\..\..\projects\smalltalk\stx -I --noInfoPrint --noBanner --abortOnInternalError --abortOnMessageSendError --ignoreHalt --execute Start.st
     5.1 --- a/quickSelfTest/run.sh	Sat Mar 18 04:55:07 2017 +0000
     5.2 +++ b/quickSelfTest/run.sh	Tue Mar 21 16:03:37 2017 +0100
     5.3 @@ -1,4 +1,4 @@
     5.4  #!/bin/sh
     5.5  # use --debug as arg to debug failed test cases
     5.6  
     5.7 -../../../projects/smalltalk/stx -I --noInfoPrint --noBanner --ignoreHalt --abortOnInternalError --abortOnMessageSendError $* --execute SelfTest.st
     5.8 +../../../projects/smalltalk/stx -I --noInfoPrint --noBanner --ignoreHalt --abortOnInternalError --abortOnMessageSendError $* --execute Start.st