From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [RFC] Getting rid of cleanup parameter
Date: Wed, 11 Nov 2015 14:30:43 +0100 [thread overview]
Message-ID: <20151111133042.GA26695@rei.lan> (raw)
In-Reply-To: <138416734.6863400.1447237258306.JavaMail.zimbra@redhat.com>
Hi!
> Just thinking loud, how this would work:
>
> Is the scope of cleanup set with tst_set_cleanup() going to be per process?
> For example: If I call tst_set_cleanup() and then fork couple children,
> will they automatically ignore cleanup function set in parent?
It has to be per process, since othewise we would have the callback
called twice problem again. I.e. the callback set in test setup() would
be executed only if tst_* call that caused exit was called from the same
process it has been set up.
> Can I use tst_set_cleanup() in child process to setup child-specific
> cleanup function?
Currently I would do it so that only the main test process can setup the
callback in order to make it simpler. Since so far I haven't found a
situation where the parent process cannot easily cleanup after it's
children and doing cleanup once decreases the possibility of races in
concurently executed cleanups. Imaginge 100 children cleaning after
themselves, it's easy to mess up when 100 cleanup functions are running
at the same time.
But if you found good usecase we may also allow per-child cleanups.
> > When the cleanup
> > function was set with this interface the cleanup paramter for all
> > functions would be ignored (we may create static inline wrappers that
> > sets it to NULL to be used from new code).
>
> And perhaps trigger a warning/TBROK if user tries to pass non-NULL
> value while he's using the new tst_set_cleanup() approach.
Yep.
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2015-11-11 13:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-10 14:14 [LTP] [RFC] Getting rid of cleanup parameter Cyril Hrubis
2015-11-11 10:20 ` Jan Stancek
2015-11-11 13:30 ` Cyril Hrubis [this message]
2015-11-11 16:53 ` Jiri Jaburek
2015-11-11 18:45 ` 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=20151111133042.GA26695@rei.lan \
--to=chrubis@suse.cz \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox