Eliot Miranda uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-eem.392.mcz ==================== Summary ==================== Name: KernelTests-eem.392 Author: eem Time: 1 January 2021, 12:17:42.043127 pm UUID: c803a1d3-a439-4bac-8fc6-de85912285d9 Ancestors: KernelTests-eem.391 Add a FloatTest to compare all literal float contants in methods with those from a fresh compile, failing if any differ. Add a utility method to answer teh set of methods that cause the test to fail (FloatTest>>methodsMaybeContainingBrokenCompiledConstants). =============== Diff against KernelTests-eem.391 =============== Item was added: + ----- Method: FloatTest>>floatLiteralsIn: (in category 'private') ----- + floatLiteralsIn: method + | floatLiterals | + floatLiterals := OrderedCollection new. + method allLiteralsDo: + [:lit| lit isFloat ifTrue: [floatLiterals addLast: lit]]. + ^floatLiterals! Item was added: + ----- Method: FloatTest>>methodContainsFloatLiteral: (in category 'private') ----- + methodContainsFloatLiteral: method + method isQuick ifFalse: + [method allLiteralsDo: + [:lit| lit isFloat ifTrue: [^true]]]. + ^false! Item was added: + ----- Method: FloatTest>>methodsMaybeContainingBrokenCompiledConstants (in category 'private') ----- + methodsMaybeContainingBrokenCompiledConstants + "Answer a set of all methods in the system which contain float constants that differ from those obtaiuned by + recompiling. These may indicate an old compiler issue, or indeed an issue with the current compiler. This is a + variant of testCompiledConstants used for collecting the set of methods rather than testing that none exist." + | identifiedPatients | + identifiedPatients := IdentitySet new. + CurrentReadOnlySourceFiles cacheDuring: + [self systemNavigation allSelectorsAndMethodsDo: + [:class :selector :method| + (self methodContainsFloatLiteral: method) ifTrue: + [| newMethodAndNode newLiterals oldLiterals | + newMethodAndNode := class compile: method getSource asString notifying: nil trailer: CompiledMethodTrailer empty ifFail: nil. + newLiterals := self floatLiteralsIn: newMethodAndNode method. + oldLiterals := self floatLiteralsIn: method. + "Convenience doit for recompiling broken methods:..." + "class recompile: selector" + newLiterals size = oldLiterals size + ifFalse: [identifiedPatients add: method] + ifTrue: + [newLiterals with: oldLiterals do: + [:new :old| + (new asIEEE64BitWord = old asIEEE64BitWord + or: [new isNaN and: old isNaN]) ifFalse: + [identifiedPatients add: method]]]]]]. + ^identifiedPatients! Item was added: + ----- Method: FloatTest>>testCompiledConstants (in category 'tests') ----- + testCompiledConstants + "Test that any methods containing a floating point literal have been correctly compiled." + CurrentReadOnlySourceFiles cacheDuring: + [self systemNavigation allSelectorsAndMethodsDo: + [:class :selector :method| + (self methodContainsFloatLiteral: method) ifTrue: + [| newMethodAndNode newLiterals oldLiterals | + newMethodAndNode := class compile: method getSource asString notifying: nil trailer: CompiledMethodTrailer empty ifFail: nil. + newLiterals := self floatLiteralsIn: newMethodAndNode method. + oldLiterals := self floatLiteralsIn: method. + "Convenience doit for recompiling broken methods:..." + "class recompile: selector" + self assert: newLiterals size = oldLiterals size. + newLiterals with: oldLiterals do: + [:new :old| + self assert: (new asIEEE64BitWord = old asIEEE64BitWord + or: [new isNaN and: old isNaN])]]]]! |
Free forum by Nabble | Edit this page |