From b40e2588707d2b7c44ee91da91872e4f9dc5209b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 21 Mar 2006 15:33:14 +0000 Subject: r14624: - add timelimit.c - add configure tests --with-selftest-prefix=/tmp/samba-test this is needed because the path name of unix socket can only be 108 chars long - add configure test --with-smbtorture4-path=/home/foo/prefix/samba4/bin/smbtorture this will be used to run samba4's smbtorture inside samba3's make test later metze (This used to be commit d9df1853b947c70f747ea30a353162f2985ef250) --- source3/Makefile.in | 7 ++++ source3/configure.in | 35 ++++++++++++++++++ source3/script/tests/timelimit.c | 78 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+) create mode 100644 source3/script/tests/timelimit.c (limited to 'source3') diff --git a/source3/Makefile.in b/source3/Makefile.in index e413c8cafb..c47af0ebe9 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -11,6 +11,9 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ +selftest_prefix=@selftest_prefix@ +smbtorture4_path=@smbtorture4_path@ + LIBS=@LIBS@ CC=@CC@ SHLD=@SHLD@ @@ -1405,6 +1408,10 @@ bin/t_push_ucs2@EXEEXT@: bin/libbigballofmud.@SHLIBEXT@ torture/t_push_ucs2.o bin/t_snprintf@EXEEXT@: lib/snprintf.c $(CC) $(FLAGS) @PIE_LDFLAGS@ -o $@ $(DYNEXP) -DTEST_SNPRINTF lib/snprintf.c -lm + +bin/timelimit@EXEEXT@: script/tests/timelimit.c + $(CC) $(FLAGS) @PIE_LDFLAGS@ -o $@ $(DYNEXP) script/tests/timelimit.c + install: installservers installbin @INSTALL_CIFSMOUNT@ installman installscripts installdat installswat installmodules @INSTALL_LIBSMBCLIENT@ @INSTALL_LIBMSRPC@ install-everything: install installmodules diff --git a/source3/configure.in b/source3/configure.in index 25b1700aac..4b883a28ac 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -308,6 +308,41 @@ AC_ARG_ENABLE(socket-wrapper, SOCKWRAP="\$(SOCKET_WRAPPER_OBJ)" fi]) +################################################# +# set prefix for 'make test' +selftest_prefix="./" +AC_SUBST(selftest_prefix) +AC_ARG_WITH(selftest-prefix, +[ --with-selftest-prefix=DIR The prefix where make test will be runned ($selftest_prefix)], +[ case "$withval" in + yes|no) + AC_MSG_WARN([--with-selftest-prefix called without argument - will use default]) + ;; + * ) + selftest_prefix="$withval" + ;; + esac +]) + +################################################# +# set path of samba4's smbtorture +smbtorture4_path="" +AC_SUBST(smbtorture4_path) +AC_ARG_WITH(smbtorture4_path, +[ --with-smbtorture4-path=PATH The path to a samba4 smbtorture for make test (none)], +[ case "$withval" in + yes|no) + AC_MSG_ERROR([--with-smbtorture4-path should take a path]) + ;; + * ) + smbtorture4_path="$withval" + if test -z "$smbtorture4_path" -a ! -f $smbtorture4_path; then + AC_MSG_ERROR(['$smbtorture_path' does not exist!]) + fi + ;; + esac +]) + # compile with optimization and without debugging by default, but # allow people to set their own preference. # do this here since AC_CACHE_CHECK apparently sets the CFLAGS to "-g -O2" diff --git a/source3/script/tests/timelimit.c b/source3/script/tests/timelimit.c new file mode 100644 index 0000000000..93d7f6497e --- /dev/null +++ b/source3/script/tests/timelimit.c @@ -0,0 +1,78 @@ +/* run a command with a limited timeout + tridge@samba.org, June 2005 + + attempt to be as portable as possible (fighting posix all the way) +*/ +#include +#include +#include +#include +#include +#include +#include +#include + +static void usage(void) +{ + printf("usage: timelimit