Skip to contentSkip to conversation

new sub-project proposal of utility commands for poking funcs/syscalls directly

LTP Mike Frysinger 2 participants 2 messages May 9, 2013

lore
Share & tools
lore
#0 lore raw

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

------------------------------------------------------------------------------
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

#1 lore raw

Hi!

Quoted 10 lines

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

Quoted 8 lines

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.

From a technical point it's quite easy, we can create a repo on github under linux-test-project and possibly link it as git submodule to the main LTP git. But you probably have a solution like this in mind.

Quoted 2 lines

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

It seems to be nice tool. And the name is fine (it's slightly negative according to urban dict, but not as bad as Gimp).

It may be off topic, but similar system could be used to generate quite a lot of LTP testcases. There are far too many cases where the test just calls a function and checks that it succeded and actually did what it should. Given the definition of the API are in separate files (perhaps slightly edhanced) generating LTP testcases should be as easy as including different skeleton. We can even anotate negative testcases as well, for example in case invalid fd is passed, make sure the call returns EBADFD (which may be even usefull for generating strace tests).

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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