s3 make test: Add the ability to specify a custom smb.conf for make test
authorTim Prouty <tprouty@samba.org>
Sun, 25 Jan 2009 22:38:44 +0000 (14:38 -0800)
committerTim Prouty <tprouty@samba.org>
Mon, 26 Jan 2009 20:07:27 +0000 (12:07 -0800)
- Adds new -c <custom conf> option to selftest.sh that when specified
  adds a line to make test's server.conf: "include <custom conf>"
- Adds getopts processing to selftest.sh
- Changes selftest.sh shrdir arg to use -s <shrdir>
- Changes selftest.sh smbtorture4_path arg to use -t <smbtortur4 path>
- Adds configure option --with-selftest-custom-conf=<custom conf>
- Updates Makefile.in to take advantage of the new/changed parameters

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

index cbbf821b2210a4bee1f543798a1a1199bada9366..a1873eb6d5cb8cbddeae9e7e2c8a79a94ed80334 100644 (file)
@@ -19,6 +19,7 @@ datarootdir=@datarootdir@
 selftest_prefix=@selftest_prefix@
 selftest_shrdir=@selftest_shrdir@
 smbtorture4_path=@smbtorture4_path@
+selftest_custom_conf=@selftest_custom_conf@
 
 LIBS=@LIBS@
 CC=@CC@
@@ -2928,9 +2929,22 @@ test_pam_modules:: pam_modules
 ##
 ## Targets for 'make test'
 ##
+
+ifdef smbtorture4_path
+smbtorture4_path_arg=-t ${smbtorture4_path}
+endif
+
+ifdef selftest_shrdir
+selftest_shrdir_arg=-s ${selftest_shrdir}
+endif
+
+ifdef selftest_custom_conf
+selftest_custom_conf_arg=-c ${selftest_custom_conf}
+endif
+
 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}" ${selftest_shrdir}
+       @LIB_PATH_VAR=$(LIB_PATH_VAR) PERL="$(PERL)" $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all ${smbtorture4_path_arg} ${selftest_shrdir_arg} ${selftest_custom_conf_arg}
 
 valgrindtest:: all torture timelimit
        @echo Running Test suite with valgrind
@@ -2939,7 +2953,7 @@ valgrindtest:: all torture timelimit
         WINBINDD_VALGRIND="xterm -n winbindd -e valgrind -q --db-attach=yes --num-callers=30" \
         SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \
         VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
-        PERL="$(PERL)" $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all "${smbtorture4_path}"
+        PERL="$(PERL)" $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all ${smbtorture4_path_arg} ${selftest_shrdir_arg} ${selftest_custom_conf_arg}
 
 SELFTEST_FORMAT = plain
 selftestdir = ../selftest
index 444ea1c401054ae494e8917eaccf9a5027414d5e..962e2765a0300d527205901dc195a7693f4ae066 100644 (file)
@@ -361,6 +361,25 @@ AC_ARG_WITH(smbtorture4_path,
  esac
 ])
 
+#################################################
+# set custom conf for make test
+selftest_custom_conf=""
+AC_SUBST(selftest_custom_conf)
+AC_ARG_WITH(selftest_custom_conf,
+[AS_HELP_STRING([--with-selftest-custom-conf=PATH], [An optional custom smb.conf that is included in the server smb.conf during make test(none)])],
+[ case "$withval" in
+  yes|no)
+    AC_MSG_ERROR([--with-selftest-custom-conf should take a path])
+  ;;
+  * )
+    selftest_custom_conf="$withval"
+    if test -z "$selftest_custom_conf" -a ! -f $selftest_custom_conf; then
+       AC_MSG_ERROR(['$selftest_custom_conf' does not  exist!])
+    fi
+  ;;
+ esac
+])
+
 ## check for --enable-debug first before checking CFLAGS before
 ## so that we don't mix -O and -g
 debug=no
index 94fd791b51c2e6c564f27b292b60fe78658846cf..ea2260d32d8fd69e2e804cf063e3ec63e24d7522 100755 (executable)
@@ -1,17 +1,44 @@
 #!/bin/sh
 
-if [ $# != 3 -a $# != 4 ]; then
-       echo "$0 <directory> <all | quick> <smbtorture4> [<shrdir>]"
+if [ $# -lt 2 ]; then
+       echo "$0 <directory> <all | quick> [-t <smbtorture4>] [-s <shrdir>] " \
+            "[-c <custom conf>]"
        exit 1
 fi
 
-SMBTORTURE4=$3
-SUBTESTS=$2
+##
+## Setup the required args
+##
+DIRECTORY=$1; shift;
+SUBTESTS=$1; shift;
+
+##
+## Parse oprtional args
+##
+while getopts s:c:t: f
+do
+    case $f in
+       t)      SMBTORTURE4=$OPTARG;;
+       s)      ALT_SHRDIR_ARG=$OPTARG;;
+       c)      CUSTOM_CONF_ARG=$OPTARG;;
+    esac
+done
+
+echo "Running selftest with the following"
+echo "Selftest Directory:\t\t$DIRECTORY"
+echo "Subtests to Run:\t\t$SUBTESTS"
+echo "smbtorture4 Path:\t\t$SMBTORTURE4"
+echo "Alternative Share Dir:\t\t$ALT_SHRDIR_ARG"
+echo "Custom Configuration:\t\t$CUSTOM_CONF_ARG"
+
+if [ $CUSTOM_CONF_ARG ]; then
+    INCLUDE_CUSTOM_CONF="include = $CUSTOM_CONF_ARG"
+fi
 
 ##
 ## create the test directory
 ##
-PREFIX=`echo $1 | sed s+//+/+`
+PREFIX=`echo $DIRECTORY | sed s+//+/+`
 mkdir -p $PREFIX || exit $?
 OLD_PWD=`pwd`
 cd $PREFIX || exit $?
@@ -68,8 +95,10 @@ export WINBINDD_SOCKET_DIR WINBINDD_PRIV_PIPE_DIR
 PATH=bin:$PATH
 export PATH
 
-SAMBA4BINDIR=`dirname $SMBTORTURE4`
-SAMBA4SHAREDDIR="$SAMBA4BINDIR/shared"
+if [ $SMBTORTRE4 ]; then
+    SAMBA4BINDIR=`dirname $SMBTORTURE4`
+    SAMBA4SHAREDDIR="$SAMBA4BINDIR/shared"
+fi
 
 export SAMBA4SHAREDDIR
 export SMBTORTURE4
@@ -116,8 +145,8 @@ chmod 755 $WINBINDD_SOCKET_DIR
 ##
 ## Create an alternate shrdir if one was specified.
 ##
-if [ $# = 4 ]; then
-    ALT_SHRDIR=`echo $4 | sed s+//+/+`
+if [ $ALT_SHRDIR_ARG ]; then
+    ALT_SHRDIR=`echo $ALT_SHRDIR_ARG | sed s+//+/+`
     mkdir -p $ALT_SHRDIR || exit $?
     OLD_PWD=`pwd`
     cd $ALT_SHRDIR || exit $?
@@ -200,8 +229,6 @@ cat >$SERVERCONFFILE<<EOF
 
 #      min receivefile size = 4000
 
-[tmp]
-       path = $SHRDIR
        read only = no
        smbd:sharedelay = 100000
        smbd:writetimeupdatedelay = 500000
@@ -209,6 +236,12 @@ cat >$SERVERCONFFILE<<EOF
        map system = yes
        create mask = 755
        vfs objects = $BINDIR/xattr_tdb.so $BINDIR/streams_depot.so
+
+       #Include user defined custom parameters if set
+       $INCLUDE_CUSTOM_CONF
+
+[tmp]
+       path = $SHRDIR
 [hideunread]
        copy = tmp
        hide unreadable = yes