[Yaffs] Python test harness for yaffs

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Charles Manning
Date:  
To: yaffs
Subject: [Yaffs] Python test harness for yaffs
Hi All

I've added a python test harness to yaffs2/direct/python. This has been done
as a way to streamline testing as well as give a reason/excuse to learn some
python.

This uses the python ctypes mechanism. I started with SWIG, but some hassles
and a discussion on the nzpug mailing list soon pointed me towards ctypes
which has proven to be a lot simpler.

-- Charles


$ make

$ python
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from yaffsfs import *
>>> yaffs_StartUp()

0
>>> yaffs_mount("/yaffs2")

0
>>> yaffs_open("/yaffs2/xx",66,0666)

yaffs: Tnodes added
Allocated block 1, seq 4097, 255 left
0
>>> yaffs_write(0,"abcdefg",5)

5
>>> b = create_string_buffer("",100)
>>> yaffs_lseek(0,0,0)

0
>>> yaffs_read(0,b,100)

5
>>> print b.value

abcde

...