[Initscripts-ng-commits] r446 - /trunk/src/insserv/debian/run-testsuite

pere at users.alioth.debian.org pere at users.alioth.debian.org
Sat Jan 5 09:03:34 UTC 2008


Author: pere
Date: Sat Jan  5 09:03:34 2008
New Revision: 446

URL: http://svn.debian.org/wsvn/initscripts-ng/?sc=1&rev=446
Log:
New check to make sure that it is now allowed to introduce new loops in the dependency graph.

Modified:
    trunk/src/insserv/debian/run-testsuite

Modified: trunk/src/insserv/debian/run-testsuite
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/run-testsuite?rev=446&op=diff
==============================================================================
--- trunk/src/insserv/debian/run-testsuite (original)
+++ trunk/src/insserv/debian/run-testsuite Sat Jan  5 09:03:34 2008
@@ -39,18 +39,26 @@
     return 1;
 }
 
+error() {
+    echo error: $@
+    retval=1
+}
+
+warning() {
+    echo warning: $@
+}
+
 # Fatal check
 check_order() {
     if order_ok $@ ; then
-	echo "error: incorrect $runlevel sequence $script1 not before $script2"
-	retval=1
+	error "incorrect $runlevel sequence $script1 not before $script2"
     fi
 }
 
 # Non-fatal check
 test_order() {
     if order_ok $@ ; then
-	echo "warning: incorrect $runlevel sequence $script1 not before $script2"
+	warning "incorrect $runlevel sequence $script1 not before $script2"
     fi
 }
 
@@ -415,7 +423,7 @@
 mkdir -p $initddir
 
 # Two scripts with a loop between them
-insertscript loop1 <<'EOF' || true
+if insertscript loop1 <<'EOF' ; then
 ### BEGIN INIT INFO
 # Provides:          loop1
 # Required-Start:    loop2
@@ -424,6 +432,8 @@
 # Default-Stop:
 ### END INIT INFO
 EOF
+    error "inserting script with missing dependencies did not fail"
+fi
 
 insertscript loop2 <<'EOF' || true
 ### BEGIN INIT INFO
@@ -451,6 +461,48 @@
 insserv_reg loop2 || true
 
 check_order S loop1 loop2
+
+echo
+echo "info: testing to insert scripts with a longer loop, making sure it fail"
+echo
+rm -rf $initddir
+mkdir -p $initddir
+
+# Three scripts with a loop between them, make sure introducing the
+# loop fail, as it will make insserv generate a unstable and broken
+# boot and shutdown sequence.
+insertscript loop1 <<'EOF'
+### BEGIN INIT INFO
+# Provides:          loop1
+# Required-Start:
+# Required-Stop:
+# Default-Start:     S
+# Default-Stop:
+### END INIT INFO
+EOF
+
+insertscript loop2 <<'EOF' || true
+### BEGIN INIT INFO
+# Provides:          loop2
+# Required-Start:    loop1
+# Required-Stop:
+# Default-Start:     S
+# Default-Stop:
+### END INIT INFO
+EOF
+
+if insertscript loop3 <<'EOF' ; then
+### BEGIN INIT INFO
+# Provides:          loop3
+# Required-Start:    loop2
+# Required-Stop:
+# X-Start-Before:    loop1
+# Default-Start:     S
+# Default-Stop:
+### END INIT INFO
+EOF
+    error "inserting script causing a loop did not fail"
+fi
 
 # Test real loop in the combined start and stop sequence.  There is no
 # loop in the start sequence, and no loop in the stop sequence, but in




More information about the Initscripts-ng-commits mailing list