From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] Test library API changes
Date: Wed, 17 Feb 2016 09:39:21 -0500 (EST) [thread overview]
Message-ID: <1799339064.21851637.1455719961718.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20160216211958.GC2515@rei.lan>
----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp@lists.linux.it
> Sent: Tuesday, 16 February, 2016 10:19:58 PM
> Subject: Re: [LTP] Test library API changes
>
> Hi!
> The up to date code is at the same place as usual.
> (https://github.com/metan-ucw/ltp)
>
> Apart from added support of acquiring a device, checkpoints and
> resource files the IPC was rewritten to shared memory.
>
> Now the library, before the test is started, mmaps a page backed by a
> file on /dev/shm/. The first few bytes are used for shared struct
> results, the rest is used by checkpoints if checkpoints are needed. The
> struct result values are incremented by gcc atomic operations (which is
> thread safe as well), the open question is if we need a fallback to
> inline assembler if these are not supported. Then there is a special
> function to open checkpoint shm file from a process started by a exec (a
> few of the testcases does so) since it must open the shm rather than a
> file in a temporary directory.
>
> There are still some rough edges and the code should be reviewed, but at
> least 90% of the functionality is there and working.
>
> As usuall comments are welcome :)
Hi,
My first impression of this version is that it looks simpler,
I find it easier to follow, but that could also be explained
by fact that I'm reading it for 3rd time :-).
Here are some comments/questions/ideas:
1. acnt appears to be unused now
2. Can we keep ltp_syscall() and call correct brk func with some magic?
3. new/old files names do not follow obvious pattern
For example: tst_dev.h vs tst_device.h
I'm thinking if we can give all old same kind of prefix, like tst1_*
to distinguish them from new api files.
4. ipc_fd = open(name, O_CREAT | O_EXCL | O_RDWR, 0600);
Should we allow other users to read/write too? For example,
what if I change euid and then fork? Or do we expect to always
fork and then change euid?
5. setup_ipc ideas/comments (some of these are connected)
5a) Why not always setup results and checkpoints?
If we always map file, it doesn't cost us anything
to initialize checkpoints. needs_checkpoints could be
removed.
Also processes spawned via exec could report results
easily to main process if we always initialized both.
5b) split setup_ipc into setup_ipc and open_ipc,
That should eliminate some code from tst_checkpoint_open()
5c) What if we stored ipc path to env variable?
setup_ipc
generates tmp name based on test name: ltp_ipc_path
for convenience will initialize also envp array:
ltp_only_ipc_env[] = { "LTP_IPC_PATH="$ltp_ipc_path, NULL }
creates ipc file
open_ipc(ipc_path)
if results and checkpoints already initialized
return
if ipc_path == NULL
ipc_path = getenv("LTP_IPC_PATH")
if ipc_path == NULL
brk()
open ipc file and initialize both results and checkpoints
TST_CHECKPOINT_INIT calls open_ipc(NULL)
process spawned via exec could call either of them,
effect would be the same
5d) Always unlink ipc file in setup if we have /proc
Main pid keeps file open and unlinks it.
ltp_ipc_path would be set to "/proc/$main_pid/fd/$fd"
Regards,
Jan
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>
next prev parent reply other threads:[~2016-02-17 14:39 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-05 11:11 [LTP] Test library API changes Cyril Hrubis
2016-01-07 13:01 ` Jan Stancek
2016-01-07 13:27 ` Cyril Hrubis
2016-02-04 10:56 ` Cyril Hrubis
2016-02-08 18:02 ` Cyril Hrubis
2016-02-09 16:43 ` Cyril Hrubis
2016-02-09 16:57 ` Cyril Hrubis
2016-02-09 17:46 ` Cyril Hrubis
2016-02-10 10:42 ` Jan Stancek
2016-02-10 10:56 ` Cyril Hrubis
2016-02-10 11:41 ` Cyril Hrubis
2016-02-11 16:03 ` Cyril Hrubis
2016-02-12 12:33 ` Jan Stancek
2016-02-12 17:53 ` Cyril Hrubis
2016-02-16 21:19 ` Cyril Hrubis
2016-02-17 14:39 ` Jan Stancek [this message]
2016-02-17 15:54 ` Cyril Hrubis
2016-02-18 9:05 ` Jan Stancek
2016-02-18 11:07 ` Cyril Hrubis
2016-02-18 11:26 ` Jan Stancek
2016-02-18 11:53 ` Cyril Hrubis
2016-03-02 14:44 ` Cyril Hrubis
2016-03-03 13:13 ` Jan Stancek
2016-03-03 14:00 ` Cyril Hrubis
2016-03-10 16:57 ` Cyril Hrubis
2016-03-11 13:57 ` Jan Stancek
2016-03-14 12:51 ` Cyril Hrubis
2016-03-14 16:00 ` Cyril Hrubis
2016-03-15 8:58 ` Jan Stancek
2016-03-15 9:22 ` Cyril Hrubis
2016-03-17 16:06 ` Cyril Hrubis
2016-03-18 9:44 ` Jan Stancek
2016-03-31 10:01 ` Cyril Hrubis
2016-04-01 14:45 ` Jan Stancek
2016-04-04 12:04 ` Cyril Hrubis
2016-04-04 14:12 ` Jan Stancek
2016-04-05 14:16 ` Cyril Hrubis
2016-04-05 15:06 ` Jan Stancek
2016-04-06 10:37 ` Cyril Hrubis
2016-03-14 16:40 ` Cyril Hrubis
2016-02-18 9:14 ` Alexey Kodanev
2016-02-18 10:40 ` Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1799339064.21851637.1455719961718.JavaMail.zimbra@redhat.com \
--to=jstancek@redhat.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.