All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it, Mimi Zohar <zohar@linux.vnet.ibm.com>,
	Ignaz Forster <iforster@suse.de>, Fabian Vogt <FVogt@suse.com>,
	Marcus Meissner <meissner@suse.com>,
	linux-integrity@vger.kernel.org
Subject: Re: [PATCH v2 1/3] ima: Call test's cleanup inside ima_setup.sh cleanup
Date: Thu, 11 Apr 2019 08:22:19 -0400	[thread overview]
Message-ID: <1554985339.7843.18.camel@linux.ibm.com> (raw)
In-Reply-To: <20190411055114.GA23472@x230>

On Thu, 2019-04-11 at 07:51 +0200, Petr Vorel wrote:
> Hi Mimi,
> 
> thanks for your comments.
> 
> ...
> > > +++ b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
> > > @@ -20,7 +20,8 @@
> > >  TST_TESTFUNC="test"
> > >  TST_SETUP_CALLER="$TST_SETUP"
> > >  TST_SETUP="ima_setup"
> > > -TST_CLEANUP="${TST_CLEANUP:-ima_cleanup}"
> > > +TST_CLEANUP_CALLER="$TST_CLEANUP"
> > > +TST_CLEANUP="ima_cleanup"
> 
> > It seems to be working, but defining TST_SETUP and TST_CLEANUP after
> > defining the respective _CALLER looks strange.  The _CALLER's string
> > must be empty.
> TST_{SETUP,CALLER}_CALLER takes setup from the test.
> It's IMHO cleaner way allowing tests to set their setup/cleanup functions and
> not care that there is also some library setup/cleanup (kind of encapsulation).

I'm not questioning the method for initializing this test.  I guess
I'm asking why bother to set TST_{SETUP,CLEANUP}_CALLER this way, if
we know that it isn't set.  Why not just initialize it as ""?

Mimi
> 
> We already used this for setup, I wanted to have a same approach for both setup
> and cleanup. Sure I can instead add ima_setup/ima_cleanup into tests' setup/cleanup
> functions, but both solutions are working and I consider encapsulation as a benefit.
> The only problematic thing would be if some test needed to run it's custom
> cleanup *before* library one while other tests *after*. But that's not a case here.
> We also use this approach in tst_net.sh [1].
> 
> > >  TST_NEEDS_TMPDIR=1
> > >  TST_NEEDS_ROOT=1
> 
> > > @@ -95,6 +96,9 @@ ima_setup()
> > >  ima_cleanup()
> > >  {
> > >  	local dir
> > > +
> > > +	[ -n "$TST_CLEANUP_CALLER" ] && $TST_CLEANUP_CALLER
> > > +
> 
> > Is something else setting TST_CLEANUP_CALLER?
> 
> 
> Kind regards,
> Petr
> 
> [1] https://github.com/linux-test-project/ltp/blob/master/testcases/lib/tst_net.sh#L11
> 


WARNING: multiple messages have this Message-ID (diff)
From: Mimi Zohar <zohar@linux.ibm.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 1/3] ima: Call test's cleanup inside ima_setup.sh cleanup
Date: Thu, 11 Apr 2019 08:22:19 -0400	[thread overview]
Message-ID: <1554985339.7843.18.camel@linux.ibm.com> (raw)
In-Reply-To: <20190411055114.GA23472@x230>

On Thu, 2019-04-11 at 07:51 +0200, Petr Vorel wrote:
> Hi Mimi,
> 
> thanks for your comments.
> 
> ...
> > > +++ b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
> > > @@ -20,7 +20,8 @@
> > >  TST_TESTFUNC="test"
> > >  TST_SETUP_CALLER="$TST_SETUP"
> > >  TST_SETUP="ima_setup"
> > > -TST_CLEANUP="${TST_CLEANUP:-ima_cleanup}"
> > > +TST_CLEANUP_CALLER="$TST_CLEANUP"
> > > +TST_CLEANUP="ima_cleanup"
> 
> > It seems to be working, but defining TST_SETUP and TST_CLEANUP after
> > defining the respective _CALLER looks strange.  The _CALLER's string
> > must be empty.
> TST_{SETUP,CALLER}_CALLER takes setup from the test.
> It's IMHO cleaner way allowing tests to set their setup/cleanup functions and
> not care that there is also some library setup/cleanup (kind of encapsulation).

I'm not questioning the method for initializing this test.  I guess
I'm asking why bother to set TST_{SETUP,CLEANUP}_CALLER this way, if
we know that it isn't set.  Why not just initialize it as ""?

Mimi
> 
> We already used this for setup, I wanted to have a same approach for both setup
> and cleanup. Sure I can instead add ima_setup/ima_cleanup into tests' setup/cleanup
> functions, but both solutions are working and I consider encapsulation as a benefit.
> The only problematic thing would be if some test needed to run it's custom
> cleanup *before* library one while other tests *after*. But that's not a case here.
> We also use this approach in tst_net.sh [1].
> 
> > >  TST_NEEDS_TMPDIR=1
> > >  TST_NEEDS_ROOT=1
> 
> > > @@ -95,6 +96,9 @@ ima_setup()
> > >  ima_cleanup()
> > >  {
> > >  	local dir
> > > +
> > > +	[ -n "$TST_CLEANUP_CALLER" ] && $TST_CLEANUP_CALLER
> > > +
> 
> > Is something else setting TST_CLEANUP_CALLER?
> 
> 
> Kind regards,
> Petr
> 
> [1] https://github.com/linux-test-project/ltp/blob/master/testcases/lib/tst_net.sh#L11
> 


  reply	other threads:[~2019-04-11 12:22 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-05 16:52 [PATCH v2 0/3] LTP reproducer on broken IMA on overlayfs Petr Vorel
2019-04-05 16:52 ` [LTP] " Petr Vorel
2019-04-05 16:52 ` [PATCH v2 1/3] ima: Call test's cleanup inside ima_setup.sh cleanup Petr Vorel
2019-04-05 16:52   ` [LTP] " Petr Vorel
2019-04-11  0:59   ` Mimi Zohar
2019-04-11  0:59     ` [LTP] " Mimi Zohar
2019-04-11  5:51     ` Petr Vorel
2019-04-11  5:51       ` [LTP] " Petr Vorel
2019-04-11 12:22       ` Mimi Zohar [this message]
2019-04-11 12:22         ` Mimi Zohar
2019-04-11 20:21         ` Petr Vorel
2019-04-11 20:21           ` [LTP] " Petr Vorel
2019-04-05 16:52 ` [PATCH v2 2/3] shell: Add $TST_DEVICE as default parameter to tst_umount Petr Vorel
2019-04-05 16:52   ` [LTP] " Petr Vorel
2019-04-05 16:52 ` [PATCH v2 3/3] ima: Add overlay test Petr Vorel
2019-04-05 16:52   ` [LTP] " Petr Vorel
2019-05-14 18:42   ` Ignaz Forster
2019-05-14 18:42     ` [LTP] " Ignaz Forster
2019-05-15 11:32     ` Petr Vorel
2019-05-15 11:32       ` [LTP] " Petr Vorel
2019-05-14 12:12 ` [PATCH v2 0/3] LTP reproducer on broken IMA on overlayfs Petr Vorel
2019-05-14 12:12   ` [LTP] " Petr Vorel
2019-05-14 19:19   ` Ignaz Forster
2019-05-14 19:19     ` [LTP] " Ignaz Forster
2019-05-15 11:34     ` Petr Vorel
2019-05-15 11:34       ` [LTP] " Petr Vorel
2019-05-15  3:01   ` Mimi Zohar
2019-05-15  3:01     ` [LTP] " Mimi Zohar
2019-05-15 12:08     ` Petr Vorel
2019-05-15 12:08       ` [LTP] " Petr Vorel
2019-05-16 22:10       ` Mimi Zohar
2019-05-16 22:10         ` [LTP] " Mimi Zohar
2019-05-17  7:50         ` Petr Vorel
2019-05-17  7:50           ` [LTP] " Petr Vorel
2019-05-17 11:00           ` Mimi Zohar
2019-05-17 11:00             ` [LTP] " Mimi Zohar
2019-05-17 15:41             ` Petr Vorel
2019-05-17 15:41               ` [LTP] " Petr Vorel

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=1554985339.7843.18.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=FVogt@suse.com \
    --cc=iforster@suse.de \
    --cc=linux-integrity@vger.kernel.org \
    --cc=ltp@lists.linux.it \
    --cc=meissner@suse.com \
    --cc=pvorel@suse.cz \
    --cc=zohar@linux.vnet.ibm.com \
    /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.