--- a/reports/Builder__CoverageReport.st Mon Jun 28 13:41:53 2021 +0100
+++ b/reports/Builder__CoverageReport.st Fri Dec 03 13:24:20 2021 +0000
@@ -1,3 +1,6 @@
+"
+COPYRIGHT (c) 2021 LabWare
+"
"{ Package: 'stx:goodies/builder/reports' }"
"{ NameSpace: Builder }"
@@ -9,6 +12,14 @@
category:'Builder-Reports'
!
+!CoverageReport class methodsFor:'documentation'!
+
+copyright
+"
+COPYRIGHT (c) 2021 LabWare
+
+"
+! !
!CoverageReport methodsFor:'accessing-defaults'!
@@ -178,7 +189,10 @@
format write: instrumentedMethods.
+ ^ 0 "return exit code"
+
"Modified: / 25-06-2013 / 13:13:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-12-2021 / 13:10:05 / Jan Vrany <jan.vrany@labware.com>"
! !
!CoverageReport class methodsFor:'documentation'!
@@ -191,6 +205,11 @@
^ '$Header$'
!
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+!
+
version_SVN
^ '$Id$'
! !
--- a/reports/Builder__LintReport.st Mon Jun 28 13:41:53 2021 +0100
+++ b/reports/Builder__LintReport.st Fri Dec 03 13:24:20 2021 +0000
@@ -1,3 +1,6 @@
+"
+COPYRIGHT (c) 2021 LabWare
+"
"{ Package: 'stx:goodies/builder/reports' }"
"{ NameSpace: Builder }"
@@ -9,6 +12,14 @@
category:'Builder-Reports'
!
+!LintReport class methodsFor:'documentation'!
+
+copyright
+"
+COPYRIGHT (c) 2021 LabWare
+
+"
+! !
!LintReport methodsFor:'accessing - defaults'!
@@ -292,9 +303,12 @@
].
] ensure:[
Class tryLocalSourceFirst: wasTryLocalSources
- ]
+ ].
+
+ ^ 0 "return exit code"
"Modified: / 15-12-2014 / 11:06:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 03-12-2021 / 13:09:59 / Jan Vrany <jan.vrany@labware.com>"
!
setUp
--- a/reports/Builder__Report.st Mon Jun 28 13:41:53 2021 +0100
+++ b/reports/Builder__Report.st Fri Dec 03 13:24:20 2021 +0000
@@ -1,3 +1,6 @@
+"
+COPYRIGHT (c) 2021 LabWare
+"
"{ Package: 'stx:goodies/builder/reports' }"
"{ NameSpace: Builder }"
@@ -9,6 +12,14 @@
category:'Builder-Reports'
!
+!Report class methodsFor:'documentation'!
+
+copyright
+"
+COPYRIGHT (c) 2021 LabWare
+
+"
+! !
!Report class methodsFor:'initialization'!
@@ -296,9 +307,7 @@
!
loadPackageIfNotAlready: pkg
- "Loads a package, if it is not loaded already.
- Raises an error if package cannot be loaded"
-
+ "Loads a package, if it is not loaded already."
| def |
def := ProjectDefinition definitionClassForPackage:pkg.
def isNil ifTrue:[
@@ -307,9 +316,6 @@
].
def := ProjectDefinition definitionClassForPackage:pkg.
].
- def isNil ifTrue:[
- self error:'Package loaded but project definition not found: ', pkg.
- ].
"Created: / 13-01-2012 / 12:56:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
@@ -317,15 +323,20 @@
!Report methodsFor:'running'!
run
+ | status |
self setUp.
format writeHeader.
- [ self runReport ] ensure:[
+ [
+ status := self runReport
+ ] ensure:[
format writeFooter.
self tearDown.
- ]
+ ].
+ ^ status "return exit code"
"Modified: / 04-08-2011 / 12:42:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-12-2021 / 13:12:26 / Jan Vrany <jan.vrany@labware.com>"
!
runClasses:classes named:aString
@@ -360,11 +371,17 @@
runReport
"Actually run the report. What to do (what classes/packages to check)
- must be stored instance variables"
+ must be stored instance variables before calling this method.
+
+ Return an exit code (a zero when everything went fine, non-zero
+ in case of some erorr, failure). This exit code is used as program
+ exit code when running from command line.
+ "
^ self subclassResponsibility
"Created: / 04-08-2011 / 12:39:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 03-12-2021 / 13:09:31 / Jan Vrany <jan.vrany@labware.com>"
!
setUp
--- a/reports/Builder__ReportRunner.st Mon Jun 28 13:41:53 2021 +0100
+++ b/reports/Builder__ReportRunner.st Fri Dec 03 13:24:20 2021 +0000
@@ -1,3 +1,6 @@
+"
+COPYRIGHT (c) 2021 LabWare
+"
"{ Package: 'stx:goodies/builder/reports' }"
"{ NameSpace: Builder }"
@@ -19,6 +22,14 @@
"
!
+!ReportRunner class methodsFor:'documentation'!
+
+copyright
+"
+COPYRIGHT (c) 2021 LabWare
+
+"
+! !
!ReportRunner class methodsFor:'initialization'!
@@ -392,7 +403,7 @@
main:argv0
"Process command line arguments"
- | argv |
+ | argv status |
argv := argv0 asOrderedCollection.
argv isEmpty ifTrue:[
@@ -409,7 +420,7 @@
debugging ifFalse:[
ex suspendedContext fullPrintAllOn: Stderr.
Stderr nextPutLine:'Exiting'.
- Smalltalk exit:1.
+ Smalltalk exit:2.
] ifTrue:[
ex pass
]
@@ -423,12 +434,12 @@
setup notNil ifTrue:[Compiler evaluate: setup].
[
report ident: ident.
- report run.
+ status := report run.
] ensure:[
teardown notNil ifTrue:[Compiler evaluate: teardown].
].
debugging ifFalse:[
- Smalltalk exit:0.
+ Smalltalk exit: status.
].
] on: Error do:[:ex|
Stderr nextPutAll:'Error when running tests: '.
@@ -437,13 +448,14 @@
debugging ifFalse:[
- Smalltalk exit:1.
+ Smalltalk exit:3.
] ifTrue:[
ex pass
]
]
"Modified: / 27-05-2014 / 17:05:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-12-2021 / 13:14:00 / Jan Vrany <jan.vrany@labware.com>"
! !
!ReportRunner class methodsFor:'documentation'!
--- a/reports/Builder__TestReport.st Mon Jun 28 13:41:53 2021 +0100
+++ b/reports/Builder__TestReport.st Fri Dec 03 13:24:20 2021 +0000
@@ -1,9 +1,13 @@
+"
+COPYRIGHT (c) 2021 LabWare
+"
"{ Package: 'stx:goodies/builder/reports' }"
"{ NameSpace: Builder }"
Report subclass:#TestReport
- instanceVariableNames:'suite coverage instrument keepStdout keepBytecode'
+ instanceVariableNames:'suite coverage instrument keepStdout keepBytecode failOnFailure
+ failOnError'
classVariableNames:''
poolDictionaries:''
category:'Builder-Reports'
@@ -17,6 +21,14 @@
privateIn:TestReport
!
+!TestReport class methodsFor:'documentation'!
+
+copyright
+"
+COPYRIGHT (c) 2021 LabWare
+
+"
+! !
!TestReport methodsFor:'accessing'!
@@ -93,11 +105,33 @@
^CmdLineOption new
long: 'drop-stdout';
description: 'Do not include stdout in report';
- action:[
- keepStdout := false
- ]
+ action:[ keepStdout := false ];
+ yourself
"Created: / 08-08-2014 / 11:48:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-12-2021 / 13:18:13 / Jan Vrany <jan.vrany@labware.com>"
+!
+
+cmdlineOptionFailOnError
+
+ ^CmdLineOption new
+ long: 'fail-on-error';
+ description: 'Exit with error code 1 if there is a test error (test failures are ignored)';
+ action:[ failOnError := true ];
+ yourself
+
+ "Created: / 03-12-2021 / 13:21:28 / Jan Vrany <jan.vrany@labware.com>"
+!
+
+cmdlineOptionFailOnFailure
+
+ ^CmdLineOption new
+ long: 'fail-on-failure';
+ description: 'Exit with error code 1 if there is a test error or failure';
+ action:[ failOnFailure := true ];
+ yourself
+
+ "Created: / 03-12-2021 / 13:20:38 / Jan Vrany <jan.vrany@labware.com>"
!
cmdlineOptionInstrument
@@ -151,8 +185,11 @@
suite := TestSuite new.
coverage := nil.
keepStdout := true.
+ failOnError := false.
+ failOnFailure := false.
"Modified: / 08-08-2014 / 11:45:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-12-2021 / 13:21:50 / Jan Vrany <jan.vrany@labware.com>"
!
setupForClasses:classes
@@ -276,8 +313,13 @@
(t1 - t0) printOn: Transcript.
Transcript cr.
+ (failOnFailure and: [ result hasFailuresOrErrors ]) ifTrue: [ ^ 1 ].
+ (failOnError and: [ result hasErrors ]) ifTrue: [ ^ 1 ].
+ ^ 0
+
"Created: / 04-08-2011 / 12:39:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 23-02-2017 / 12:47:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-12-2021 / 13:23:16 / Jan Vrany <jan.vrany@labware.com>"
! !
!TestReport::Result methodsFor:'accessing'!