All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] cmdlib/end_testcase: don't call tst_cleanup, exit on pass
@ 2013-12-03 11:44 Jiri Jaburek
  2014-02-05 14:14 ` Jiri Jaburek
  2014-02-10 18:03 ` chrubis
  0 siblings, 2 replies; 3+ messages in thread
From: Jiri Jaburek @ 2013-12-03 11:44 UTC (permalink / raw)
  To: ltp-list

Calling tst_cleanup explicitly causes the EXIT trap to be emptied,
removing possible user-defined cleanup routines. It also doesn't make
sense - tst_setup does NOT always set an EXIT trap, only when $TCtmp
is set. And even then, the trap is correctly executed *after*
end_testcase (with this change applied). Removing explicit tst_cleanup
in end_testcase helps scenarios where no trap was set in tst_setup
with the test author being responsible for trapping cleanup.

At least 18 tests already re-define entire end_testcase() exactly
because of this inability to execute custom cleanup.
Applying this change also makes (at least) ssh tests perform correct
cleanup on test failure.

As for the 'exit 0' change - it makes sense from the looks and name
of the function. The following tests use end_testcase without arguments:

network/tcp_cmds/arp/arp01
network/tcp_cmds/echo/echo01
network/tcp_cmds/finger/finger01
network/tcp_cmds/ftp/ftp01
network/tcp_cmds/ftp/ftp02
network/tcp_cmds/ftp/ftp03
network/tcp_cmds/ftp/ftp04
network/tcp_cmds/ftp/ftp05
network/tcp_cmds/host/host01
network/tcp_cmds/netstat/netstat01
network/tcp_cmds/perf_lan/perf_lan
network/tcp_cmds/ping/ping01
network/tcp_cmds/rcp/rcp01
network/tcp_cmds/rdist/rdist01
network/tcp_cmds/rsh/rsh01
network/tcp_cmds/rwho/rwho01
network/tcp_cmds/sendfile/sendfile01
network/tcp_cmds/tcpdump/tcpdump01

and all except one use it only as the last line in the test.

The one exception is network/tcp_cmds/perf_lan/perf_lan, which uses
end_testcase in a trapped handler as well, but - again - as a last cmd.
The 'exit 0' change would actually improve the test, since it's
apparently meant to end when interrupt_testcase is called.

Signed-off-by: Jiri Jaburek <jjaburek@redhat.com>
---
 testcases/lib/cmdlib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/lib/cmdlib.sh b/testcases/lib/cmdlib.sh
index d6f43d2..f5f1cb1 100644
--- a/testcases/lib/cmdlib.sh
+++ b/testcases/lib/cmdlib.sh
@@ -86,9 +86,9 @@ tst_setup()
 #=============================================================================
 end_testcase()
 {
-    tst_cleanup
     if [ $# -eq 0 ]; then
         tst_resm TPASS "Test successful"
+        exit 0
     else
         tst_resm TFAIL "Test broken: $*"
         exit 1
-- 
1.8.3.1


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-10 18:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-03 11:44 [LTP] [PATCH] cmdlib/end_testcase: don't call tst_cleanup, exit on pass Jiri Jaburek
2014-02-05 14:14 ` Jiri Jaburek
2014-02-10 18:03 ` chrubis

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.