⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selftest.sh

📁 samba服务器!
💻 SH
字号:
#!/bin/shif [ $# != 3 ]; then	echo "$0 <directory> <all | quick> <smbtorture4>"	exit 1fiSMBTORTURE4=$3TESTS=$2#### create the test directory##PREFIX=`echo $1 | sed s+//+/+`mkdir -p $PREFIX || exit $?OLD_PWD=`pwd`cd $PREFIX || exit $?PREFIX_ABS=`pwd`cd $OLD_PWDif [ -z "$TORTURE_MAXTIME" ]; then    TORTURE_MAXTIME=300fiexport TORTURE_MAXTIME#### setup the various environment variables we need##SERVER=localhost2SERVER_IP=127.0.0.2USERNAME=`PATH=/usr/ucb:$PATH whoami`PASSWORD=testSRCDIR="`dirname $0`/../.."BINDIR="`pwd`/bin"SCRIPTDIR=$SRCDIR/script/testsSHRDIR=$PREFIX_ABS/tmpLIBDIR=$PREFIX_ABS/libPIDDIR=$PREFIX_ABS/pidCONFFILE=$LIBDIR/client.confSAMBA4CONFFILE=$LIBDIR/samba4client.confSERVERCONFFILE=$LIBDIR/server.confCOMMONCONFFILE=$LIBDIR/common.confPRIVATEDIR=$PREFIX_ABS/privateLOCKDIR=$PREFIX_ABS/lockdirLOGDIR=$PREFIX_ABS/logsSOCKET_WRAPPER_DIR=$PREFIX/swCONFIGURATION="-s $CONFFILE"SAMBA4CONFIGURATION="-s $SAMBA4CONFFILE"export PREFIX PREFIX_ABSexport CONFIGURATION CONFFILE SAMBA4CONFIGURATION SAMBA4CONFFILEexport PATH SOCKET_WRAPPER_DIR DOMAINexport PRIVATEDIR LIBDIR PIDDIR LOCKDIR LOGDIR SERVERCONFFILEexport SRCDIR SCRIPTDIR BINDIRexport USERNAME PASSWORDexport SMBTORTURE4export SERVER SERVER_IPPATH=bin:$PATHexport PATH#### verify that we were built with --enable-socket-wrapper##if test "x`smbd -b | grep SOCKET_WRAPPER`" = "x"; then	echo "***"	echo "*** You must include --enable-socket-wrapper when compiling Samba"	echo "*** in order to execute 'make test'.  Exiting...."	echo "***"	exit 1fi## ## create the test directory layout##echo -n "CREATE TEST ENVIRONMENT IN '$PREFIX'".../bin/rm -rf $PREFIX/*mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $LOCKDIR $LOGDIR $SOCKET_WRAPPER_DIRmkdir -p $PREFIX_ABS/tmpchmod 777 $PREFIX_ABS/tmp#### Create the common config include file with the basic settings##cat >$COMMONCONFFILE<<EOF	workgroup = SAMBA-TEST	private dir = $PRIVATEDIR	pid directory = $PIDDIR	lock directory = $LOCKDIR	log file = $LOGDIR/log.%m	log level = 0	passdb backend = tdbsam	name resolve order = bcastEOFTORTURE_INTERFACES='127.0.0.6/8,127.0.0.7/8,127.0.0.8/8,127.0.0.9/8,127.0.0.10/8,127.0.0.11/8'cat >$CONFFILE<<EOF[global]	netbios name = TORTURE_6	interfaces = $TORTURE_INTERFACES	panic action = $SCRIPTDIR/gdb_backtrace %d %\$(MAKE_TEST_BINARY)	include = $COMMONCONFFILEEOFcat >$SAMBA4CONFFILE<<EOF[global]	netbios name = TORTURE_6	interfaces = $TORTURE_INTERFACES	panic action = $SCRIPTDIR/gdb_backtrace %PID% %PROG%	include = $COMMONCONFFILEEOFcat >$SERVERCONFFILE<<EOF[global]	netbios name = $SERVER	interfaces = $SERVER_IP/8	bind interfaces only = yes	panic action = $SCRIPTDIR/gdb_backtrace %d %\$(MAKE_TEST_BINARY)	include = $COMMONCONFFILE	; Necessary to add the build farm hacks	add user script = /bin/false	add machine script = /bin/false	kernel oplocks = no	syslog = no	printing = bsd	printcap name = /dev/null[tmp]	path = $PREFIX_ABS/tmp	read only = no	smbd:sharedelay = 100000	map hidden = yes	map system = yes	create mask = 755[hideunread]	copy = tmp	hide unreadable = yes[hideunwrite]	copy = tmp	hide unwriteable files = yes[print1]	copy = tmp	printable = yes	printing = test[print2]	copy = print1[print3]	copy = print1[print4]	copy = print1EOF#### create a test account##(echo $PASSWORD; echo $PASSWORD) | \	smbpasswd -c $CONFFILE -L -s -a $USERNAME >/dev/null || exit 1echo "DONE";SERVER_TEST_FIFO="$PREFIX/server_test.fifo"export SERVER_TEST_FIFONMBD_TEST_LOG="$PREFIX/nmbd_test.log"export NMBD_TEST_LOGSMBD_TEST_LOG="$PREFIX/smbd_test.log"export SMBD_TEST_LOGMAKE_TEST_BINARY=""export MAKE_TEST_BINARY# start off with 0 failuresfailed=0export failed. $SCRIPTDIR/test_functions.shSOCKET_WRAPPER_DEFAULT_IFACE=2export SOCKET_WRAPPER_DEFAULT_IFACEsamba3_check_or_start# ensure any one smbtorture call doesn't run too long# and smbtorture will use 127.0.0.6 as source address by defaultSOCKET_WRAPPER_DEFAULT_IFACE=6export SOCKET_WRAPPER_DEFAULT_IFACETORTURE4_OPTIONS="$SAMBA4CONFIGURATION"TORTURE4_OPTIONS="$TORTURE4_OPTIONS --maximum-runtime=$TORTURE_MAXTIME"TORTURE4_OPTIONS="$TORTURE4_OPTIONS --target=samba3"export TORTURE4_OPTIONSif [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then	TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:progress=no"fi#### ready to go...now loop through the tests##START=`date`( # give time for nbt server to register its names echo "delaying for nbt name registration" sleep 4 # This will return quickly when things are up, but be slow if we need to wait for (eg) SSL init  bin/nmblookup $CONFIGURATION -U $SERVER_IP __SAMBA__ bin/nmblookup $CONFIGURATION __SAMBA__ bin/nmblookup $CONFIGURATION -U 127.255.255.255 __SAMBA__ bin/nmblookup $CONFIGURATION -U $SERVER_IP $SERVER bin/nmblookup $CONFIGURATION $SERVER # make sure smbd is also up set echo "wait for smbd" bin/smbclient $CONFIGURATION -L $SERVER_IP -U% -p 139 | head -2 bin/smbclient $CONFIGURATION -L $SERVER_IP -U% -p 139 | head -2 failed=0 . $SCRIPTDIR/tests_$TESTS.sh exit $failed)failed=$?samba3_stop_sig_termEND=`date`echo "START: $START ($0)";echo "END:   $END ($0)";# if there were any valgrind failures, show themcount=`find $PREFIX -name 'valgrind.log*' | wc -l`if [ "$count" != 0 ]; then    for f in $PREFIX/valgrind.log*; do	if [ -s $f ]; then	    echo "VALGRIND FAILURE";	    failed=`expr $failed + 1`	    cat $f	fi    donefisleep 2samba3_stop_sig_killteststatus $0 $failed

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -