From f82a33428898b5c76e55f9c1f19507539810568f Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Thu, 8 Jun 2023 11:13:02 +0200 Subject: [PATCH 1/2] Bring back coverage test One coverage tests has been disabled after failing randomly on the CI. The problems comes from some VM optimizations on the VM. In linux, special selectors are running in the interpreter so the messages Point >> #x and Point >> #y are never executed. In OSX, the method is compiled to machine code and the messages are sent. To have a more robust test, I excluded the special selectors from the list of methods to cover --- src/Coverage/CoverageCollectorTest.class.st | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Coverage/CoverageCollectorTest.class.st b/src/Coverage/CoverageCollectorTest.class.st index 675b430fb87..985434f3706 100644 --- a/src/Coverage/CoverageCollectorTest.class.st +++ b/src/Coverage/CoverageCollectorTest.class.st @@ -91,10 +91,15 @@ CoverageCollectorTest >> testExample [ | collector coverage | collector := CoverageCollector new. "Instantiate" - collector methods: Point methods, Rectangle methods. "Configure with the methods to watch." - coverage := collector runOn: [ (1@1 corner: 2@2) center ]. "Setup, execute and teardown." - self assert: (coverage methods includes: Point>>#x). "Inspect the results" - self assert: (coverage nodes size > 10). "Covered paths are also available" + "We skip the method with special selectors because them might not be detected by the coverage collector in case they are optimized by the VM." + collector methods: (Point methods , Rectangle methods reject: [ :method | BytecodeEncoder specialSelectors includes: method selector ]). "Configure with the methods to watch." + coverage := collector runOn: [ (1 @ 1 corner: 2 @ 2) center ]. "Setup, execute and teardown." + self + assertCollection: (coverage methods collect: [ :method | method name ]) + hasSameElements: + #( 'Point>>#corner:' 'Point>>#isPoint' 'Rectangle>>#setPoint:point:' 'Rectangle>>#topLeft' + 'Rectangle>>#bottomRight' 'Rectangle>>#center' ). "Inspect the results" + self assert: coverage nodes size equals: 6 "Covered paths are also available" ] { #category : #tests } From 3fc8a2293efce514bff159c93fb45442dd403faa Mon Sep 17 00:00:00 2001 From: palumbon Date: Wed, 2 Aug 2023 13:44:43 +0200 Subject: [PATCH 2/2] Mark some longTestCase --- src/Announcements-Core-Tests/WeakAnnouncerTest.class.st | 6 ------ src/Fuel-Tests-Core/FLCreateClassSerializationTest.class.st | 2 ++ .../FLTCreateClassOrTraitSerializationTest.trait.st | 2 ++ src/SUnit-Core/TestCase.class.st | 6 ++++++ .../SystemDependenciesTest.class.st | 6 ------ 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/Announcements-Core-Tests/WeakAnnouncerTest.class.st b/src/Announcements-Core-Tests/WeakAnnouncerTest.class.st index 615106743fb..3c6cf26b1c7 100644 --- a/src/Announcements-Core-Tests/WeakAnnouncerTest.class.st +++ b/src/Announcements-Core-Tests/WeakAnnouncerTest.class.st @@ -57,12 +57,6 @@ WeakAnnouncerTest >> benchWeakSubscriptionStatic [ ] timeToRun ] -{ #category : #utilities } -WeakAnnouncerTest >> longTestCase [ - - self timeLimit: 60 seconds -] - { #category : #tests } WeakAnnouncerTest >> testNoDeadWeakSubscriptions [ self longTestCase. diff --git a/src/Fuel-Tests-Core/FLCreateClassSerializationTest.class.st b/src/Fuel-Tests-Core/FLCreateClassSerializationTest.class.st index 55bed950466..25165633698 100644 --- a/src/Fuel-Tests-Core/FLCreateClassSerializationTest.class.st +++ b/src/Fuel-Tests-Core/FLCreateClassSerializationTest.class.st @@ -59,6 +59,8 @@ FLCreateClassSerializationTest >> testCreateClassAndMetaclass [ "Tests materialization a class or trait not defined in the image and that the metaclass is also created." | class materializedClassOrTrait environment category name metaclassName metaclass | + self longTestCase. + class := self classFactory silentlyNewClass. environment := class environment. category := class category. diff --git a/src/Fuel-Tests-Core/FLTCreateClassOrTraitSerializationTest.trait.st b/src/Fuel-Tests-Core/FLTCreateClassOrTraitSerializationTest.trait.st index fed24893e2a..f65c2e87931 100644 --- a/src/Fuel-Tests-Core/FLTCreateClassOrTraitSerializationTest.trait.st +++ b/src/Fuel-Tests-Core/FLTCreateClassOrTraitSerializationTest.trait.st @@ -74,6 +74,8 @@ FLTCreateClassOrTraitSerializationTest >> testCreateBasic [ "Tests materialization a class or trait not defined in the image." | aClassOrTrait materializedClassOrTrait environment category name | + self longTestCase. + aClassOrTrait := self newClassOrTrait. environment := aClassOrTrait environment. category := aClassOrTrait category. diff --git a/src/SUnit-Core/TestCase.class.st b/src/SUnit-Core/TestCase.class.st index d8e9db3001d..902ffbcd9f1 100644 --- a/src/SUnit-Core/TestCase.class.st +++ b/src/SUnit-Core/TestCase.class.st @@ -748,6 +748,12 @@ TestCase >> logFailure: aString [ flush] ] +{ #category : #utilities } +TestCase >> longTestCase [ + + self timeLimit: 60 seconds +] + { #category : #accessing } TestCase >> nameForReport [ diff --git a/src/System-DependenciesTests/SystemDependenciesTest.class.st b/src/System-DependenciesTests/SystemDependenciesTest.class.st index b8fc727d62e..e3380f1eb13 100644 --- a/src/System-DependenciesTests/SystemDependenciesTest.class.st +++ b/src/System-DependenciesTests/SystemDependenciesTest.class.st @@ -152,12 +152,6 @@ SystemDependenciesTest >> knownUIDependencies [ #'Athens-Morphic' #'Refactoring-Critics' #'Refactoring-Environment' 'Reflectivity-Tools' #Shout #'Tool-Diff' #'Tool-FileList' #'Tool-Profilers' #'HeuristicCompletion-Model' 'NECompletion-Morphic' #VariablesLibrary #'Tools-CodeNavigation' #'Spec2-CommonWidgets') ] -{ #category : #utilities } -SystemDependenciesTest >> longTestCase [ - - self timeLimit: 60 seconds -] - { #category : #accessing } SystemDependenciesTest >> metacelloPackageNames [