Marcel Taeumel uploaded a new version of TraitsTests to project The Trunk:
http://source.squeak.org/trunk/TraitsTests-mt.23.mcz ==================== Summary ==================== Name: TraitsTests-mt.23 Author: mt Time: 2 September 2019, 7:36:50.497683 pm UUID: c2a17580-66fa-cd46-b10e-d915399380f3 Ancestors: TraitsTests-mt.22 Speeds up tests. On my machine, they took more than 10 minutes and are now down to roughly 65 seconds. :-) Thanks to source-file caching and notification silence during set-up and tear-down. The mini pattern #*Silently might be useful for other tests, too. =============== Diff against TraitsTests-mt.22 =============== Item was changed: ----- Method: TraitFileOutTest>>categoryName (in category 'running') ----- categoryName + ^'TraitsTestsTemporary-FileOut'! - ^'TraitsTests-FileOut'! Item was removed: - ----- Method: TraitFileOutTest>>setUp (in category 'running') ----- - setUp - - super setUp. - Utilities - useAuthorInitials: self className - during: [ - SystemOrganization addCategory: self categoryName. - - td := self createTraitNamed: #TD uses: {}. - td compile: 'd' classified: #cat1. - tc := self createTraitNamed: #TC uses: td. - tc compile: 'c' classified: #cat1. - tb := self createTraitNamed: #TB uses: td. - tb compile: 'b' classified: #cat1. - ta := self createTraitNamed: #TA uses: tb + ((tc @ {#cc->#c}) - {#c}). - ta compile: 'a' classified: #cat1. - - ca := self createClassNamed: #CA superclass: Object uses: {}. - ca compile: 'ca' classified: #cat1. - cb := self createClassNamed: #CB superclass: ca uses: ta. - cb compile: 'cb' classified: #cat1. - - "make the class of cb also use tc:" - cb class uses: ta classTrait + tc instanceVariableNames: '' ]! Item was added: + ----- Method: TraitFileOutTest>>setUpSilently (in category 'running') ----- + setUpSilently + + super setUpSilently. + + SystemOrganization addCategory: self categoryName. + + td := self createTraitNamed: #TD uses: {}. + td compile: 'd' classified: #cat1. + tc := self createTraitNamed: #TC uses: td. + tc compile: 'c' classified: #cat1. + tb := self createTraitNamed: #TB uses: td. + tb compile: 'b' classified: #cat1. + ta := self createTraitNamed: #TA uses: tb + ((tc @ {#cc->#c}) - {#c}). + ta compile: 'a' classified: #cat1. + + ca := self createClassNamed: #CA superclass: Object uses: {}. + ca compile: 'ca' classified: #cat1. + cb := self createClassNamed: #CB superclass: ca uses: ta. + cb compile: 'cb' classified: #cat1. + + "make the class of cb also use tc:" + cb class uses: ta classTrait + tc instanceVariableNames: ''.! Item was removed: - ----- Method: TraitFileOutTest>>tearDown (in category 'running') ----- - tearDown - | dir | - dir := FileDirectory default. - self createdClassesAndTraits, self resourceClassesAndTraits do: [:each | - dir deleteFileNamed: each asString , '.st' ifAbsent: []]. - dir deleteFileNamed: self categoryName , '.st' ifAbsent: []. - SystemOrganization removeSystemCategory: self categoryName. - ca := cb := ta := tb := tc := td := nil. - super tearDown! Item was added: + ----- Method: TraitFileOutTest>>tearDownSilently (in category 'running') ----- + tearDownSilently + + | dir | + dir := FileDirectory default. + self createdClassesAndTraits, self resourceClassesAndTraits do: [:each | + dir deleteFileNamed: each asString , '.st' ifAbsent: []]. + dir deleteFileNamed: self categoryName , '.st' ifAbsent: []. + SystemOrganization removeSystemCategory: self categoryName. + ca := cb := ta := tb := tc := td := nil. + + super tearDownSilently.! Item was changed: ----- Method: TraitsResource>>tearDown (in category 'running') ----- tearDown SystemChangeNotifier uniqueInstance noMoreNotificationsFor: self. + + SystemChangeNotifier uniqueInstance doSilently: [ + self createdClassesAndTraits do: + [:aClassOrTrait | | behaviorName | + behaviorName := aClassOrTrait name. + Smalltalk at: behaviorName + ifPresent: [:classOrTrait | classOrTrait removeFromSystem]. + ChangeSet current removeClassChanges: behaviorName] ]. + - self createdClassesAndTraits do: - [:aClassOrTrait | | behaviorName | - behaviorName := aClassOrTrait name. - Smalltalk at: behaviorName - ifPresent: [:classOrTrait | classOrTrait removeFromSystem]. - ChangeSet current removeClassChanges: behaviorName]. createdClassesAndTraits := self t1: (self t2: (self t3: (self t4: (self t5: (self t6: (self c1: (self c2: (self c3: (self c4: (self c5: (self c6: (self c7: (self c8: nil)))))))))))))! Item was added: + ----- Method: TraitsTestCase class>>isAbstract (in category 'as yet unclassified') ----- + isAbstract + + ^ self = TraitsTestCase! Item was changed: ----- Method: TraitsTestCase>>performTest (in category 'private') ----- performTest + CurrentReadOnlySourceFiles cacheDuring: [ + Utilities useAuthorInitials: self className during: [ + self performTestSilently]].! - Utilities - useAuthorInitials: self className - during: [ super performTest ]! Item was added: + ----- Method: TraitsTestCase>>performTestSilently (in category 'private') ----- + performTestSilently + "Perform the test without making too much noise." + + super performTest.! Item was changed: ----- Method: TraitsTestCase>>setUp (in category 'running') ----- setUp super setUp. self timeout: 90. "pre: This is necessary to account for the TraitsResrouce setup" + + CurrentReadOnlySourceFiles cacheDuring: [ + SystemChangeNotifier uniqueInstance doSilently: [ + Utilities useAuthorInitials: self className during: [ + self setUpSilently]]].! - ! Item was added: + ----- Method: TraitsTestCase>>setUpSilently (in category 'running') ----- + setUpSilently + "Prepare the system without making too much noise."! Item was changed: ----- Method: TraitsTestCase>>tearDown (in category 'running') ----- tearDown + CurrentReadOnlySourceFiles cacheDuring: [ + SystemChangeNotifier uniqueInstance doSilently: [ + Utilities useAuthorInitials: self className during: [ + self tearDownSilently]]]. + + super tearDown.! - TraitsResource resetIfDirty. - self createdClassesAndTraits do: - [:aClassOrTrait | | behaviorName | - behaviorName := aClassOrTrait name. - Smalltalk at: behaviorName - ifPresent: [:classOrTrait | classOrTrait removeFromSystem]. - ChangeSet current removeClassChanges: behaviorName]. - createdClassesAndTraits := nil! Item was added: + ----- Method: TraitsTestCase>>tearDownSilently (in category 'running') ----- + tearDownSilently + "Clean up the system without making too much noise." + + TraitsResource resetIfDirty. + + self createdClassesAndTraits do: [:aClassOrTrait | | behaviorName | + behaviorName := aClassOrTrait name. + Smalltalk at: behaviorName + ifPresent: [:classOrTrait | classOrTrait removeFromSystem]. + ChangeSet current removeClassChanges: behaviorName]. + + createdClassesAndTraits := nil.! |
Free forum by Nabble | Edit this page |