i wrote a testsuite for the Gentoo sandbox project.  for people unfamiliar 
with this project, it's similar to fakeroot.  a readme with more details:
http://git.overlays.gentoo.org/gitweb/?p=proj/sandbox.git;a=blob;f=README

in order to test this project, i need to be able to easily & quickly run 
specific C library funcs and syscalls.  writing small C files with the right 
args is a pain and doesn't scale at all.  so i wrote a framework from scratch 
which allows poking funcs from the command line:
http://git.overlays.gentoo.org/gitweb/?p=proj/sandbox.git;a=tree;f=tests

strace has need of pretty much the same thing.  atm, it's running higher level 
tools like `stat` and `dd` and `find`, but this gets unmanageable quickly as we 
try to scale to more arches and tests.

rather than hosting the tests in the sandbox or the strace repo (and trying to 
import into the other), it seemed more natural to start a new sub-project 
under the LTP umbrella.  we wouldn't want it to be in the main LTP repo since 
we can't check out subdirs w/git, so it'd have to be a new one.

what do people think ?  any suggestions on a name ?  how about "foker", the 
function poker ?

as an example, i can quickly produce tools like so:
$ ./mkdirat-0 
usage: mkdirat <tests>
test: < <ret> <dirfd> <path> <mode> >

<ret>      := #[,<errno>]; # is a decimal and errno can be symbolic
<dirfd>    := AT_FDCWD | fd # | path[:<flags>[:<mode>]]
<mode>     := 0x# (for hex) | 0# (for octal) | # (for decimal)

$ strace -emkdirat ./mkdirat-0 0 AT_FDCWD dir 0777
mkdirat(AT_FDCWD, "dir", 0777)          = 0

the source file for this contains just enough to describe the signature of the 
mkdirat() function:
#define CONFIG HAVE_MKDIRAT
#define FUNC mkdirat
#define SFUNC "mkdirat"
#define FUNC_STR "%i, \"%s\", %o"
#define FUNC_IMP dirfd, path, mode
#define ARG_CNT 3
#define ARG_USE "<dirfd> <path> <mode>"

#define process_args() \
        s = argv[i++]; \
        int dirfd = at_get_fd(s); \
        \
        s = argv[i++]; \
        char *path = s; \
        \
        s = argv[i++]; \
        mode_t mode = sscanf_mode_t(s);

#include "test-skel-0.c"
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to