Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Test-Facility with Op-Code Hooks #39

Closed
mlauke opened this issue Jun 8, 2018 · 2 comments
Closed

Enhancement: Test-Facility with Op-Code Hooks #39

mlauke opened this issue Jun 8, 2018 · 2 comments

Comments

@mlauke
Copy link

mlauke commented Jun 8, 2018

hi,

we need a kind of test facility to use py65 for automatic testing of our code. how we want to achieve this?
the idea is to get mocks in place by adding "jsr hooks". currently such kind of callbacks are already there with the putc/getc memory observers. but we need a little more, we want to "fake" or mock some jsr to get tests in place.
think of this little example, where the tested code should run in simulator with a mocked sd_card instead of a real device.

lda...
adc..
jsr sd_card_read_block ; => this jsr we want to "hook" in and then let our mock run. which is not implemented in asm, but in python`
... more 

before simulator start, a custom prepare is run

self.register_JSR_Hook("<symbol>" ) - ie. self.register_JSR_Hook("sd_card_read_block", sd_card_read_block_mock) => how to determine the adress from symbol?!?

sd_card_read_block is hooked with the current context of the mpu, means all regs, memory are available as usual.

def sd_card_read_block_mock(mpu): #mock funciton
   if(mpu.WordAt(....   #dispatch behaviour upon mpu state
      ... _copy(test_data, mpu.memory[addr]).... # copy test data ie. sd blocks to mpu.memory and let the simulation go on

cheers,

https://steckschwein.de/

@mlauke
Copy link
Author

mlauke commented Oct 24, 2018

it does not make sense doing tests in this way. we found a solution by implementing our tests also in asm. the "opcode hook" is therefore not needed anymore.

many thx

@BigEd
Copy link
Collaborator

BigEd commented Jan 3, 2019

I think we can close this...

@BigEd BigEd closed this as completed Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants