* [LTP] [PATCH] xinetd_tests.sh: support systemd restart
@ 2014-03-26 7:29 Simon Xu
2014-03-26 12:03 ` chrubis
0 siblings, 1 reply; 7+ messages in thread
From: Simon Xu @ 2014-03-26 7:29 UTC (permalink / raw)
To: ltp-list
Support xinetd service restart by systemd, which is used in recent
Linux releases, e.g. RHEL7.
Signed-off-by: Simon Xu <xu.simon@oracle.com>
---
testcases/network/xinetd/xinetd_tests.sh | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/testcases/network/xinetd/xinetd_tests.sh b/testcases/network/xinetd/xinetd_tests.sh
index dac23a8..14b5c21 100755
--- a/testcases/network/xinetd/xinetd_tests.sh
+++ b/testcases/network/xinetd/xinetd_tests.sh
@@ -59,6 +59,12 @@ chk_ifexists()
# - non-zero on failure.
init()
{
+ if [ -f "/usr/lib/systemd/system/xinetd.service" ]; then
+ RESTARTCMD="systemctl restart xinetd.service"
+ else
+ RESTARTCMD="/etc/init.d/xinetd restart"
+ fi
+
# Initialize global variables.
export TST_TOTAL=2
export TCID="xinetd"
@@ -226,7 +232,7 @@ cleanup()
sleep 1s
# restoring original services
- /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.err 2>&1
+ $RESTARTCMD > $LTPTMP/tst_xinetd.err 2>&1
RC=$?
if [ $RC -ne 0 ]
then
@@ -285,7 +291,7 @@ test01()
sleep 1s
# restart xinetd to re-start the services
- /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.out 2>&1
+ $RESTARTCMD > $LTPTMP/tst_xinetd.out 2>&1
RC=$?
if [ $RC -ne 0 ]
then
@@ -352,7 +358,7 @@ test01()
sleep 1s
# restart services.
- /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.out 2>&1
+ $RESTARTCMD > $LTPTMP/tst_xinetd.out 2>&1
RC=$?
if [ $RC -ne 0 ]
then
--
1.8.5.4
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] xinetd_tests.sh: support systemd restart
2014-03-26 7:29 [LTP] [PATCH] xinetd_tests.sh: support systemd restart Simon Xu
@ 2014-03-26 12:03 ` chrubis
2014-03-26 13:19 ` chrubis
0 siblings, 1 reply; 7+ messages in thread
From: chrubis @ 2014-03-26 12:03 UTC (permalink / raw)
To: Simon Xu; +Cc: ltp-list
Hi!
> Support xinetd service restart by systemd, which is used in recent
> Linux releases, e.g. RHEL7.
We allready have solution to this problem in testcases/lib/cmdlib.sh see
restart_daemon().
I guess that the code to control daemons should be isolated from the
rest of the cmdlib.sh (that is obsoleted by the test.sh). I will move
the code to separate library, source it from the cmdlib.sh to retain
compatibility and add docs to test-writing-guidelines. Once that is
done, can you fix the test using the library code?
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] xinetd_tests.sh: support systemd restart
2014-03-26 12:03 ` chrubis
@ 2014-03-26 13:19 ` chrubis
2014-03-26 16:27 ` [LTP] [PATCH] xinetd_test.sh: restart xinetd by restart_daemon() Simon Xu
0 siblings, 1 reply; 7+ messages in thread
From: chrubis @ 2014-03-26 13:19 UTC (permalink / raw)
To: Simon Xu; +Cc: ltp-list
Hi!
> I guess that the code to control daemons should be isolated from the
> rest of the cmdlib.sh (that is obsoleted by the test.sh). I will move
> the code to separate library, source it from the cmdlib.sh to retain
> compatibility and add docs to test-writing-guidelines. Once that is
> done, can you fix the test using the library code?
I've pushed the changes now, the docs can be read at:
https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines
in 2.3.4 Restarting daemons
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 7+ messages in thread
* [LTP] [PATCH] xinetd_test.sh: restart xinetd by restart_daemon()
2014-03-26 13:19 ` chrubis
@ 2014-03-26 16:27 ` Simon Xu
2014-03-26 17:00 ` chrubis
0 siblings, 1 reply; 7+ messages in thread
From: Simon Xu @ 2014-03-26 16:27 UTC (permalink / raw)
To: ltp-list
Signed-off-by: Simon Xu <xu.simon@oracle.com>
---
testcases/network/xinetd/xinetd_tests.sh | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/testcases/network/xinetd/xinetd_tests.sh b/testcases/network/xinetd/xinetd_tests.sh
index dac23a8..38cd7b0 100755
--- a/testcases/network/xinetd/xinetd_tests.sh
+++ b/testcases/network/xinetd/xinetd_tests.sh
@@ -63,6 +63,8 @@ init()
export TST_TOTAL=2
export TCID="xinetd"
export TST_COUNT=0
+ export XINETD_DAEMON='xinetd'
+ . daemonlib.sh
# Inititalize cleanup function.
trap "cleanup" 0
@@ -226,7 +228,7 @@ cleanup()
sleep 1s
# restoring original services
- /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.err 2>&1
+ restart_daemon $XINETD_DAEMON > $LTPTMP/tst_xinetd.err 2>&1
RC=$?
if [ $RC -ne 0 ]
then
@@ -285,7 +287,7 @@ test01()
sleep 1s
# restart xinetd to re-start the services
- /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.out 2>&1
+ restart_daemon $XINETD_DAEMON > $LTPTMP/tst_xinetd.out 2>&1
RC=$?
if [ $RC -ne 0 ]
then
@@ -352,7 +354,7 @@ test01()
sleep 1s
# restart services.
- /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.out 2>&1
+ restart_daemon $XINETD_DAEMON > $LTPTMP/tst_xinetd.out 2>&1
RC=$?
if [ $RC -ne 0 ]
then
--
1.9.1
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH] xinetd_test.sh: restart xinetd by restart_daemon()
2014-03-26 16:27 ` [LTP] [PATCH] xinetd_test.sh: restart xinetd by restart_daemon() Simon Xu
@ 2014-03-26 17:00 ` chrubis
2014-03-27 2:26 ` [LTP] [PATCH V2] " Simon Xu
0 siblings, 1 reply; 7+ messages in thread
From: chrubis @ 2014-03-26 17:00 UTC (permalink / raw)
To: Simon Xu; +Cc: ltp-list
Hi!
> Signed-off-by: Simon Xu <xu.simon@oracle.com>
> ---
> testcases/network/xinetd/xinetd_tests.sh | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/testcases/network/xinetd/xinetd_tests.sh b/testcases/network/xinetd/xinetd_tests.sh
> index dac23a8..38cd7b0 100755
> --- a/testcases/network/xinetd/xinetd_tests.sh
> +++ b/testcases/network/xinetd/xinetd_tests.sh
> @@ -63,6 +63,8 @@ init()
> export TST_TOTAL=2
> export TCID="xinetd"
> export TST_COUNT=0
> + export XINETD_DAEMON='xinetd'
I would be for passing the xinetd directly to the restart_daemon (just
calling restart_daemon xinetd) function unless you know that there is a
distribution that named it differently and we will need the runtime name
detection.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 7+ messages in thread
* [LTP] [PATCH V2] xinetd_test.sh: restart xinetd by restart_daemon()
2014-03-26 17:00 ` chrubis
@ 2014-03-27 2:26 ` Simon Xu
2014-03-27 13:54 ` chrubis
0 siblings, 1 reply; 7+ messages in thread
From: Simon Xu @ 2014-03-27 2:26 UTC (permalink / raw)
To: ltp-list
Signed-off-by: Simon Xu <xu.simon@oracle.com>
---
testcases/network/xinetd/xinetd_tests.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/testcases/network/xinetd/xinetd_tests.sh b/testcases/network/xinetd/xinetd_tests.sh
index dac23a8..813a3f3 100755
--- a/testcases/network/xinetd/xinetd_tests.sh
+++ b/testcases/network/xinetd/xinetd_tests.sh
@@ -63,6 +63,7 @@ init()
export TST_TOTAL=2
export TCID="xinetd"
export TST_COUNT=0
+ . daemonlib.sh
# Inititalize cleanup function.
trap "cleanup" 0
@@ -226,7 +227,7 @@ cleanup()
sleep 1s
# restoring original services
- /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.err 2>&1
+ restart_daemon xinetd > $LTPTMP/tst_xinetd.err 2>&1
RC=$?
if [ $RC -ne 0 ]
then
@@ -285,7 +286,7 @@ test01()
sleep 1s
# restart xinetd to re-start the services
- /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.out 2>&1
+ restart_daemon xinetd > $LTPTMP/tst_xinetd.out 2>&1
RC=$?
if [ $RC -ne 0 ]
then
@@ -352,7 +353,7 @@ test01()
sleep 1s
# restart services.
- /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.out 2>&1
+ restart_daemon xinetd > $LTPTMP/tst_xinetd.out 2>&1
RC=$?
if [ $RC -ne 0 ]
then
--
1.9.1
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH V2] xinetd_test.sh: restart xinetd by restart_daemon()
2014-03-27 2:26 ` [LTP] [PATCH V2] " Simon Xu
@ 2014-03-27 13:54 ` chrubis
0 siblings, 0 replies; 7+ messages in thread
From: chrubis @ 2014-03-27 13:54 UTC (permalink / raw)
To: Simon Xu; +Cc: ltp-list
Hi!
> Signed-off-by: Simon Xu <xu.simon@oracle.com>
Pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-03-27 13:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-26 7:29 [LTP] [PATCH] xinetd_tests.sh: support systemd restart Simon Xu
2014-03-26 12:03 ` chrubis
2014-03-26 13:19 ` chrubis
2014-03-26 16:27 ` [LTP] [PATCH] xinetd_test.sh: restart xinetd by restart_daemon() Simon Xu
2014-03-26 17:00 ` chrubis
2014-03-27 2:26 ` [LTP] [PATCH V2] " Simon Xu
2014-03-27 13:54 ` chrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox