Magic Lantern Forum

Developing Magic Lantern => General Development => Topic started by: a1ex on October 29, 2012, 10:03:35 PM

Title: Low-level API tests for stubs
Post by: a1ex on October 29, 2012, 10:03:35 PM
Today I've found a wrong stub on 5D3 (strcmp). Most of the time it was correct - it gave a few false positives though. A few weeks ago we also spent a lot of time to find another wrong stub (msg_queue_post). Also, new ports tend to have some wrong constants that are not widely used, so the side effect is subtle or hard to notice (e.g. DLG_SIGNATURE, used only for redraws).

So... here's a series of automatic tests that should catch these mistakes easier: https://bitbucket.org/hudson/magic-lantern/changeset/a899850d2a39

The idea is to test each stub and constant (if possible), so it should cover pretty much all the low-level Canon API used by ML.

I've only tested it on 5D3. Try it on your cameras, and if anything fails, post your log file.

Feel free to add more tests or to improve the test engine.


[Pass] strlen("abc") => 0x3
[Pass] strlen("qwertyuiop") => 0xa
[Pass] strlen("") => 0x0
[Pass] strcpy(msg, "hi there") => 0x1a7560
[Pass] msg => 'hi there'
[Pass] snprintf(a, sizeof(a), "foo") => 0x3
[Pass] snprintf(b, sizeof(b), "foo") => 0x3
[Pass] strcmp(a, b) => 0x0
[Pass] snprintf(a, sizeof(a), "bar") => 0x3
[Pass] snprintf(b, sizeof(b), "baz") => 0x3
[Pass] strcmp(a, b) => 0xfffffff8
[Pass] snprintf(a, sizeof(a), "Display") => 0x7
[Pass] snprintf(b, sizeof(b), "Defishing") => 0x9
[Pass] strcmp(a, b) => 0x4
[Pass] memcpy(foo, bar, 6) => 0xb9158
[Pass] foo => 'asdfghuiop'
[Pass] memset(bar, '*', 5) => 0xb9164
[Pass] bar => '*****hjkl;'
       bzero32(bar + 5, 5)
[Pass] bar => '****'
       t0 = *(uint32_t*)0xC0242014 => 0x7273b
       msleep(250)
       t1 = *(uint32_t*)0xC0242014 => 0xb14ca
[Pass] ABS(mod(t1-t0, 1048576)/1000 - 250) => 0x7
       LoadCalendarFromRTC( &now )
       s0 = now.tm_sec => 0x14
       Date/time: 2012/10/29 23:44:20
       msleep(1500)
       LoadCalendarFromRTC( &now )
       s1 = now.tm_sec => 0x16
[Pass] mod(s1-s0, 60) => 0x2
[Pass] mod(s1-s0, 60) => 0x2
       m0 = MALLOC_FREE_MEMORY => 0x5bc28
       p = malloc(50*1024) => 0xe3c00
       m1 = MALLOC_FREE_MEMORY => 0x4f418
       free(p)
       m2 = MALLOC_FREE_MEMORY => 0x5bc28
[Pass] ABS((m0-m1) - 50*1024) => 0x10
[Pass] ABS(m0-m2) => 0x0
       m0 = GetFreeMemForAllocateMemory() => 0x3eb0d4
       p = AllocateMemory(256*1024) => 0x79f9d4
       m1 = GetFreeMemForAllocateMemory() => 0x3ab0c8
       FreeMemory(p)
       m2 = GetFreeMemForAllocateMemory() => 0x3eb0d4
[Pass] ABS((m0-m1) - 256*1024) => 0xc
[Pass] ABS(m0-m2) => 0x0
       m01 = MALLOC_FREE_MEMORY => 0x5bc28
       m02 = GetFreeMemForAllocateMemory() => 0x3eb0d4
       p = alloc_dma_memory(256*1024) => 0x4079fa14
       free_dma_memory(p)
[Pass] UNCACHEABLE(p) => 0x4079fa14
[Pass] CACHEABLE(p) => 0x79fa14
[Pass] UNCACHEABLE(CACHEABLE(p)) => 0x4079fa14
       p = (void*)shoot_malloc(24*1024*1024) => 0x5be60074
       shoot_free(p)
       m11 = MALLOC_FREE_MEMORY => 0x5bc28
       m12 = GetFreeMemForAllocateMemory() => 0x3eb0d4
[Pass] ABS(m01-m11) => 0x0
[Pass] ABS(m02-m12) => 0x0
       EngDrvOut(0xC0F14400, 0x1234)
[Pass] shamem_read(0xC0F14400) => 0x1234
       call("TurnOffDisplay")
[Pass] DISPLAY_IS_ON => 0x0
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       SetGUIRequestMode(1); msleep(500);
[Pass] CURRENT_DIALOG_MAYBE => 0x1
       SetGUIRequestMode(2); msleep(500);
[Pass] CURRENT_DIALOG_MAYBE => 0x2
       SetGUIRequestMode(0); msleep(500);
[Pass] CURRENT_DIALOG_MAYBE => 0x0
       GUI_Control(BGMT_PLAY, 0, 0, 0); msleep(500);
[Pass] PLAY_MODE => 0x1
[Pass] MENU_MODE => 0x0
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x1
[Pass] PLAY_MODE => 0x0
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x0
[Pass] PLAY_MODE => 0x0
       task_create("test", 0x1c, 0x1000, test_task, 0) => 0x8c800c8
[Pass] test_task_created => 0x1
[Pass] get_task_name_from_id(get_current_task()) => 'run_test'
[Pass] mq = (void*)msg_queue_create("test", 5) => 0x8ca00a6
[Pass] msg_queue_post(mq, 0x1234567) => 0x0
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x0
[Pass] m => 0x1234567
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x9
[Pass] sem = create_named_semaphore("test", 1) => 0x8cc02e2
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] take_semaphore(sem, 500) => 0x9
[Pass] give_semaphore(sem) => 0x0
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] rlock = CreateRecursiveLock(0) => 0x8ce00c6
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0xf
[Pass] f = FIO_CreateFileEx(CARD_DRIVE"test.dat") => 0x4
[Pass] FIO_WriteFile(f, (void*)ROMBASEADDR, 0x10000) => 0x10000
[Pass] FIO_WriteFile(f, (void*)ROMBASEADDR, 0x10000) => 0x10000
       FIO_CloseFile(f)
[Pass] FIO_GetFileSize(CARD_DRIVE"test.dat", &size) => 0x0
[Pass] size => 0x20000
[Pass] p = alloc_dma_memory(0x20000) => 0x4079fa14
[Pass] f = FIO_Open(CARD_DRIVE"test.dat", O_RDONLY | O_SYNC) => 0x4
[Pass] FIO_ReadFile(f, p, 0x20000) => 0x20000
       FIO_CloseFile(f)
       free_dma_memory(p)
[Pass] FIO_RemoveFile(CARD_DRIVE"test.dat") => 0x0
       SW1(1,100)
[Pass] HALFSHUTTER_PRESSED => 0x1
       SW1(0,100)
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] DLG_SIGNATURE => 0x6e4944
Title: Re: Low-level API tests for stubs
Post by: ilguercio on October 29, 2012, 10:55:08 PM
https://dl.dropbox.com/u/1087972/ML/stubtest_50D.log
Looks like there are some failures.
Title: Re: Low-level API tests for stubs
Post by: nanomad on October 29, 2012, 10:57:33 PM
Looks like a couple of memory-related stubs are wrong
Title: Re: Low-level API tests for stubs
Post by: a1ex on October 29, 2012, 11:03:46 PM
Did you run it with display on or off? It should be ran with display on.
Title: Re: Low-level API tests for stubs
Post by: nanomad on October 29, 2012, 11:04:52 PM
It causes err 70 on the 1100D :p

Does it need LV on?
Title: Re: Low-level API tests for stubs
Post by: ilguercio on October 29, 2012, 11:08:15 PM
Quote from: a1ex on October 29, 2012, 11:03:46 PM
Did you run it with display on or off? It should be ran with display on.
Same thing, if i run it with the INFO screen on it gives me 69 Passes and 4 Fails.
Title: Re: Low-level API tests for stubs
Post by: a1ex on October 29, 2012, 11:09:26 PM
I've only tried with LV off, in photo mode (M), with display on. It doesn't test anything LV-specific (yet).

ilguercio: post the new log.
Title: Re: Low-level API tests for stubs
Post by: ilguercio on October 29, 2012, 11:10:51 PM
https://dl.dropbox.com/u/1087972/ML/stubtest_LV_50D.log
Title: Re: Low-level API tests for stubs
Post by: nanomad on October 29, 2012, 11:11:55 PM
The biggest issue is that you're allocating too much memory on the 1100D which in turn causes ERR70 i think
Title: Re: Low-level API tests for stubs
Post by: a1ex on October 29, 2012, 11:13:06 PM
Good. All the remaining failures seem to be compiler alignment differences (not identical to mine).

We'll have to do something to free some memory on the 1100D. The 60D has around 1 MB in normal usage, and sometimes it's still not enough for Canon firmware.
Title: Re: Low-level API tests for stubs
Post by: ilguercio on October 29, 2012, 11:14:00 PM
Quote from: a1ex on October 29, 2012, 11:13:06 PM
Good. All the remaining failures seem to be compiler alignment differences (not identical to mine).

We'll have to do something to free some memory on the 1100D. The 60D has around 1 MB in normal usage, and sometimes it's still not enough for Canon firmware.
I'm using cygwin on Win 7 x64. Is it a problem?
Title: Re: Low-level API tests for stubs
Post by: nanomad on October 29, 2012, 11:14:27 PM
http://nanomad.magiclantern.fm/1100D/STUBTEST.LOG

Title: Re: Low-level API tests for stubs
Post by: a1ex on October 29, 2012, 11:19:23 PM
ilguercio: I had -O2 active, maybe it was that.

nanomad: probably most failures were because of err70. Try to malloc less memory, maybe it helps.

Also I'm thinking to use shoot_malloc instead of alloc_dma_memory for 1100D, it may fix some things.
Title: Re: Low-level API tests for stubs
Post by: Francis on October 29, 2012, 11:20:55 PM
http://avlmotofoto.com/stubtest.log (http://avlmotofoto.com/stubtest.log)

5D2 with display on
Title: Re: Low-level API tests for stubs
Post by: nanomad on October 29, 2012, 11:21:24 PM
Well, there are a couple of wrong constants at least
Title: Re: Low-level API tests for stubs
Post by: nanomad on October 29, 2012, 11:36:38 PM
Well, the 1100D is really short on memory :(
Title: Re: Low-level API tests for stubs
Post by: ilguercio on October 29, 2012, 11:39:50 PM
Quote from: nanomad on October 29, 2012, 11:36:38 PM
Well, the 1100D is really short on memory :(
Feed it some fish.
Also, can i "-O2" on cygwin as well?
Title: Re: Low-level API tests for stubs
Post by: 1% on October 30, 2012, 02:11:35 AM
Clean bill of health here... but no more 03... bin is 511K.


[Pass] strlen("abc") => 0x3
[Pass] strlen("qwertyuiop") => 0xa
[Pass] strlen("") => 0x0
[Pass] strcpy(msg, "hi there") => 0x16311c
[Pass] msg => 'hi there'
[Pass] snprintf(a, sizeof(a), "foo") => 0x3
[Pass] snprintf(b, sizeof(b), "foo") => 0x3
[Pass] strcmp(a, b) => 0x0
[Pass] snprintf(a, sizeof(a), "bar") => 0x3
[Pass] snprintf(b, sizeof(b), "baz") => 0x3
[Pass] strcmp(a, b) => 0xfffffff8
[Pass] snprintf(a, sizeof(a), "Display") => 0x7
[Pass] snprintf(b, sizeof(b), "Defishing") => 0x9
[Pass] strcmp(a, b) => 0x4
[Pass] memcpy(foo, bar, 6) => 0xcda48c
[Pass] foo => 'asdfghuiop'
[Pass] memset(bar, '*', 5) => 0xcda498
[Pass] bar => '*****hjkl;'
       bzero32(bar + 5, 5)
[Pass] bar => '****'
       t0 = *(uint32_t*)0xC0242014 => 0x6bdd
       msleep(250)
       t1 = *(uint32_t*)0xC0242014 => 0x44d85
[Pass] ABS(mod(t1-t0, 1048576)/1000 - 250) => 0x4
       LoadCalendarFromRTC( &now )
       s0 = now.tm_sec => 0xa
       Date/time: 2012/10/29 20:08:10
       msleep(1500)
       LoadCalendarFromRTC( &now )
       s1 = now.tm_sec => 0xb
[Pass] mod(s1-s0, 60) => 0x1
[Pass] mod(s1-s0, 60) => 0x1
       m0 = MALLOC_FREE_MEMORY => 0x53768
       p = malloc(50*1024) => 0xb0060
       m1 = MALLOC_FREE_MEMORY => 0x46f58
       free(p)
       m2 = MALLOC_FREE_MEMORY => 0x53768
[Pass] ABS((m0-m1) - 50*1024) => 0x10
[Pass] ABS(m0-m2) => 0x0
       m0 = GetFreeMemForAllocateMemory() => 0x161798
       p = AllocateMemory(256*1024) => 0xb81e18
       m1 = GetFreeMemForAllocateMemory() => 0x121788
       FreeMemory(p)
       m2 = GetFreeMemForAllocateMemory() => 0x161738
[Pass] ABS((m0-m1) - 256*1024) => 0x10
[Pass] ABS(m0-m2) => 0x60
       m01 = MALLOC_FREE_MEMORY => 0x53768
       m02 = GetFreeMemForAllocateMemory() => 0x161778
       p = alloc_dma_memory(256*1024) => 0x40b81e58
       free_dma_memory(p)
[Pass] UNCACHEABLE(p) => 0x40b81e58
[Pass] CACHEABLE(p) => 0xb81e58
[Pass] UNCACHEABLE(CACHEABLE(p)) => 0x40b81e58
       p = (void*)shoot_malloc(24*1024*1024) => 0x42180084
       shoot_free(p)
       m11 = MALLOC_FREE_MEMORY => 0x53768
       m12 = GetFreeMemForAllocateMemory() => 0x161798
[Pass] ABS(m01-m11) => 0x0
[Pass] ABS(m02-m12) => 0x20
       EngDrvOut(0xC0F14400, 0x1234)
[Pass] shamem_read(0xC0F14400) => 0x1234
       call("TurnOffDisplay")
[Pass] DISPLAY_IS_ON => 0x0
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       SetGUIRequestMode(1); msleep(500);
[Pass] CURRENT_DIALOG_MAYBE => 0x1
       SetGUIRequestMode(2); msleep(500);
[Pass] CURRENT_DIALOG_MAYBE => 0x2
       SetGUIRequestMode(0); msleep(500);
[Pass] CURRENT_DIALOG_MAYBE => 0x0
       GUI_Control(BGMT_PLAY, 0, 0, 0); msleep(500);
[Pass] PLAY_MODE => 0x1
[Pass] MENU_MODE => 0x0
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x1
[Pass] PLAY_MODE => 0x0
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x0
[Pass] PLAY_MODE => 0x0
       task_create("test", 0x1c, 0x1000, test_task, 0) => 0x1c2200bc
[Pass] test_task_created => 0x1
[Pass] get_task_name_from_id(get_current_task()) => 'run_test'
[Pass] mq = (void*)msg_queue_create("test", 5) => 0x1c2e0092
[Pass] msg_queue_post(mq, 0x1234567) => 0x0
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x0
[Pass] m => 0x1234567
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x9
[Pass] sem = create_named_semaphore("test", 1) => 0x1c800214
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] take_semaphore(sem, 500) => 0x9
[Pass] give_semaphore(sem) => 0x0
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] rlock = CreateRecursiveLock(0) => 0x1cf00096
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0xf
[Pass] f = FIO_CreateFileEx(CARD_DRIVE"test.dat") => 0x4
[Pass] FIO_WriteFile(f, (void*)ROMBASEADDR, 0x10000) => 0x10000
[Pass] FIO_WriteFile(f, (void*)ROMBASEADDR, 0x10000) => 0x10000
       FIO_CloseFile(f)
[Pass] FIO_GetFileSize(CARD_DRIVE"test.dat", &size) => 0x0
[Pass] size => 0x20000
[Pass] p = alloc_dma_memory(0x20000) => 0x409de8f0
[Pass] f = FIO_Open(CARD_DRIVE"test.dat", O_RDONLY | O_SYNC) => 0x4
[Pass] FIO_ReadFile(f, p, 0x20000) => 0x20000
       FIO_CloseFile(f)
       free_dma_memory(p)
[Pass] FIO_RemoveFile(CARD_DRIVE"test.dat") => 0x0
       SW1(1,100)
[Pass] HALFSHUTTER_PRESSED => 0x1
       SW1(0,100)
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] DLG_SIGNATURE => 0x6e4944

Title: Re: Low-level API tests for stubs
Post by: Greg on October 30, 2012, 02:40:23 AM
500D :
[Pass] strlen("abc") => 0x3
[Pass] strlen("qwertyuiop") => 0xa
[Pass] strlen("") => 0x0
[Pass] strcpy(msg, "hi there") => 0x17c4d0
[Pass] msg => 'hi there'
[Pass] snprintf(a, sizeof(a), "foo") => 0x3
[Pass] snprintf(b, sizeof(b), "foo") => 0x3
[Pass] strcmp(a, b) => 0x0
[Pass] snprintf(a, sizeof(a), "bar") => 0x3
[Pass] snprintf(b, sizeof(b), "baz") => 0x3
[Pass] strcmp(a, b) => 0xfffffff8
[Pass] snprintf(a, sizeof(a), "Display") => 0x7
[Pass] snprintf(b, sizeof(b), "Defishing") => 0x9
[Pass] strcmp(a, b) => 0x4
[FAIL] memcpy(foo, bar, 6) => 0x97e02
[FAIL] foo => 'aop'
[Pass] memset(bar, '*', 5) => 0x97e07
[Pass] bar => '*****hjkl;'
       bzero32(bar + 5, 5)
[FAIL] bar => '*****'
       t0 = *(uint32_t*)0xC0242014 => 0xf192d
       msleep(250)
       t1 = *(uint32_t*)0xC0242014 => 0x2f904
[Pass] ABS(mod(t1-t0, 1048576)/1000 - 250) => 0x3
       LoadCalendarFromRTC( &now )
       s0 = now.tm_sec => 0x5
       Date/time: 2012/10/30 03:34:05
       msleep(1500)
       LoadCalendarFromRTC( &now )
       s1 = now.tm_sec => 0x6
[Pass] mod(s1-s0, 60) => 0x1
[Pass] mod(s1-s0, 60) => 0x1
       m0 = MALLOC_FREE_MEMORY => 0x57aa0
       p = malloc(50*1024) => 0xcd0c0
       m1 = MALLOC_FREE_MEMORY => 0x4b2a0
       free(p)
       m2 = MALLOC_FREE_MEMORY => 0x57aa0
[Pass] ABS((m0-m1) - 50*1024) => 0x0
[Pass] ABS(m0-m2) => 0x0
       m0 = GetFreeMemForAllocateMemory() => 0x2de3ac
       p = AllocateMemory(256*1024) => 0xa47f24
       m1 = GetFreeMemForAllocateMemory() => 0x29e3a0
       FreeMemory(p)
       m2 = GetFreeMemForAllocateMemory() => 0x2de3ac
[Pass] ABS((m0-m1) - 256*1024) => 0xc
[Pass] ABS(m0-m2) => 0x0
       m01 = MALLOC_FREE_MEMORY => 0x57aa0
       m02 = GetFreeMemForAllocateMemory() => 0x2de3ac
       p = alloc_dma_memory(256*1024) => 0x40a47f64
       free_dma_memory(p)
[Pass] UNCACHEABLE(p) => 0x40a47f64
[Pass] CACHEABLE(p) => 0xa47f64
[Pass] UNCACHEABLE(CACHEABLE(p)) => 0x40a47f64
       p = (void*)shoot_malloc(24*1024*1024) => 0x0
       shoot_free(p)
       m11 = MALLOC_FREE_MEMORY => 0x57aa0
       m12 = GetFreeMemForAllocateMemory() => 0x2de3ac
[Pass] ABS(m01-m11) => 0x0
[Pass] ABS(m02-m12) => 0x0
       EngDrvOut(0xC0F14400, 0x1234)
[Pass] shamem_read(0xC0F14400) => 0x1234
       call("TurnOffDisplay")
[Pass] DISPLAY_IS_ON => 0x0
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       SetGUIRequestMode(1); msleep(500);
[Pass] CURRENT_DIALOG_MAYBE => 0x1
       SetGUIRequestMode(2); msleep(500);
[Pass] CURRENT_DIALOG_MAYBE => 0x2
       SetGUIRequestMode(0); msleep(500);
[Pass] CURRENT_DIALOG_MAYBE => 0x0
       GUI_Control(BGMT_PLAY, 0, 0, 0); msleep(500);
[Pass] PLAY_MODE => 0x1
[Pass] MENU_MODE => 0x0
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x1
[Pass] PLAY_MODE => 0x0
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x0
[Pass] PLAY_MODE => 0x0
       task_create("test", 0x1c, 0x1000, test_task, 0) => 0x65400a8
[Pass] test_task_created => 0x1
[Pass] get_task_name_from_id(get_current_task()) => 'run_test'
[Pass] mq = (void*)msg_queue_create("test", 5) => 0x656007c
[Pass] msg_queue_post(mq, 0x1234567) => 0x0
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x0
[Pass] m => 0x1234567
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x9
[Pass] sem = create_named_semaphore("test", 1) => 0x65801be
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] take_semaphore(sem, 500) => 0x9
[Pass] give_semaphore(sem) => 0x0
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] rlock = CreateRecursiveLock(0) => 0x65a00ae
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0xf
[Pass] f = FIO_CreateFileEx(CARD_DRIVE"test.dat") => 0x4
[Pass] FIO_WriteFile(f, (void*)ROMBASEADDR, 0x10000) => 0x10000
[Pass] FIO_WriteFile(f, (void*)ROMBASEADDR, 0x10000) => 0x10000
       FIO_CloseFile(f)
[Pass] FIO_GetFileSize(CARD_DRIVE"test.dat", &size) => 0x0
[Pass] size => 0x20000
[Pass] p = alloc_dma_memory(0x20000) => 0x40a47f64
[Pass] f = FIO_Open(CARD_DRIVE"test.dat", O_RDONLY | O_SYNC) => 0x4
[Pass] FIO_ReadFile(f, p, 0x20000) => 0x20000
       FIO_CloseFile(f)
       free_dma_memory(p)
[Pass] FIO_RemoveFile(CARD_DRIVE"test.dat") => 0x0
       SW1(1,100)
[Pass] HALFSHUTTER_PRESSED => 0x1
       SW1(0,100)
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] DLG_SIGNATURE => 0x414944
Title: Re: Low-level API tests for stubs
Post by: jplxpto on November 05, 2012, 02:14:22 AM
40D :


[Pass] strlen("abc") => 0x3
[Pass] strlen("qwertyuiop") => 0xa
[Pass] strlen("") => 0x0
[Pass] strcpy(msg, "hi there") => 0xd2cec
[Pass] msg => 'hi there'
[Pass] snprintf(a, sizeof(a), "foo") => 0x3
[Pass] snprintf(b, sizeof(b), "foo") => 0x3
[Pass] strcmp(a, b) => 0x0
[Pass] snprintf(a, sizeof(a), "bar") => 0x3
[Pass] snprintf(b, sizeof(b), "baz") => 0x3
[Pass] strcmp(a, b) => 0xfffffff8
[Pass] snprintf(a, sizeof(a), "Display") => 0x7
[Pass] snprintf(b, sizeof(b), "Defishing") => 0x9
[Pass] strcmp(a, b) => 0x4
[Pass] memcpy(foo, bar, 6) => 0xd2c20
[Pass] foo => 'asdfghuiop'
[Pass] memset(bar, '*', 5) => 0xd2c00
[Pass] bar => '*****hjkl;'
       bzero32(bar + 5, 5)
[FAIL] bar => '*****'
       t0 = *(uint32_t*)0xC0242014 => 0xd93bf
       msleep(250)
       t1 = *(uint32_t*)0xC0242014 => 0x1a144
[Pass] ABS(mod(t1-t0, 1048576)/1000 - 250) => 0xf
       LoadCalendarFromRTC( &now )
       s0 = now.tm_sec => 0x2a
       Date/time: 2012/11/05 02:04:42
       msleep(1500)
       LoadCalendarFromRTC( &now )
       s1 = now.tm_sec => 0x2b
[Pass] mod(s1-s0, 60) => 0x1
[Pass] mod(s1-s0, 60) => 0x1
       m0 = MALLOC_FREE_MEMORY => 0x0
       p = malloc(50*1024) => 0x84851c
       m1 = MALLOC_FREE_MEMORY => 0x0
       free(p)
       m2 = MALLOC_FREE_MEMORY => 0x0
[FAIL] ABS((m0-m1) - 50*1024) => 0xc800
[Pass] ABS(m0-m2) => 0x0
       m0 = GetFreeMemForAllocateMemory() => 0x344520
       p = AllocateMemory(256*1024) => 0x84851c
       m1 = GetFreeMemForAllocateMemory() => 0x304514
       FreeMemory(p)
       m2 = GetFreeMemForAllocateMemory() => 0x344520
[Pass] ABS((m0-m1) - 256*1024) => 0xc
[Pass] ABS(m0-m2) => 0x0
       m01 = MALLOC_FREE_MEMORY => 0x0
       m02 = GetFreeMemForAllocateMemory() => 0x344520
       p = alloc_dma_memory(256*1024) => 0x1084855c
       free_dma_memory(p)
[Pass] UNCACHEABLE(p) => 0x1084855c
[Pass] CACHEABLE(p) => 0x84855c
[Pass] UNCACHEABLE(CACHEABLE(p)) => 0x1084855c
       p = (void*)shoot_malloc(24*1024*1024) => 0x0
       shoot_free(p)
       m11 = MALLOC_FREE_MEMORY => 0x0
       m12 = GetFreeMemForAllocateMemory() => 0x344338
[Pass] ABS(m01-m11) => 0x0
[Pass] ABS(m02-m12) => 0x1e8
       EngDrvOut(0xC0F14400, 0x1234)
[FAIL] shamem_read(0xC0F14400) => 0x0
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       call("TurnOffDisplay")
[Pass] DISPLAY_IS_ON => 0x0
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       SetGUIRequestMode(1); msleep(500);
[Pass] CURRENT_DIALOG_MAYBE => 0x1
       SetGUIRequestMode(2); msleep(500);
[Pass] CURRENT_DIALOG_MAYBE => 0x2
       SetGUIRequestMode(0); msleep(1000);
[Pass] CURRENT_DIALOG_MAYBE => 0x0
[Pass] display_idle() => 0x1
       GUI_Control(BGMT_PLAY, 0, 0, 0); msleep(500);
[Pass] PLAY_MODE => 0x1
[Pass] MENU_MODE => 0x0
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x1
[Pass] PLAY_MODE => 0x0
[FAIL] MEM(dialog->type) => 0x4c414944
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x0
[Pass] PLAY_MODE => 0x0
       task_create("test", 0x1c, 0x1000, test_task, 0) => 0xff588
[Pass] test_task_created => 0x1
[FAIL] get_task_name_from_id(get_current_task()) => '?'
[Pass] mq = mq ? mq : (void*)msg_queue_create("test", 5) => 0xff51c
[Pass] msg_queue_post(mq, 0x1234567) => 0x0
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x0
[Pass] m => 0x1234567
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x9
[Pass] sem = sem ? sem : create_named_semaphore("test", 1) => 0xff4dc
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] take_semaphore(sem, 500) => 0x9
[Pass] give_semaphore(sem) => 0x0
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] give_semaphore(sem) => 0x0
[Pass] rlock = rlock ? rlock : CreateRecursiveLock(0) => 0xff4b4
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0xf
[Pass] f = FIO_CreateFileEx(CARD_DRIVE"test.dat") => 0x5
[Pass] FIO_WriteFile(f, (void*)ROMBASEADDR, 0x10000) => 0x10000
[Pass] FIO_WriteFile(f, (void*)ROMBASEADDR, 0x10000) => 0x10000
       FIO_CloseFile(f)
[Pass] FIO_GetFileSize(CARD_DRIVE"test.dat", &size) => 0x0
[Pass] size => 0x20000
[Pass] p = alloc_dma_memory(0x20000) => 0x1084855c
[Pass] f = FIO_Open(CARD_DRIVE"test.dat", O_RDONLY | O_SYNC) => 0x5
[Pass] FIO_ReadFile(f, p, 0x20000) => 0x20000
       FIO_CloseFile(f)
       free_dma_memory(p)
[Pass] count => 0x3a98
[Pass] FIO_RemoveFile(CARD_DRIVE"test.dat") => 0x0
       SW1(1,100)
[FAIL] HALFSHUTTER_PRESSED => 0x0
       SW1(0,100)
[Pass] HALFSHUTTER_PRESSED => 0x0


Fails:


bzero32(bar + 5, 5)
[FAIL] bar => '*****'

m0 = MALLOC_FREE_MEMORY => 0x0
       p = malloc(50*1024) => 0x84851c
       m1 = MALLOC_FREE_MEMORY => 0x0
       free(p)
       m2 = MALLOC_FREE_MEMORY => 0x0
[FAIL] ABS((m0-m1) - 50*1024) => 0xc800

EngDrvOut(0xC0F14400, 0x1234)
[FAIL] shamem_read(0xC0F14400) => 0x0

[FAIL] MEM(dialog->type) => 0x4c414944

[FAIL] get_task_name_from_id(get_current_task()) => '?'

SW1(1,100)
[FAIL] HALFSHUTTER_PRESSED => 0x0

Title: Re: Low-level API tests for stubs
Post by: a1ex on November 05, 2012, 07:58:59 AM
#define DIALOG_SIGNATURE 0x4c414944

The others are OK for this early stage :P
Title: Re: Low-level API tests for stubs
Post by: jplxpto on November 06, 2012, 11:58:54 AM
Quote from: a1ex on November 05, 2012, 07:58:59 AM
#define DIALOG_SIGNATURE 0x4c414944

The others are OK for this early stage :P

Thank you :)
Title: Re: Low-level API tests for stubs
Post by: jplxpto on November 08, 2012, 02:08:25 AM
Quote from: a1ex on November 05, 2012, 07:58:59 AM
#define DIALOG_SIGNATURE 0x4c414944

The others are OK for this early stage :P


DLG_SIGNATURE :)