[Lsb-messages] /var/www/bzr/lsb/devel/runtime-test r1303: fix initd tests for non-sysv case (bug 4108)

Mats Wichmann mats at linuxfoundation.org
Thu Jun 18 12:30:43 UTC 2015


------------------------------------------------------------
revno: 1303
committer: Mats Wichmann <mats at linuxfoundation.org>
branch nick: runtime-test
timestamp: Thu 2015-06-18 06:30:43 -0600
message:
  fix initd tests for non-sysv case (bug 4108)
modified:
  modules/lsb-initd/tset/ASSERTs
  modules/lsb-initd/tset/Comment.ASSERT
  modules/lsb-initd/tset/initd/misc/init-functions/init-functions.sh
  modules/lsb-initd/tset/initd/misc/install/general.sh
  modules/lsb-initd/tset/initd/misc/utils/utils.sh
  scripts/package/Makefile
-------------- next part --------------
=== modified file 'modules/lsb-initd/tset/ASSERTs'
--- a/modules/lsb-initd/tset/ASSERTs	2005-12-28 07:21:11 +0000
+++ b/modules/lsb-initd/tset/ASSERTs	2015-06-18 12:30:43 +0000
@@ -4,19 +4,21 @@
 
 >># There will be two test init scripts.  Each should be started
 >># in LSB run levels 2,3,4,5 and stopped in run levels 0,1,6 as
->># defined in 20.5 Run Levels. Per 20.4, Installation and Removal
+>># defined in 22.5 Run Levels. Per 22.4, Installation and Removal
 >># of Init Scripts, the init scripts should exist in /etc/init.d
 >># prior to calling install_initd or remove_init. 
 >>#
 >># This test case assumes a SYSV init implementation, so we check
->># the target directories rcN.d where N is the runlevel. We will
+>># the target directories rcN.d where N is the runlevel.  We will
 >># provide a path to the parent directory of rc0.d through rc6.d
+>># If the runtime parameter LSB_INITD_SYSV_INIT is not set, we cannot
+>># make this assumption, and checks relating to rc?.d are omitted.
 >>#
->># There will be 5 tests cases as follows, with the following attributes:
+>># The test init scripts will have the following characteristics:
 >>#	initA will have no dependencies.
 >>#	initB will depend on the boot facility provided by initA
 
->>ASSERTION Good 20.3-1
+>>ASSERTION Good 22.3-1
 >> install_initd shall activate an init script.
 >> Conforming applications may install one or more init scripts. These init
 >> scripts must be activated by invoking the install_initd command. 
@@ -30,7 +32,7 @@
 >> invoked.  The appropriate rcN.d directories will be examined to ensure 
 >> placement of the start and stop scripts.
 
->>ASSERTION Good 20.3-2
+>>ASSERTION Good 22.3-2
 >> install_initd shall activate an init-script that depends on a boot
 >> facility which is available.
 >> install_initd shall succeed if the init script has been successfully
@@ -45,7 +47,7 @@
 >> The approporiate rcN.d directories will be examined to ensure placement
 >> of the start and stop scripts.
 
->>ASSERTION BAD 20.3-3
+>>ASSERTION BAD 22.3-3
 >> install_initd shall not activate an init-script and fail with an exit
 >> status of one if the script depends on a boot facility which is not
 >> available.
@@ -59,7 +61,7 @@
 >> placement of the start and stop scripts.  In this case, there should be 
 >> no start and stop scripts for initA and the return value should be 1.
 
->>ASSERTION Good 20.4-4
+>>ASSERTION Good 22.4-4
 >> remove_initd shall deactivate an init-script.
 >> remove_initd shall succeed if the init script has been successfully
 >> deactivated or if the init script was already deactivated.
@@ -72,7 +74,7 @@
 >> to deactivate the script.  The relevant directories shall be examined to
 >> ensure no start and stop scripts exist in the rcN.d directories.
 
->>ASSERTION Bad 20.4-5
+>>ASSERTION Bad 22.4-5
 >> remove_initd shall not deactivate an init script and fail with an exit
 >> status of one if there is a remaining dependency on the boot facility
 >> provided by the script.
@@ -86,7 +88,7 @@
 >> This should fail with an exit status of one.  All start and stop scripts
 >> should remain unchanged.
 
->>ASSERTION Good 20.8-1
+>>ASSERTION Good 22.8-1
 >> Each conforming init script shall execute the commands in the file 
 >> /lib/lsb/init-functions in the current environment (see shell special
 >> built-in command dot)

=== modified file 'modules/lsb-initd/tset/Comment.ASSERT'
--- a/modules/lsb-initd/tset/Comment.ASSERT	2005-06-15 04:55:31 +0000
+++ b/modules/lsb-initd/tset/Comment.ASSERT	2015-06-18 12:30:43 +0000
@@ -1,4 +1,5 @@
 
 Comments to ASSERTs
 
-Rajesh B points out that some of the positive test cases can be partially verified using data from the conf file.
+Rajesh B points out that some of the positive test cases can be partially
+verified using data from the conf file.

=== modified file 'modules/lsb-initd/tset/initd/misc/init-functions/init-functions.sh'
--- a/modules/lsb-initd/tset/initd/misc/init-functions/init-functions.sh	2008-04-21 14:15:38 +0000
+++ b/modules/lsb-initd/tset/initd/misc/init-functions/init-functions.sh	2015-06-18 12:30:43 +0000
@@ -31,8 +31,8 @@
 
 tp1()
 {
-        tpstart "Reference 20.2-1(A), The file /lib/lsb/init-functions shall exist"
-	tet_infoline "Spec reference: 20.2. Init Script Actions"
+        tpstart "Reference 22.2-1(A), The file /lib/lsb/init-functions shall exist"
+	tet_infoline "Spec reference: 22.2. Init Script Actions"
 	lsb_test_file /lib/lsb/init-functions  >out.stdout 2>out.stderr
         check_exit_value $? 0 
         tpresult                        # set result code
@@ -45,7 +45,7 @@
 
 tp2()
 {
-        tpstart "Reference 20.8-1(A), The /lib/lsb/init-functions file shall define start_daemon in the current environment"
+        tpstart "Reference 22.8-1(A), The /lib/lsb/init-functions file shall define start_daemon in the current environment"
 	command -V start_daemon >out.stderr 2>out.stderr
         check_exit_value $? 0 
         tpresult                        # set result code
@@ -53,7 +53,7 @@
 
 tp3()
 {
-        tpstart "Reference 20.8-2(A), The /lib/lsb/init-functions file shall define killproc in the current environment"
+        tpstart "Reference 22.8-2(A), The /lib/lsb/init-functions file shall define killproc in the current environment"
 	command -V killproc >out.stderr 2>out.stderr
         check_exit_value $? 0 
         tpresult                        # set result code
@@ -62,7 +62,7 @@
 
 tp4()
 {
-        tpstart "Reference 20.8-4(A), The /lib/lsb/init-functions file shall define pidofproc in the current environment"
+        tpstart "Reference 22.8-4(A), The /lib/lsb/init-functions file shall define pidofproc in the current environment"
 	command -V pidofproc >out.stderr 2>out.stderr
         check_exit_value $? 0 
         tpresult                        # set result code
@@ -70,7 +70,7 @@
 
 tp5()
 {
-        tpstart "Reference 20.8-4(A), The /lib/lsb/init-functions file shall define log_success_msg in the current environment"
+        tpstart "Reference 22.8-4(A), The /lib/lsb/init-functions file shall define log_success_msg in the current environment"
 	command -V log_success_msg >out.stderr 2>out.stderr
         check_exit_value $? 0 
         tpresult                        # set result code
@@ -78,7 +78,7 @@
 
 tp6()
 {
-        tpstart "Reference 20.8-5(A), The /lib/lsb/init-functions file shall define log_failure_msg in the current environment"
+        tpstart "Reference 22.8-5(A), The /lib/lsb/init-functions file shall define log_failure_msg in the current environment"
 	command -V log_failure_msg >out.stderr 2>out.stderr
         check_exit_value $? 0 
         tpresult                        # set result code
@@ -86,7 +86,7 @@
 
 tp7()
 {
-        tpstart "Reference 20.8-6(A), The /lib/lsb/init-functions file shall define log_warning_msg in the current environment"
+        tpstart "Reference 22.8-6(A), The /lib/lsb/init-functions file shall define log_warning_msg in the current environment"
 	command -V log_warning_msg >out.stderr 2>out.stderr
         check_exit_value $? 0 
         tpresult                        # set result code

=== modified file 'modules/lsb-initd/tset/initd/misc/install/general.sh'
--- a/modules/lsb-initd/tset/initd/misc/install/general.sh	2008-12-03 21:41:55 +0000
+++ b/modules/lsb-initd/tset/initd/misc/install/general.sh	2015-06-18 12:30:43 +0000
@@ -70,7 +70,7 @@
 
 tp1()
 {
-    tpstart "Reference 20-3.1(C), Testing activation of initscript"
+    tpstart "Reference 22-3.1(C), Testing activation of initscript"
     tet_infoline "An initscript shall be activated by a call to install_initd"
 
     startup_internal
@@ -94,7 +94,7 @@
 
 tp2()
 {
-    tpstart "Reference 20.3-2(C) Testing activation of initscript"
+    tpstart "Reference 22.3-2(C) Testing activation of initscript"
     tet_infoline "If an initscript depends on a boot facility it shall be activated"
     tet_infoline "by a call to install_initd if the dependency is met"
 
@@ -118,15 +118,18 @@
     checkinitfileexists lsb-initA
     checkinitfileexists lsb-initB
 
-    tet_infoline "Check that the installed lsb-initA init script"
-    tet_infoline "is lexically greater than the installed lsb-initB init script"
-    iA=`ls $LSB_INITD_RC_PARENT_DIR/rc2.d/S??lsb-initA`
-    iB=`ls $LSB_INITD_RC_PARENT_DIR/rc2.d/S??lsb-initB`
-    # echo $iA $iB
-    if  expr "$iA" \< "$iB" > /dev/null
+    if [ "$LSB_INITD_SYSV_INIT" = "true" ]
     then
-	tet_infoline "scripts are installed incorrectly, lexically lsb-initA is expected after lsb-initB"
-	FAIL=Y
+	tet_infoline "Check that the installed lsb-initA init script"
+	tet_infoline "is lexically greater than the installed lsb-initB init script"
+	iA=`ls $LSB_INITD_RC_PARENT_DIR/rc2.d/S??lsb-initA`
+	iB=`ls $LSB_INITD_RC_PARENT_DIR/rc2.d/S??lsb-initB`
+	# echo $iA $iB
+	if  expr "$iA" \< "$iB" > /dev/null
+	then
+	    tet_infoline "scripts are installed incorrectly, lexically lsb-initA is expected after lsb-initB"
+	    FAIL=Y
+	fi
     fi
 
     cleanup_internal
@@ -135,7 +138,7 @@
 
 tp3()
 {
-    tpstart "Reference 20.3-3(C) Testing activation of initscript"
+    tpstart "Reference 22.3-3(C) Testing activation of initscript"
     tet_infoline "If an initscript depends on a boot facility it shall not be"
     tet_infoline "activated by a call to install_initd if the dependency is not met"
 
@@ -165,7 +168,7 @@
 
 tp4()
 {
-    tpstart "Reference 20.4-4(C) Testing deactivation of initscript"
+    tpstart "Reference 22.4-4(C) Testing deactivation of initscript"
     tet_infoline "An initscript shall be deactivated by a call to remove_initd"
 
     startup_internal
@@ -199,7 +202,7 @@
 
 tp5()
 {
-    tpstart "Reference 20.4-5(C)  Testing deactivation of initscript"
+    tpstart "Reference 22.4-5(C)  Testing deactivation of initscript"
     tet_infoline "If a boot facility provided by an initscript is depended on by another"
     tet_infoline "initscript the script shall not be deactivated by a call to remove_initd"
 
@@ -354,23 +357,25 @@
 # startup_internal called at the start of each test case
 startup_internal()
 {
-    if [ "$LSB_INITD_SYSV_INIT" != "true" ]
+
+    if [ "$LSB_INITD_SYSV_INIT" = "true" ]
     then
-	return
+	lsb_execwithpriv rm -f $LSB_INITD_RC_PARENT_DIR/rc?.d/*lsb-init* >/dev/null 2>&1
     fi
-
-    lsb_execwithpriv rm -f $LSB_INITD_RC_PARENT_DIR/rc?.d/*lsb-init* >/dev/null 2>&1
     lsb_execwithpriv rm -f /etc/init.d/lsb-initA >/dev/null 2>&1
     lsb_execwithpriv rm -f /etc/init.d/lsb-initB >/dev/null 2>&1
 
     #
-    # Make sure there are no files hanging around
+    # Make sure there are no files hanging around after the above
     # Call test directly rather than lsb_test_file that logs
     # journal entries.
     #
-    if test -e $LSB_INITD_RC_PARENT_DIR/rc?.d/*lsb-init*
+    if [ "$LSB_INITD_SYSV_INIT" = "true" ]
     then
-	FAIL=Y
+	if test -e $LSB_INITD_RC_PARENT_DIR/rc?.d/*lsb-init*
+	then
+	    FAIL=Y
+	fi
     fi
 
     if test -e /etc/init.d/lsb-initA
@@ -382,6 +387,7 @@
     then
 	FAIL=Y
     fi
+
     if [ $FAIL = Y ]
     then
 	tet_infoline "startup_internal():failed to cleanup test files"
@@ -419,13 +425,13 @@
     lsb_execwithpriv $LSB_REMOVE_INITD /etc/init.d/lsb-initA >out.stdout 2> out.stderr
     lsb_execwithpriv $LSB_REMOVE_INITD /etc/init.d/lsb-initB >out.stdout 2> out.stderr
 
+    tet_infoline "Cleanup, remove initscript files, if any"
     if [ "$LSB_INITD_SYSV_INIT" = "true" ]
     then
-        tet_infoline "Cleanup, remove initscript files, if any"
         lsb_execwithpriv rm -f $LSB_INITD_RC_PARENT_DIR/rc?.d/*lsb-init* >/dev/null 2>&1
-        lsb_execwithpriv rm -f /etc/init.d/lsb-initA >/dev/null 2>&1
-        lsb_execwithpriv rm -f /etc/init.d/lsb-initB >/dev/null 2>&1
     fi
+    lsb_execwithpriv rm -f /etc/init.d/lsb-initA >/dev/null 2>&1
+    lsb_execwithpriv rm -f /etc/init.d/lsb-initB >/dev/null 2>&1
 }
 
 # source common shell functions

=== modified file 'modules/lsb-initd/tset/initd/misc/utils/utils.sh'
--- a/modules/lsb-initd/tset/initd/misc/utils/utils.sh	2005-06-20 19:04:54 +0000
+++ b/modules/lsb-initd/tset/initd/misc/utils/utils.sh	2015-06-18 12:30:43 +0000
@@ -27,7 +27,7 @@
 
 tp1()
 {
-        tpstart "Reference 20.3-1 (A)" 
+        tpstart "Reference 22.3-1 (A)" 
         tet_infoline "The implementation provides an exec-able version of the install_initd"
         tet_infoline "utility in the /usr/lib/lsb/ directory. "
 	lsb_execwithpriv test -x /usr/lib/lsb/install_initd 2>out.stderr
@@ -38,7 +38,7 @@
 
 tp2()
 {
-        tpstart "Reference 20.3-2 (A)" 
+        tpstart "Reference 22.3-2 (A)" 
         tet_infoline "The implementation provides an exec-able version of the remove_initd"
         tet_infoline "utility in the /usr/lib/lsb/ directory. "
 	lsb_execwithpriv test -x /usr/lib/lsb/install_initd 2>out.stderr
@@ -50,7 +50,7 @@
 
 tp3()
 {
-	tpstart "Reference 20.3-3(A), The /etc/init.d directory exists, and may be a symbolic link"
+	tpstart "Reference 22.3-3(A), The /etc/init.d directory exists, and may be a symbolic link"
 	if [ ! -e /etc/init.d ]
 	then
 		FAIL=Y

=== modified file 'scripts/package/Makefile'
--- a/scripts/package/Makefile	2015-06-17 13:40:42 +0000
+++ b/scripts/package/Makefile	2015-06-18 12:30:43 +0000
@@ -1,7 +1,7 @@
 # values used to populate .spec from .spec.sed
 PACKAGE=lsb-test-core
 VERSION=5.0.2
-BUILDNO=2
+BUILDNO=3
 # PAM Version
 PVERSION=0.99.8.1
 SYSLOGVER=1.4.2rh



More information about the lsb-messages mailing list