s3: Add support for make test to use a share dir outside of the prefix dir
authorTim Prouty <tprouty@samba.org>
Wed, 12 Nov 2008 02:46:21 +0000 (18:46 -0800)
committerTim Prouty <tprouty@samba.org>
Wed, 12 Nov 2008 03:06:50 +0000 (19:06 -0800)
Some systems need to have the tdbs (and other files required for samba
to run) on a different filesystem than the share directory that samba
is exporting.

This patch:
- Adds an optional "shrdir" argument to selftest.sh
  - If shrdir is specified it will be used, otherwise the default
    will be used: "<prefix>/tmp"
- Adds a new configure option: --with-selftest-shrdir
- Plumbs shrdir through Makefile.in and configure.in

source3/Makefile.in
source3/m4/check_path.m4
source3/script/tests/selftest.sh

index c048e193a6103615a38d9a58876b0bf26e208b3d..6e40ba404a1159ad6d1913149f0aa6b378ac530c 100644 (file)
@@ -17,6 +17,7 @@ localstatedir=@localstatedir@
 datarootdir=@datarootdir@
 
 selftest_prefix=@selftest_prefix@
+selftest_shrdir=@selftest_shrdir@
 smbtorture4_path=@smbtorture4_path@
 
 LIBS=@LIBS@
@@ -2846,7 +2847,7 @@ test_pam_modules:: pam_modules
 ##
 test:: all torture timelimit
        @echo Running Test suite
-       @LIB_PATH_VAR=$(LIB_PATH_VAR) PERL="$(PERL)" $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all "${smbtorture4_path}"
+       @LIB_PATH_VAR=$(LIB_PATH_VAR) PERL="$(PERL)" $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all "${smbtorture4_path}" ${selftest_shrdir}
 
 valgrindtest:: all torture timelimit
        @echo Running Test suite with valgrind
index 9c994680849bed5158d25d5267ae9a01235ae076..0cff397c93b5616096619ebb56621372fab1e8f4 100644 (file)
@@ -275,6 +275,22 @@ AC_ARG_WITH(selftest-prefix,
   esac
 ])
 
+#################################################
+# set shrdir for 'make test'
+selftest_shrdir=""
+AC_SUBST(selftest_shrdir)
+AC_ARG_WITH(selftest-shrdir,
+[AS_HELP_STRING([--with-selftest-shrdir=DIR], [The share directory that make test will be run against ($selftest_shrdir)])],
+[ case "$withval" in
+  yes|no)
+    AC_MSG_WARN([--with-selftest-shrdir called without argument - will use default])
+  ;;
+  * )
+    selftest_shrdir="$withval"
+    ;;
+  esac
+])
+
 #################################################
 # set path of samba4's smbtorture
 smbtorture4_path=""
index 0894b2507dc2b4f33c1997a18fdfca56726c052d..d41d0f36cf05862f9ebdb4e89dfcb5f637f57fd7 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
-if [ $# != 3 ]; then
-       echo "$0 <directory> <all | quick> <smbtorture4>"
+if [ $# != 3 -a $# != 4 ]; then
+       echo "$0 <directory> <all | quick> <smbtorture4> [<shrdir>]"
        exit 1
 fi
 
@@ -38,7 +38,6 @@ PASSWORD=test
 SRCDIR="`dirname $0`/../.."
 BINDIR="`pwd`/bin"
 SCRIPTDIR=$SRCDIR/script/tests
-SHRDIR=$PREFIX_ABS/tmp
 LIBDIR=$PREFIX_ABS/lib
 PIDDIR=$PREFIX_ABS/pid
 CONFFILE=$LIBDIR/client.conf
@@ -113,8 +112,23 @@ mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $LOCKDIR $LOGDIR
 mkdir -p $SOCKET_WRAPPER_DIR
 mkdir -p $WINBINDD_SOCKET_DIR
 chmod 755 $WINBINDD_SOCKET_DIR
-mkdir -p $PREFIX_ABS/tmp
-chmod 777 $PREFIX_ABS/tmp
+
+##
+## Create an alternate shrdir if one was specified.
+##
+if [ $# = 4 ]; then
+    ALT_SHRDIR=`echo $4 | sed s+//+/+`
+    mkdir -p $ALT_SHRDIR || exit $?
+    OLD_PWD=`pwd`
+    cd $ALT_SHRDIR || exit $?
+    SHRDIR=`pwd`
+    cd $OLD_PWD
+    /bin/rm -rf $SHRDIR/*
+else
+    SHRDIR=$PREFIX_ABS/tmp
+    mkdir -p $SHRDIR
+fi
+chmod 777 $SHRDIR
 
 ##
 ## Create the common config include file with the basic settings
@@ -184,7 +198,7 @@ cat >$SERVERCONFFILE<<EOF
 #      min receivefile size = 4000
 
 [tmp]
-       path = $PREFIX_ABS/tmp
+       path = $SHRDIR
        read only = no
        smbd:sharedelay = 100000
        smbd:writetimeupdatedelay = 500000
@@ -262,7 +276,7 @@ export SOCKET_WRAPPER_DEFAULT_IFACE
 TORTURE4_OPTIONS="$SAMBA4CONFIGURATION"
 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --maximum-runtime=$TORTURE_MAXTIME"
 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --target=samba3"
-TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:localdir=$PREFIX_ABS/tmp"
+TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:localdir=$SHRDIR"
 export TORTURE4_OPTIONS
 
 if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then