The Trunk: SUnit-mt.120.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: SUnit-mt.120.mcz

commits-2
Marcel Taeumel uploaded a new version of SUnit to project The Trunk:
http://source.squeak.org/trunk/SUnit-mt.120.mcz

==================== Summary ====================

Name: SUnit-mt.120
Author: mt
Time: 16 September 2019, 9:32:46.219266 am
UUID: a9b8b710-1eca-3a41-b2f9-bd33434e66c2
Ancestors: SUnit-mt.119

Restore time measurement for tests in a way that does not affect smalltalkCI.

Cope with interrupted runs that somehow store 'nil' as duration...

=============== Diff against SUnit-mt.119 ===============

Item was changed:
  ----- Method: TestResult>>duration (in category 'accessing') -----
  duration
 
+ ^ self durations inject: 0 into: [:sum :each | sum + (each ifNil: [0])]!
- ^ self durations inject: 0 into: [:sum :each | sum + each]!

Item was changed:
  ----- Method: TestResult>>runCase: (in category 'running') -----
  runCase: aTestCase
+
+ | testCasePassed timeToRun |
- | testCasePassed |
  testCasePassed := true.
+
+ [timeToRun := [aTestCase runCase] timeToRunWithoutGC]
+ on: self class failure
+ do: [:signal |
- [[aTestCase runCase]
- on: self class failure
- do:
- [:signal |
  failures add: aTestCase.
  testCasePassed := false.
+ signal return: false]
+ on: self class error
+ do: [:signal |
+ errors add: aTestCase.
+ testCasePassed := false.
+ signal return: false].
+
+ testCasePassed ifTrue: [passed add: aTestCase].
+ self durations at: aTestCase put: timeToRun.!
- signal return: false]]
- on: self class error
- do:
- [:signal |
- errors add: aTestCase.
- testCasePassed := false.
- signal return: false].
- testCasePassed ifTrue: [passed add: aTestCase]!

Item was removed:
- ----- Method: TestResult>>runCaseMeasured: (in category 'running') -----
- runCaseMeasured: aTestCase
-
- self durations
- at: aTestCase
- put: [self runCase: aTestCase] timeToRunWithoutGC.!

Item was changed:
  ----- Method: TestResult>>selectResultsForTestCase: (in category 'history') -----
  selectResultsForTestCase: aTestCaseClass
  | passedSelectors errorsSelectors failuresSelectors testCaseDurations |
 
  passedSelectors := self passed
  select: [:testCase | testCase class == aTestCaseClass ] thenCollect: [:testCase | testCase selector].
  errorsSelectors := self errors
  select: [:testCase | testCase class == aTestCaseClass ] thenCollect:  [:testCase | testCase selector].
  failuresSelectors := self failures
  select: [:testCase | testCase class == aTestCaseClass ] thenCollect:  [:testCase | testCase selector].
 
  testCaseDurations := Dictionary new.
  self durations keysAndValuesDo: [:testCase :milliseconds |
  testCase class == aTestCaseClass ifTrue: [testCaseDurations at: testCase selector put: milliseconds]].
 
  ^ self class newTestDictionary
  at: #timeStamp put: self timeStamp; "Keep this result's time stamp."
  at: #passed put: passedSelectors asSet;
  at: #failures put: failuresSelectors asSet;
  at: #errors put: errorsSelectors asSet;
  at: #durations put: testCaseDurations;
+ at: #duration put: (testCaseDurations inject: 0 into: [:sum :each | sum + (each ifNil: [0])]);
- at: #duration put: (testCaseDurations inject: 0 into: [:sum :each | sum + each]);
  yourself
  !