[squeak-dev] The Trunk: Tests-eem.367.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Mar 11 20:18:23 UTC 2017


Eliot Miranda uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-eem.367.mcz

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

Name: Tests-eem.367
Author: eem
Time: 11 March 2017, 12:18:10.041937 pm
UUID: c2e7c6f2-f419-48fc-bbef-fd4aeee781cc
Ancestors: Tests-jr.366

Add a test class for CogVM tests.  Currently provide a single test that checks that the pc mapping machinery works, although the stress case is unlikely to be strenuous enough.

=============== Diff against Tests-jr.366 ===============

Item was changed:
  SystemOrganization addCategory: #'Tests-Bugs'!
  SystemOrganization addCategory: #'Tests-Compiler'!
  SystemOrganization addCategory: #'Tests-Dependencies'!
  SystemOrganization addCategory: #'Tests-Digital Signatures'!
  SystemOrganization addCategory: #'Tests-Environments'!
  SystemOrganization addCategory: #'Tests-Exceptions'!
  SystemOrganization addCategory: #'Tests-FilePackage'!
  SystemOrganization addCategory: #'Tests-Files'!
  SystemOrganization addCategory: #'Tests-Finalization'!
  SystemOrganization addCategory: #'Tests-Hex'!
  SystemOrganization addCategory: #'Tests-Installer-Core'!
  SystemOrganization addCategory: #'Tests-Localization'!
  SystemOrganization addCategory: #'Tests-Monticello'!
  SystemOrganization addCategory: #'Tests-Monticello-Mocks'!
  SystemOrganization addCategory: #'Tests-Monticello-Utils'!
  SystemOrganization addCategory: #'Tests-Object Events'!
  SystemOrganization addCategory: #'Tests-ObjectsAsMethods'!
  SystemOrganization addCategory: #'Tests-PrimCallController'!
  SystemOrganization addCategory: #'Tests-Release'!
  SystemOrganization addCategory: #'Tests-System-Object Storage'!
  SystemOrganization addCategory: #'Tests-System-Support'!
  SystemOrganization addCategory: #'Tests-Utilities'!
  SystemOrganization addCategory: #'Tests-VM'!
  SystemOrganization addCategory: #'Tests-System-Digital Signatures'!
  SystemOrganization addCategory: #'Tests-System-Preferences'!
+ SystemOrganization addCategory: #'Tests-MonticelloMocks'!

Item was added:
+ TestCase subclass: #CogVMBaseImageTests
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'Tests-VM'!
+ 
+ !CogVMBaseImageTests commentStamp: 'eem 3/11/2017 11:18' prior: 0!
+ A CogVMBaseImageTests is a set of tests of the Stack and Cog VMs designed to be run in a base Squeak, Pharo, Cuis or Newspeak image.  [CogVMTests is a name already used in the VMMaker.oscog package}.]
+ 
+ Instance Variables
+ !

Item was added:
+ ----- Method: CogVMBaseImageTests>>method0 (in category 'private') -----
+ method0
+ 	self testExpectedPCInSenderOf: thisContext.
+ 	self testExpectedPCInSenderOf: thisContext shallowCopy!

Item was added:
+ ----- Method: CogVMBaseImageTests>>method1: (in category 'private') -----
+ method1: arg
+ 	self testExpectedPCInSenderOf: thisContext.
+ 	self testExpectedPCInSenderOf: thisContext shallowCopy!

Item was added:
+ ----- Method: CogVMBaseImageTests>>method2:with: (in category 'private') -----
+ method2: arg1 with: arg2
+ 	self testExpectedPCInSenderOf: thisContext.
+ 	self testExpectedPCInSenderOf: thisContext shallowCopy!

Item was added:
+ ----- Method: CogVMBaseImageTests>>method3:with:with: (in category 'private') -----
+ method3: arg1 with: arg2 with: arg3
+ 	self testExpectedPCInSenderOf: thisContext.
+ 	self testExpectedPCInSenderOf: thisContext shallowCopy!

Item was added:
+ ----- Method: CogVMBaseImageTests>>method8:with:with:with:with:with:with:with: (in category 'private') -----
+ method8: arg1 with: arg2 with: arg3 with: arg4 with: arg5 with: arg6 with: arg7 with: arg8
+ 	self testExpectedPCInSenderOf: thisContext.
+ 	self testExpectedPCInSenderOf: thisContext shallowCopy!

Item was added:
+ ----- Method: CogVMBaseImageTests>>runTestPCMappingMethod (in category 'private') -----
+ runTestPCMappingMethod
+ 	"Perform various sends, each of which will test that the PC of the current context matches what's expected.
+ 	 See testExpectedPCInSenderOf:.
+ 	 In the V3 bytecode set method8:with:with:with:with:with:with:with: should require the doubleExtendedDoAnythingBytecode."
+ 
+ 	self method0.
+ 	self method1: 'one'.
+ 	self method2: 'two' with: 'three'.
+ 	self method3: 'four' with: 'five' with: 'six'.
+ 	self method8: 'eight' with: 'nine' with: 'ten' with: 'eleven' with: 'twelve' with: 'thirteen' with: 'fourteen' with: 'fifteen'.
+ 	[self method0.
+ 	 self method1: 'one'.
+ 	 self method2: 'two' with: 'three'.
+ 	 self method3: 'four' with: 'five' with: 'six'.
+ 	 self method8: 'eight' with: 'nine' with: 'ten' with: 'eleven' with: 'twelve' with: 'thirteen' with: 'fourteen' with: 'fifteen'.
+ 	 [self method0.
+ 	  self method1: 'one'.
+ 	  self method2: 'two' with: 'three'.
+ 	  self method3: 'four' with: 'five' with: 'six'.
+ 	  self method8: 'eight' with: 'nine' with: 'ten' with: 'eleven' with: 'twelve' with: 'thirteen' with: 'fourteen' with: 'fifteen'] value] value.
+ 	self method0.
+ 	self method1: 'one'.
+ 	self method2: 'two' with: 'three'.
+ 	self method3: 'four' with: 'five' with: 'six'
+ !

Item was added:
+ ----- Method: CogVMBaseImageTests>>testExpectedPCInSenderOf: (in category 'private') -----
+ testExpectedPCInSenderOf: calleeContext
+ 	| selector pc method found is endPC |
+ 	selector := calleeContext method selector.
+ 	pc := calleeContext sender pc.
+ 	method := calleeContext sender method.
+ 	found := false.
+ 	is := InstructionStream on: method.
+ 	is pc: calleeContext sender startpc.
+ 	endPC := calleeContext sender endPC.
+ 	is scanFor:
+ 		[:b|
+ 		 is followingPc = pc ifTrue:
+ 			[found := true.
+ 			 self assert: selector equals: is selectorToSendOrSelf].
+ 		 is pc >= endPC].
+ 	self assert: found!

Item was added:
+ ----- Method: CogVMBaseImageTests>>testPCMapping (in category 'tests') -----
+ testPCMapping
+ 	"Test that pcs at sends are as expected since interally the JIT has to map from machine code pcs to bytecode pcs.
+ 	 The method will be jitted on the second iteration.  Run 3 times to compare interpreter and JIT, which should agree."
+ 	(self class compiledMethodAt: #runTestPCMappingMethod) voidCogVMState.
+ 	3 timesRepeat: [self runTestPCMappingMethod]!



More information about the Squeak-dev mailing list