xinetd_tests.sh: support systemd restart
PATCH 1/1 xinetd_tests.sh: support systemd restart
Support xinetd service restart by systemd, which is used in recent Linux releases, e.g. RHEL7.
--- testcases/network/xinetd/xinetd_tests.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
testcases/network/xinetd/xinetd_tests.sh +9 -3
@@ -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
Signature · 13 lines
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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi!
Quoted 2 lines
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?
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ 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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi!
Quoted 5 lines
I guess that the code to control daemons should be isolated from the rest of the
cmdlib.sh(that is obsoleted by thetest.sh). I will move the code to separate library, source it from thecmdlib.shto 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
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ 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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH 1/1 xinetd_test.sh: restart xinetd by restart_daemon()
--- testcases/network/xinetd/xinetd_tests.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
testcases/network/xinetd/xinetd_tests.sh +5 -3
@@ -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
Signature · 13 lines
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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH] xinetd_test.sh: restart xinetd by restart_daemon()
Hi!
Quoted 10 lines
Signed-off-by Simon Xu <[email protected]>--- testcases/network/xinetd/xinetd_tests.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)testcases/network/xinetd/xinetd_tests.sh +0
-0
testcases/network/xinetd/xinetd_tests.sh init() · line 66
Quoted 4 lines
testcases/network/xinetd/xinetd_tests.sh +1
-0@@ -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.
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ 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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH v2 1/1 xinetd_test.sh: restart xinetd by restart_daemon()
--- testcases/network/xinetd/xinetd_tests.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
testcases/network/xinetd/xinetd_tests.sh +4 -3
@@ -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
Signature · 8 lines
1.9.1 ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH V2] xinetd_test.sh: restart xinetd by restart_daemon()
Hi!
Quoted 1 line
Signed-off-by Simon Xu <[email protected]>
Pushed, thanks.
Signature · 8 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list