diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2008-06-17 08:48:31 -0700 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2008-06-17 08:48:31 -0700 |
commit | fe69ad97de34116d9534d5e7e7fe96ec8cb9ffc2 (patch) | |
tree | 71e76fe417dcb28e533b32bce9d04cdc7da68e6f | |
parent | 47d92b18b472a2513b98f56c345b4eb615822978 (diff) |
Fix tests when $srcdir != $builddir
In order to make the tests work when the build directory is not the
source directory, we always copy the service scripts to an init.d
directory in the build directory. This means we can drop some of the
hacks to try to get the rc symlinks correct.
-rw-r--r-- | test/.gitignore | 1 | ||||
-rw-r--r-- | test/Makefile.am | 36 | ||||
-rw-r--r-- | test/service/bar (renamed from test/init.d/bar) | 0 | ||||
-rw-r--r-- | test/service/barf (renamed from test/init.d/barf) | 0 | ||||
-rw-r--r-- | test/service/dual-headers (renamed from test/init.d/dual-headers) | 0 | ||||
-rw-r--r-- | test/service/foo (renamed from test/init.d/foo) | 0 | ||||
-rw-r--r-- | test/service/mountfs (renamed from test/init.d/mountfs) | 0 | ||||
-rw-r--r-- | test/service/network (renamed from test/init.d/network) | 0 | ||||
-rwxr-xr-x | test/tparse-dir.sh | 3 | ||||
-rwxr-xr-x | test/tparse.sh | 3 |
10 files changed, 20 insertions, 23 deletions
diff --git a/test/.gitignore b/test/.gitignore index d43442d..06ad3d6 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -11,4 +11,5 @@ tadd-deps2 trem-deps tinstall tremove +init.d rc?.d diff --git a/test/Makefile.am b/test/Makefile.am index 53853e9..657dec7 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,8 +1,10 @@ INCLUDES = -I$(top_srcdir)/lib runtestscripts = $(srcdir)/tparse.sh $(srcdir)/tparse-dir.sh -testscripts = init.d/bar init.d/foo init.d/barf init.d/dual-headers \ - init.d/mountfs init.d/network +testscripts = service/bar service/foo service/barf service/mountfs \ + service/network service/dual-headers +initdtestscripts = init.d/bar init.d/foo init.d/barf init.d/mountfs \ + init.d/network init.d/dual-headers EXTRA_DIST = $(runtestscripts) $(testscripts) TESTS = tstr tstrarg tdep $(runtestscripts) tinitd tinitd-list tactive \ @@ -44,31 +46,27 @@ testnetworklinks = rc0.d/K80network rc1.d/K80network rc2.d/S20network \ links: clean-links $(testlinks) testlinks = $(testmountfslinks) $(testnetworklinks) -$(TESTS): $(testlinks) - -clean-local: clean-links - -@if test "$(srcdir)" != "$(builddir)"; then \ - echo rm -rf init.d; \ - rm -rf init.d; \ - fi +$(TESTS): $(initdtestscripts) $(testlinks) +clean-local: clean-initd clean-links +clean-initd: + -rm -rf init.d clean-links: -rm -rf $(rctestdirs) +init.d: + mkdir -p $@ +$(initdtestscripts): init.d $(testscripts) + @orig=`echo $@ | sed 's,init.d,service,'` && \ + echo cp -f $(srcdir)/$$orig $@ && \ + cp -f $(srcdir)/$$orig $@ + $(testmountfslinks): init.d/mountfs - @if test ! -f init.d/mountfs; then \ - test -d init.d || mkdir init.d 2>/dev/null || :; \ - cp -p $(srcdir)/init.d/mountfs init.d/mountfs; \ - fi - @tdir=`dirname $@`; test -d $$tdir || mkdir $$tdir || : + @tdir=`dirname $@`; test -d $$tdir || mkdir -p $$tdir rm -f $@ ln -s ../init.d/mountfs $@ $(testnetworklinks): init.d/network - @if test ! -f init.d/network; then \ - test -d init.d || mkdir init.d 2>/dev/null || :; \ - cp -p $(srcdir)/init.d/network init.d/network; \ - fi - @tdir=`dirname $@`; test -d $$tdir || mkdir $$tdir || : + @tdir=`dirname $@`; test -d $$tdir || mkdir -p $$tdir rm -f $@ ln -s ../init.d/network $@ diff --git a/test/init.d/bar b/test/service/bar index b0a876c..b0a876c 100644 --- a/test/init.d/bar +++ b/test/service/bar diff --git a/test/init.d/barf b/test/service/barf index 02bfae5..02bfae5 100644 --- a/test/init.d/barf +++ b/test/service/barf diff --git a/test/init.d/dual-headers b/test/service/dual-headers index 8285e95..8285e95 100644 --- a/test/init.d/dual-headers +++ b/test/service/dual-headers diff --git a/test/init.d/foo b/test/service/foo index 9235cd2..9235cd2 100644 --- a/test/init.d/foo +++ b/test/service/foo diff --git a/test/init.d/mountfs b/test/service/mountfs index c6388c0..c6388c0 100644 --- a/test/init.d/mountfs +++ b/test/service/mountfs diff --git a/test/init.d/network b/test/service/network index 5c5ab15..5c5ab15 100644 --- a/test/init.d/network +++ b/test/service/network diff --git a/test/tparse-dir.sh b/test/tparse-dir.sh index 56b4c3f..845bc16 100755 --- a/test/tparse-dir.sh +++ b/test/tparse-dir.sh @@ -1,6 +1,5 @@ #!/bin/sh -: ${srcdir:=.} : ${builddir:=.} -exec "$builddir/tparse-dir" "$srcdir/init.d" +exec "$builddir/tparse-dir" "$builddir/init.d" diff --git a/test/tparse.sh b/test/tparse.sh index 80f103e..2bb8a63 100755 --- a/test/tparse.sh +++ b/test/tparse.sh @@ -1,6 +1,5 @@ #!/bin/sh -: ${srcdir:=.} : ${builddir:=.} -exec "$builddir/tparse" "$srcdir/init.d/foo" +exec "$builddir/tparse" "$builddir/init.d/foo" |