[Initscripts-ng-commits] r479 - in /trunk/src/insserv/debian: changelog run-testsuite testsuite-common

pere at users.alioth.debian.org pere at users.alioth.debian.org
Tue Jan 8 15:33:47 UTC 2008


Author: pere
Date: Tue Jan  8 15:33:47 2008
New Revision: 479

URL: http://svn.debian.org/wsvn/initscripts-ng/?sc=1&rev=479
Log:
  * Split test suite into two files, one generic part
    (testsuite-common) and one Debian specific part (run-testsuite).

Added:
    trunk/src/insserv/debian/testsuite-common
Modified:
    trunk/src/insserv/debian/changelog
    trunk/src/insserv/debian/run-testsuite

Modified: trunk/src/insserv/debian/changelog
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/changelog?rev=479&op=diff
==============================================================================
--- trunk/src/insserv/debian/changelog (original)
+++ trunk/src/insserv/debian/changelog Tue Jan  8 15:33:47 2008
@@ -2,6 +2,8 @@
 
   * Implement new check-initd-order option -c to be used with -g to
     generate a combined graph for boot and shutdown dependencies.
+  * Split test suite into two files, one generic part
+    (testsuite-common) and one Debian specific part (run-testsuite).
 
  -- Petter Reinholdtsen <pere at debian.org>  Mon,  8 Jan 2008 16:37:53 +0100
 

Modified: trunk/src/insserv/debian/run-testsuite
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/run-testsuite?rev=479&op=diff
==============================================================================
--- trunk/src/insserv/debian/run-testsuite (original)
+++ trunk/src/insserv/debian/run-testsuite Tue Jan  8 15:33:47 2008
@@ -1,97 +1,21 @@
 #!/bin/sh
 
-set -e
-
-tmpdir=`pwd`/testdir
-initddir=$tmpdir/etc/init.d
-
-insserv=`pwd`/insserv
-# Relative to $tmpdir
-insconf=/etc/insserv.conf
-overridedir=$tmpdir/etc/insserv/override
-
-retval=0
-
-mkdir -p $initddir
-
-#debug="-v"
+basedir=$(dirname $0)
+. $basedir/testsuite-common
+
+runlevel_path() {
+    runlevel=$1
+    echo $initddir/../rc$runlevel.d/
+}
+
+list_rclinks() {
+    (cd $initddir/../. && ls *)
+}
 
 insserv_reg() {
     script=$initddir/$1
     $insserv $debug -c $insconf -p $initddir -o $overridedir $script
 }
-
-addscript() {
-    scriptname=$1
-    script=$initddir/$scriptname
-    cat > $script
-    chmod a+rx $script
-}
-
-insertscript() {
-    scriptname=$1
-    addscript $scriptname
-    insserv_reg $scriptname
-}
-
-check_script_present() {
-    runlevel=$1
-    script=$2
-    present="$(echo $(cd $initddir/../rc$runlevel.d/; ls *$script 2>/dev/null) )"
-    if [ "$present" ] ; then
-	return 0
-    fi
-    return 1;
-}
-
-check_script_not_present() {
-    runlevel=$1
-    script=$2
-    present="$(echo $(cd $initddir/../rc$runlevel.d/; ls *$script 2>/dev/null) )"
-    if [ "$present" ] ; then
-	return 1
-    fi
-    return 0;
-}
-
-order_ok() {
-    runlevel=$1
-    script1=$2
-    script2=$3
-    order="$(echo $(cd $initddir/../rc$runlevel.d/; ls *$script1 *$script2 2>/dev/null | sed 's/[SK]..//') )"
-    if [ "$order" != "$script1 $script2" ] ; then
-	return 0
-    fi
-    return 1;
-}
-
-error() {
-    echo error: $@
-    retval=1
-}
-
-warning() {
-    echo warning: $@
-}
-
-# Fatal check
-check_order() {
-    if order_ok $@ ; then
-	error "incorrect $runlevel sequence $script1 not before $script2"
-    fi
-}
-
-# Non-fatal check
-test_order() {
-    if order_ok $@ ; then
-	warning "incorrect $runlevel sequence $script1 not before $script2"
-    fi
-}
-
-on_exit() {
-    rm -rf $tmpdir
-}
-trap on_exit EXIT # Enable cleanup handler
 
 echo
 echo "info: test normal boot sequence scripts, and their order"
@@ -366,7 +290,7 @@
 insertscript nolsbheader <<'EOF'
 EOF
 
-(cd $initddir/../. && ls *)
+list_rclinks
 
 check_order S mountkernfs.sh mountdevsubfs.sh
 check_order S ifupdown-clean ifupdown
@@ -394,6 +318,8 @@
 check_order 6 umountroot kexec
 check_order 6 kexec reboot
 
+exit 0
+
 echo
 echo "info: test if override files replace headers in the file"
 echo
@@ -437,7 +363,7 @@
 
 insserv_reg mover
 
-(cd $initddir/../. && ls *)
+list_rclinks
 
 # Make sure the override file moved mover before base
 check_order S mover base
@@ -566,7 +492,7 @@
 ### END INIT INFO
 EOF
 
-(cd $initddir/../. && ls *)
+list_rclinks
 
 test_order S startfirst startsecond
 test_order 6 startsecond startfirst
@@ -602,7 +528,7 @@
 ### END INIT INFO
 EOF
 
-(cd $initddir/../. && ls *)
+list_rclinks
 
 # Test another fake loop using reverse dependencies to document that
 # it can happen based on information provided in one package only.
@@ -639,7 +565,7 @@
 ### END INIT INFO
 EOF
 
-(cd $initddir/../. && ls *)
+list_rclinks
 
 # These are checking real bugs, but until bug #458582 is fixed, they
 # will fail.  Making the tests non-fatal because of this.
@@ -673,13 +599,8 @@
 ### END INIT INFO
 EOF
 
-(cd $initddir/../. && ls *)
+list_rclinks
 
 check_script_present S distroglobal
 
-if [ 0 != $retval ] ; then
-    echo "error: one or more test failed."
-else
-    echo "success: no test failed."
-fi
-exit $retval
+finish_test

Added: trunk/src/insserv/debian/testsuite-common
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/testsuite-common?rev=479&op=file
==============================================================================
--- trunk/src/insserv/debian/testsuite-common (added)
+++ trunk/src/insserv/debian/testsuite-common Tue Jan  8 15:33:47 2008
@@ -1,0 +1,101 @@
+#!/bin/sh
+
+set -e
+
+tmpdir=`pwd`/testdir
+initddir=$tmpdir/etc/init.d
+
+insserv=`pwd`/insserv
+# Relative to $tmpdir
+insconf=/etc/insserv.conf
+overridedir=$tmpdir/etc/insserv/override
+
+retval=0
+
+mkdir -p $initddir
+
+#debug="-v"
+
+# The specific test suites need to define runlevel_path(),
+# list_rclinks() and insserv_reg().
+
+addscript() {
+    scriptname=$1
+    script=$initddir/$scriptname
+    cat > $script
+    chmod a+rx $script
+}
+
+insertscript() {
+    scriptname=$1
+    addscript $scriptname
+    insserv_reg $scriptname
+}
+
+check_script_present() {
+    runlevel=$1
+    script=$2
+    present="$(echo $(cd $(runlevel_path $runlevel); ls *$script 2>/dev/null) )"
+    if [ "$present" ] ; then
+	return 0
+    fi
+    return 1;
+}
+
+check_script_not_present() {
+    runlevel=$1
+    script=$2
+    present="$(echo $(cd $(runlevel_path $runlevel); ls *$script 2>/dev/null) )"
+    if [ "$present" ] ; then
+	return 1
+    fi
+    return 0;
+}
+
+order_ok() {
+    runlevel=$1
+    script1=$2
+    script2=$3
+    order="$(echo $(cd $(runlevel_path $runlevel); ls *$script1 *$script2 2>/dev/null | sed 's/[SK]..//') )"
+    if [ "$order" != "$script1 $script2" ] ; then
+	return 0
+    fi
+    return 1;
+}
+
+error() {
+    echo error: $@
+    retval=1
+}
+
+warning() {
+    echo warning: $@
+}
+
+# Fatal check
+check_order() {
+    if order_ok $@ ; then
+	error "incorrect $runlevel sequence $script1 not before $script2"
+    fi
+}
+
+# Non-fatal check
+test_order() {
+    if order_ok $@ ; then
+	warning "incorrect $runlevel sequence $script1 not before $script2"
+    fi
+}
+
+finish_test() {
+    if [ 0 != $retval ] ; then
+	echo "error: one or more test failed."
+    else
+	echo "success: no test failed."
+    fi
+    exit $retval
+}
+
+on_exit() {
+    rm -rf $tmpdir
+}
+trap on_exit EXIT # Enable cleanup handler




More information about the Initscripts-ng-commits mailing list