[Initscripts-ng-commits] r1103 - in /trunk/src/insserv/debian: changelog patches/210_systemd_path_option.patch patches/series run-testsuite
pere at users.alioth.debian.org
pere at users.alioth.debian.org
Tue Feb 18 11:59:31 UTC 2014
Author: pere
Date: Tue Feb 18 11:59:31 2014
New Revision: 1103
URL: http://svn.debian.org/wsvn/initscripts-ng/?sc=1&rev=1103
Log:
Added new patch 210_systemd_path_option.patch to make it possible to
control the path to the detected systemd binary, to make it easier
to test with and without talking to systemd.
Added:
trunk/src/insserv/debian/patches/210_systemd_path_option.patch
Modified:
trunk/src/insserv/debian/changelog
trunk/src/insserv/debian/patches/series
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=1103&op=diff
==============================================================================
--- trunk/src/insserv/debian/changelog (original)
+++ trunk/src/insserv/debian/changelog Tue Feb 18 11:59:31 2014
@@ -7,6 +7,9 @@
* Remove unused debian debconf template translations.
* Add new testsuite test test_cross_runlevel_dep to try to reproduce
bug #738775. No luck so far.
+ * Added new patch 210_systemd_path_option.patch to make it possible to
+ control the path to the detected systemd binary, to make it easier
+ to test with and without talking to systemd.
-- Petter Reinholdtsen <pere at debian.org> Wed, 12 Feb 2014 23:47:35 +0100
Added: trunk/src/insserv/debian/patches/210_systemd_path_option.patch
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/patches/210_systemd_path_option.patch?rev=1103&op=file
==============================================================================
--- trunk/src/insserv/debian/patches/210_systemd_path_option.patch (added)
+++ trunk/src/insserv/debian/patches/210_systemd_path_option.patch Tue Feb 18 11:59:31 2014
@@ -0,0 +1,206 @@
+Description: make path to systemd binary an option, for testing
+ Make it possible to test with and without the systemd binary
+ present in the test suite, by making the path an option.
+Author: Petter Reinholdtsen <pere at debian.org>
+
+---
+The information above should follow the Patch Tagging Guidelines, please
+checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Origin: <vendor|upstream|other>, <url of original patch>
+Forwarded: no
+Reviewed-By: Petter Reinholdtsen <pere at hungry.com>
+Last-Update: 2014-02-18
+
+Index: insserv/insserv.c
+===================================================================
+--- insserv.orig/insserv.c 2014-02-18 12:30:46.154080868 +0100
++++ insserv/insserv.c 2014-02-18 12:30:46.394082174 +0100
+@@ -2687,6 +2687,7 @@
+ {"upstart-job", 1, (int*)0, 'u'},
+ {"recursive", 0, (int*)0, 'e'},
+ {"showall", 0, (int*)0, 's'},
++ {"systemd", 1, (int*)0, 'y'},
+ {"help", 0, (int*)0, 'h'},
+ { 0, 0, (int*)0, 0 },
+ };
+@@ -2724,6 +2725,7 @@
+ char * override_path = OVERRIDEDIR;
+ char * insconf = INSCONF;
+ const char *const ipath = path;
++ char * systemd_binary_path = SYSTEMD_BINARY_PATH;
+ int runlevel, c, dfd;
+ boolean del = false;
+ boolean defaults = false;
+@@ -2746,7 +2748,7 @@
+ for (c = 0; c < argc; c++)
+ argr[c] = (char*)0;
+
+- while ((c = getopt_long(argc, argv, "c:dfrhvno:p:u:es", long_options, (int *)0)) != -1) {
++ while ((c = getopt_long(argc, argv, "c:dfrhvno:p:u:esy:", long_options, (int *)0)) != -1) {
+ size_t l;
+ switch (c) {
+ case 'c':
+@@ -2798,6 +2800,11 @@
+ case 'e':
+ recursive = true;
+ break;
++ case 'y':
++ if (optarg == (char*)0 || *optarg == '\0')
++ goto err;
++ systemd_binary_path = optarg;
++ break;
+ case '?':
+ err:
+ error("For help use: %s -h\n", myname);
+@@ -2925,7 +2932,7 @@
+ /*
+ * Systemd support
+ */
+- if (access(SYSTEMD_BINARY_PATH, F_OK) == 0 && (sbus = systemd_open_conn())) {
++ if (access(systemd_binary_path, F_OK) == 0 && (sbus = systemd_open_conn())) {
+
+ for (c = 0; c < argc; c++)
+ forward_to_systemd (argv[c], del ? "disable": "enable", path != ipath);
+Index: insserv/tests/common
+===================================================================
+--- insserv.orig/tests/common 2014-02-18 12:29:44.509745693 +0100
++++ insserv/tests/common 2014-02-18 12:30:46.394082174 +0100
+@@ -9,6 +9,9 @@
+ echo "info: test simple script ordering."
+ echo
+
++# Make sure to test as if systemd isn't installed
++insopts="-y /nonexisting/path"
++
+ initdir_purge
+
+ insertscript firstscript <<'EOF' || true
+@@ -86,6 +89,34 @@
+ ### END INIT INFO
+ EOF
+
++insertscript halt <<'EOF'
++### BEGIN INIT INFO
++# Provides: halt
++# Required-Start: $local_fs
++# Required-Stop: $local_fs
++# Default-Start:
++# Default-Stop: 0 6
++### END INIT INFO
++EOF
++
++# Make sure to test as if systemd is installed
++if [ ! -x /bin/systemd ] ; then
++ insopts="-y /bin/true"
++fi
++
++insertscript tellsystemd <<'EOF'
++### BEGIN INIT INFO
++# Provides: tellsystemd
++# Required-Start: $local_fs
++# Required-Stop: $local_fs halt
++# Default-Start: 3
++# Default-Stop: 0 6
++### END INIT INFO
++EOF
++insopts=""
++
++check_stop_order 6 tellsystemd halt
++
+ # This should fail, as it introduce a loop
+ if insertscript mdadm <<'EOF' ; then
+ ### BEGIN INIT INFO
+Index: insserv/tests/suite
+===================================================================
+--- insserv.orig/tests/suite 2014-02-18 12:29:44.509745693 +0100
++++ insserv/tests/suite 2014-02-18 12:30:46.394082174 +0100
+@@ -101,13 +101,13 @@
+ insserv_reg ()
+ {
+ script=$(printf "${initddir}/%s\n" ${1+"$@"})
+- $insserv $debug -c $insconf -p $initddir -o $overridedir $script
++ $insserv $debug $insopts -c $insconf -p $initddir -o $overridedir $script
+ }
+
+ insserv_del ()
+ {
+ script=$(printf "${initddir}/%s\n" ${1+"$@"})
+- $insserv $debug -c $insconf -p $initddir -o $overridedir -r $script
++ $insserv $debug $insopts -c $insconf -p $initddir -o $overridedir -r $script
+ }
+
+ initdir_purge ()
+@@ -319,6 +319,48 @@
+ return $ret
+ }
+
++start_order_ok ()
++{
++ local rcdpath=$(runlevel_path $1); shift
++ local script1=$1; shift
++ local script2=$1; shift
++ local ret=0 scr order=""
++ pushd $rcdpath &> /dev/null
++ for scr in S[0-9][0-9]* ; do
++ test -e "${scr}" || continue
++ test -L "${scr}" || continue
++ case "${scr#S[0-9][0-9]}" in
++ ${script1}) order="${order:+$order }${script1}" ;;
++ ${script2}) order="${order:+$order }${script2}" ;;
++ esac
++ done
++ popd &> /dev/null
++ test "$order" = "$script1 $script2" || ret=1
++ counttest
++ return $ret
++}
++
++stop_order_ok ()
++{
++ local rcdpath=$(runlevel_path $1); shift
++ local script1=$1; shift
++ local script2=$1; shift
++ local ret=0 scr order=""
++ pushd $rcdpath &> /dev/null
++ for scr in K[0-9][0-9]* ; do
++ test -e "${scr}" || continue
++ test -L "${scr}" || continue
++ case "${scr#K[0-9][0-9]}" in
++ ${script1}) order="${order:+$order }${script1}" ;;
++ ${script2}) order="${order:+$order }${script2}" ;;
++ esac
++ done
++ popd &> /dev/null
++ test "$order" = "$script1 $script2" || ret=1
++ counttest
++ return $ret
++}
++
+ # Fatal check
+ check_order ()
+ {
+@@ -328,6 +370,22 @@
+ order_ok ${1+"$@"} || error "incorrect $runlevel sequence $script1 not before $script2" || true
+ }
+
++check_start_order ()
++{
++ local runlevel=$1
++ local script1=$2
++ local script2=$3
++ start_order_ok ${1+"$@"} || error "incorrect $runlevel sequence $script1 not before $script2" || true
++}
++
++check_stop_order ()
++{
++ local runlevel=$1
++ local script1=$2
++ local script2=$3
++ stop_order_ok ${1+"$@"} || error "incorrect $runlevel sequence $script1 not before $script2" || true
++}
++
+ # Non-fatal check
+ test_order ()
+ {
Modified: trunk/src/insserv/debian/patches/series
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/patches/series?rev=1103&op=diff
==============================================================================
--- trunk/src/insserv/debian/patches/series (original)
+++ trunk/src/insserv/debian/patches/series Tue Feb 18 11:59:31 2014
@@ -11,3 +11,4 @@
170_if-scope.patch
180_default_runlevels.patch
200_upstream-fixes.patch
+210_systemd_path_option.patch
Modified: trunk/src/insserv/debian/run-testsuite
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/run-testsuite?rev=1103&op=diff
==============================================================================
--- trunk/src/insserv/debian/run-testsuite (original)
+++ trunk/src/insserv/debian/run-testsuite Tue Feb 18 11:59:31 2014
@@ -10,6 +10,9 @@
# non-fatal
severity=test
fi
+
+# Run tests without trying to talk to systemd
+insopts="-y /non-existing"
update_conf() {
set +C
@@ -2415,6 +2418,7 @@
test_cross_runlevel_dep() {
initdir_purge
+insopts="-y /bin/true"
insertscript rpcbind <<'EOF'
### BEGIN INIT INFO
@@ -2452,6 +2456,7 @@
check_script_present 2 nfs-common
check_script_present 2 nfs-server
check_order 2 nfs-common nfs-server
+insopts="-y /non-existing"
}
##########################################################################
More information about the Initscripts-ng-commits
mailing list