Skip to content

Commit

Permalink
Fix coverage ignore support for Pharo (#442)
Browse files Browse the repository at this point in the history
* Fix #441 Use #refersToLiteral: method in Pharo to discover methods including the <ignoreForCoverage> pragma

* Fix #441 Use #refersToLiteral: method in Pharo to discover methods including the <ignoreForCoverage> pragma

* Revert redundant metadata changes

* Adapt the baseline to exclude coverage support in Pharo 3/4

* Attempt to fix deprecationWarning

* Fix baseline for old Pharo versions

* Fix Pharo 3 & 4 stack overflow during testing phase

* Fixed Pharo 3 & 4 coverage
  • Loading branch information
gcotelli authored and fniephaus committed Oct 7, 2019
1 parent 8410c54 commit 4b2483d
Show file tree
Hide file tree
Showing 79 changed files with 296 additions and 131 deletions.
3 changes: 3 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
'srcDirectory' : 'repository'
}
3 changes: 3 additions & 0 deletions repository/.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
#format : #filetree
}
Original file line number Diff line number Diff line change
@@ -1,81 +1,21 @@
baseline
baseline: spec

<baseline>
spec
for: #'common'
do: [
spec
for: #common
do: [ spec
package: 'SmalltalkCI-Core';
package: 'SmalltalkCI-Excluded-Tests';
package: 'SmalltalkCI-Tests'
with: [ spec requires: #('SmalltalkCI-Core' 'SmalltalkCI-Excluded-Tests') ];
yourself.
with: [ spec requires: #('SmalltalkCI-Core' 'SmalltalkCI-Excluded-Tests') ].
spec
group: 'default' with: #('SmalltalkCI-Core');
group: 'Core' with: 'default'; "kept for GsDevKit compatibility"
group: 'tests' with: #('SmalltalkCI-Tests');
yourself ].
spec
for: #'squeakCommon'
do: [
spec
package: 'SmalltalkCI-Coverage-Core'
with: [ spec requires: #('SmalltalkCI-Core') ];
package: 'SmalltalkCI-Coverage-Tests'
with: [ spec requires: #('SmalltalkCI-Tests' 'SmalltalkCI-Coverage-Core') ];
yourself ].
spec
for: #'squeak'
do: [
spec
package: 'STON-Core';
package: 'STON-Tests';
package: 'SmalltalkCI-Core'
with: [
spec
requires: #('STON-Core');
includes: #('SmalltalkCI-Squeak-Core') ];
package: 'SmalltalkCI-Squeak-Core'
with: [ spec requires: #('SmalltalkCI-Core' 'SmalltalkCI-Coverage-Core') ];
package: 'SmalltalkCI-Squeak-Tests'
with: [ spec requires: #('SmalltalkCI-Squeak-Core') ];
yourself.
spec group: 'tests' with: #('SmalltalkCI-Squeak-Tests' 'SmalltalkCI-Coverage-Tests' 'STON-Tests') ].

spec
for: #(#'pharo3.x' #'pharo4.x')
do: [ spec
configuration: 'Ston'
with: [ spec
version: #stable;
loads: #('Core');
repository: 'http://smalltalkhub.com/mc/SvenVanCaekenberghe/STON/main' ].
spec
package: 'SmalltalkCI-Core'
with: [ spec
requires: #('Ston');
includes: #('Ston') ] ].

spec
for: #'pharo'
do: [
spec
package: 'SmalltalkCI-Core'
with: [ spec includes: #('SmalltalkCI-Pharo-Core') ];
package: 'SmalltalkCI-Pharo-Core'
with: [ spec requires: #('SmalltalkCI-Core' 'SmalltalkCI-Coverage-Core') ];
package: 'SmalltalkCI-Pharo-Tests'
with: [ spec requires: #('SmalltalkCI-Pharo-Core') ].
spec group: 'tests' with: #('SmalltalkCI-Pharo-Tests' 'SmalltalkCI-Coverage-Tests') ].
spec
for: #'gemstone'
do: [
spec
package: 'SmalltalkCI-Core'
with: [ spec includes: #('SmalltalkCI-GemStone-Core') ];
package: 'SmalltalkCI-GemStone-Core'
with: [ spec requires: #('SmalltalkCI-Core') ];
package: 'SmalltalkCI-GemStone-Tests'
with: [ spec requires: 'SmalltalkCI-GemStone-Core' ];
yourself.
spec group: 'tests' with: #('SmalltalkCI-GemStone-Tests') ]
yourself
].
self setUpSqueakPackages: spec.
self setUpPharo3And4Packages: spec.
self setUpPharo5AndGreaterPackages: spec.
self setUpGemStonePackages: spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
baseline
setUpGemStonePackages: spec

spec
for: #gemstone
do: [ spec
package: 'SmalltalkCI-Core' with: [ spec includes: #('SmalltalkCI-GemStone-Core') ];
package: 'SmalltalkCI-GemStone-Core' with: [ spec requires: #('SmalltalkCI-Core') ];
package: 'SmalltalkCI-GemStone-Tests' with: [ spec requires: 'SmalltalkCI-GemStone-Core' ].
spec group: 'tests' with: #('SmalltalkCI-GemStone-Tests')
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
baseline
setUpPharo3And4Packages: spec

spec
for: #(#'pharo3.x' #'pharo4.x')
do: [ spec
configuration: 'Ston'
with: [ spec
version: #stable;
loads: #('Core');
repository: 'http://smalltalkhub.com/mc/SvenVanCaekenberghe/STON/main'
].
spec
package: 'SmalltalkCI-Core'
with: [ spec
requires: #('Ston');
includes: #('Ston')
].
spec
package: 'SmalltalkCI-Core' with: [ spec includes: #('SmalltalkCI-Pharo-Core') ];
package: 'SmalltalkCI-Pharo-Core'
with: [ spec requires: #('SmalltalkCI-Core' 'SmalltalkCI-Coverage-Core') ];
package: 'SmalltalkCI-Pharo-Tests' with: [ spec requires: #('SmalltalkCI-Pharo-Core') ].
spec group: 'tests' with: #('SmalltalkCI-Pharo-Tests' 'SmalltalkCI-Coverage-Tests')
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
baseline
setUpPharo5AndGreaterPackages: spec

spec
for: #(#'pharo5.x' #'pharo6.x' #'pharo7.x' #'pharo8.x')
do: [ spec
package: 'SmalltalkCI-Core' with: [ spec includes: #('SmalltalkCI-Pharo-Core') ];
package: 'SmalltalkCI-Pharo-Core' with: [ spec requires: 'SmalltalkCI-Core' ];
package: 'SmalltalkCI-Pharo-Tests' with: [ spec requires: #('SmalltalkCI-Pharo-Core') ].
spec group: 'tests' with: #('SmalltalkCI-Pharo-Tests' 'SmalltalkCI-Coverage-Tests').
spec
package: 'SmalltalkCI-Pharo-Coverage-Core'
with: [ spec requires: #('SmalltalkCI-Coverage-Core' 'SmalltalkCI-Pharo-Core') ];
group: 'default' with: 'SmalltalkCI-Pharo-Coverage-Core'.
spec
package: 'SmalltalkCI-Pharo-Coverage-Tests'
with: [ spec requires: 'SmalltalkCI-Pharo-Coverage-Core' ];
group: 'tests' with: 'SmalltalkCI-Pharo-Coverage-Tests'
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
baseline
setUpSqueakPackages: spec

spec
for: #squeakCommon
do: [ spec
package: 'SmalltalkCI-Coverage-Core' with: [ spec requires: #('SmalltalkCI-Core') ];
package: 'SmalltalkCI-Coverage-Tests'
with: [ spec requires: #('SmalltalkCI-Tests' 'SmalltalkCI-Coverage-Core') ];
yourself
].
spec
for: #squeak
do: [ spec
package: 'STON-Core';
package: 'STON-Tests';
package: 'SmalltalkCI-Core'
with: [ spec
requires: #('STON-Core');
includes: #('SmalltalkCI-Squeak-Core')
];
package: 'SmalltalkCI-Squeak-Core'
with: [ spec requires: #('SmalltalkCI-Core' 'SmalltalkCI-Coverage-Core') ];
package: 'SmalltalkCI-Squeak-Tests' with: [ spec requires: #('SmalltalkCI-Squeak-Core') ].
spec group: 'tests' with: #('SmalltalkCI-Squeak-Tests' 'SmalltalkCI-Coverage-Tests' 'STON-Tests')
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"class" : {
},
"instance" : {
"baseline:" : "jecisc 05/28/2019 13:17" } }
"setUpSqueakPackages:" : "GOC 10/3/2019 09:36",
"setUpPharo3And4Packages:" : "GOC 10/3/2019 11:30",
"setUpGemStonePackages:" : "GOC 10/3/2019 09:36",
"setUpPharo5AndGreaterPackages:" : "GOC 10/3/2019 11:30",
"baseline:" : "GOC 10/3/2019 11:30"
},
"class" : { }
}
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
(name 'BaselineOfSmalltalkCI-fn.17' message 'Load STON only in Pharo 3 and 4.Fixes #418' id '36b86c20-bfda-4ddd-97a2-072b5adc482f' date '2 June 2019' time '4:31:57.899 pm' author 'fn' ancestors ((name 'BaselineOfSmalltalkCI-fn.16' message 'Add SmalltalkCI-CodeCoverage packages' id '1d751ad3-218c-4901-a558-912c972e09fa' date '22 November 2017' time '5:09:31.549 pm' author 'fn' ancestors ((name 'BaselineOfSmalltalkCI-fn.15' message 'Update and clean up baseline' id 'af21778b-433e-4fa3-9b95-db2fe1ec7787' date '22 November 2017' time '3:00:00.139 pm' author 'fn' ancestors ((name 'BaselineOfSmalltalkCI-fn.14' message 'Tests require Core' id '4882b7e5-3854-4177-ad63-c36b4f0901f3' date '9 July 2017' time '1:29:50.823 am' author 'fn' ancestors ((name 'BaselineOfSmalltalkCI-fn.13' message 'Remove WebClient dependency again' id '94853b56-1758-4b34-8e38-4f30487ee83f' date '8 October 2016' time '5:47:34.375 pm' author 'fn' ancestors ((name 'BaselineOfSmalltalkCI-fn.12' message 'Add WebClient dependency' id '3ecfcac6-7857-4362-9bf8-1ba73f3b2dbb' date '8 October 2016' time '5:39:45.204 pm' author 'fn' ancestors ((name 'BaselineOfSmalltalkCI-fn.11' message 'Update baseline after restructuring packages' id '51f2c8aa-c47e-4909-a412-8a45a97a2a22' date '22 June 2016' time '12:50:09.923 am' author 'fn' ancestors ((name 'BaselineOfSmalltalkCI-fn.10' message 'Adjust after renaming GemStone-specific packages' id 'aa9fcd68-086c-43d7-9579-261a1225eb83' date '13 June 2016' time '9:55:55.954 am' author 'fn' ancestors ((name 'BaselineOfSmalltalkCI-fn.9' message 'Update baseline after splitting SmalltalkCI-Pharo into two packages' id 'd46c1fc2-c3be-41af-a93b-3d9bc85b54b5' date '15 April 2016' time '11:42:41.978 pm' author 'fn' ancestors ((name 'BaselineOfSmalltalkCI-fn.8' message 'Update baseline after splitting SmalltalkCI-Squeak into two packages' id '75834ab5-c4be-4930-ab74-55d52f3873b4' date '15 April 2016' time '11:12:08.898 pm' author 'fn' ancestors ((name 'BaselineOfSmalltalkCI-fn.7' message 'Merge tests into one baseline' id '89c9d6ff-286f-4dd2-8ac6-ee42c6cd0ae9' date '15 April 2016' time '5:04:47.233 pm' author 'fn' ancestors ((name 'BaselineOfSmalltalkCI-dkh.6' message '#109 tweak the STON reference from the baseline for Pharo a bit ' id '27db0cf5-16f4-4ef1-89e7-21d7505ad7c0' date '3 April 2016' time '11:57:04 am' author 'dkh' ancestors ((name 'BaselineOfSmalltalkCI-dkh.5' message '#108 first cut at fix for this issue' id 'ebc278d9-ed5c-47cd-9809-13db868abcc4' date '3 April 2016' time '10:35:58 am' author 'dkh' ancestors ((name 'BaselineOfSmalltalkCI-dkh.4' message 'remove the SmalltalkCI-Report package from the baseline' id '919faf31-cf32-4f17-8bd5-bb4459f990f8' date '23 February 2016' time '7:12:25 pm' author 'dkh' ancestors ((name 'BaselineOfSmalltalkCI-dkh.3' message 'PR #51: merge the pharo/squeak BaselineOfSmalltalkCI into the gemstone variant... ' id '91444a03-00df-4abd-a259-121d87a8dc8d' date '23 February 2016' time '6:47:08 am' author 'dkh' ancestors ((name 'BaselineOfSmalltalkCI-TravisCI.2' message 'Issue #48: add SmalltalkCI-Report without porting ...' id 'cc69f0b7-c00a-46d7-8bc1-446a71f4e764' date '4 February 2016' time '4:48:18 pm' author 'TravisCI' ancestors ((name 'BaselineOfSmalltalkCI-dkh.1' message 'initial configuration' id 'd88909e6-d8b8-46c7-b261-09ff40d9be8b' date '4 February 2016' time '12:04:36 pm' author 'dkh' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())
(name 'BaselineOfSmalltalkCI-GOC.1570035213' message 'Fixed baseline groups for old Pharo versions' id 'eac68a31-6450-0d00-8dc2-d01f04c51116' date '3 October 2019' time '11:32:35.36883 am' author 'GOC' ancestors ((name 'BaselineOfSmalltalkCI-GOC.1570035212' message 'Adapt the baseline to exclude coverage support in Pharo 3/4' id '13b839a0-6250-0d00-8dba-57f104c51116' date '3 October 2019' time '9:40:22.393 am' author 'GOC' ancestors ((name 'BaselineOfSmalltalkCI-CompatibleUserName.1570035211' message 'Fix #441 Use #refersToLiteral: method in Pharo to discover methods including the <ignoreForCoverage> pragma
' id 'e397852c-1033-5d7e-b774-5439f09e1d87' date '2 October 2019' time '1:53:31 pm' author 'CompatibleUserName' ancestors () stepChildren ())) stepChildren ())) stepChildren ())
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
compatibility
coverallsBuildData

| reference |

reference := self coverallsBuildDataFilename asFileReference.
[ ^ reference readStreamDo: [ :stream | STON fromStream: stream ] ]
on: STONReaderError
do: [ :error |
error messageText: 'Cannot read ' , self coverallsBuildDataFilename , '.'.
error signal
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coveralls
coverallsBuildDataFilename

^ self coverallsFilesDirectory / 'coveralls_build_data.json'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coveralls
coverallsFilesDirectory

^ ( SmalltalkCI getEnv: 'SMALLTALK_CI_BUILD' ) asFileReference
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coveralls
coverallsResultFilename

^ self coverallsFilesDirectory / 'coveralls_results.json'
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
compatibility
linesOf: aFilePath

| fr loc |

fr := aFilePath asFileReference readStream.
loc := fr contents lineCount.
fr close.
^ loc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
compatibility
md5Of: aFilePath

| fr loc |

fr := aFilePath asFileReference readStream.
loc := ( MD5 hashMessage: fr contents ) hex.
fr close.
^ loc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
compatibility
methodReferenceFor: aClass selector: aSelector

^ ( Smalltalk at: #RGMethodDefinition ) realClass: aClass selector: aSelector
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
compatibility
packageNameForClass: aClass

^ ( ( Smalltalk at: #RPackageOrganizer ) default packageOf: aClass ) packageName
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
allClassesToCover

^ allClassesToCover
ifNil: [ allClassesToCover := ( super allClassesToCover reject: #isTrait ) asArray ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"instance" : {
"allClassesToCover" : "GOC 10/3/2019 12:33"
},
"class" : {
"md5Of:" : "GOC 10/3/2019 12:33",
"coverallsBuildDataFilename" : "GOC 10/3/2019 12:33",
"methodReferenceFor:selector:" : "GOC 10/3/2019 12:33",
"coverallsResultFilename" : "GOC 10/3/2019 12:33",
"linesOf:" : "GOC 10/3/2019 12:33",
"coverallsBuildData" : "GOC 10/3/2019 12:33",
"packageNameForClass:" : "GOC 10/3/2019 12:33",
"coverallsFilesDirectory" : "GOC 10/3/2019 12:33"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"commentStamp" : "",
"super" : "SCICodeCoverage",
"category" : "SmalltalkCI-Pharo-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"allClassesToCover"
],
"name" : "SCIPharo34CodeCoverage",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
helpers
deprecationWarning
| ctx |
ctx := thisContext sender sender. "First sender is SmalltalkCI>>deprecated"
(thisContext sender method methodClass == SCICoverageWrapper)
ifTrue: [ ctx := ctx sender sender "Skip additional SCICoverageWrapper senders" ].

| ctx sender |

"First sender is SmalltalkCI>>deprecated"
ctx := thisContext sender sender.
"Skip additional SCICoverageWrapper senders"
sender := thisContext sender.
Smalltalk
at: #SCICoverageWrapper
ifPresent: [ :coverageWrapperClass |
sender method methodClass == coverageWrapperClass
ifTrue: [ ctx := ctx sender sender ]
].
^ ctx asString
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"class" : {
"methodDictOf:" : "fn 10/4/2016 17:25",
"forceNewFileNamed:do:" : "fn 11/21/2017 11:55",
"codeCoverageClass" : "fn 10/8/2016 14:57",
"platformNameBeginsWith:" : "fn 12/5/2018 20:26",
"getEnv:" : "fn 10/9/2016 21:32",
"getAuthor" : "fn 6/13/2016 13:49",
"readOnlyFileNamed:do:" : "fn 11/20/2017 13:31",
"saveImage" : "fn 10/4/2016 16:34",
"imagePath" : "fn 9/27/2016 20:13",
"isHeadless" : "fn 1/27/2016 17:04",
"deprecationWarning" : "fn 3/26/2018 14:57",
"deprecationWarning" : "GOC 10/3/2019 10:26",
"workingDirectory" : "fn 10/16/2016 16:28",
"testRunnerClass" : "fn 10/4/2016 17:21",
"stdout" : "fn 3/13/2017 17:05",
Expand All @@ -32,8 +32,7 @@
"classesInPackage:" : "fn 11/23/2016 11:33",
"isPlatformCompatible" : "GuillermoPolito 10/6/2017 11:58",
"stringFor:maxDecimalPlaces:" : "fn 9/28/2016 11:48",
"pathNameDelimiter" : "fn 6/25/2016 00:21",
"platformSymbol" : "EstebanLorenzano 1/26/2016 17:36",
"platformNameBeginsWith:" : "fn 12/5/2018 20:26"
"pathNameDelimiter" : "fn 6/25/2016 00:21"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
compatibility
codeCoverageClass

^ SCIPharo34CodeCoverage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
compatibility
isPlatformCompatible

^ ( self platformNameBeginsWith: 'Pharo3' ) or: [ self platformNameBeginsWith: 'Pharo4' ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"instance" : { },
"class" : {
"isPlatformCompatible" : "GOC 10/3/2019 12:14",
"codeCoverageClass" : "GOC 10/3/2019 12:29"
}
}
Loading

0 comments on commit 4b2483d

Please sign in to comment.