diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-03-21 15:57:07 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:49:37 -0500 |
commit | 2fca3f9082a70e1f153f6c9f195d95b0d48e363d (patch) | |
tree | 57146b03e224aede0bd6495beb3d5d717d424930 /source4/script/tests/test_functions.sh | |
parent | e2f26316cdeba1875be2cd583870ac6127c2be56 (diff) | |
download | samba-2fca3f9082a70e1f153f6c9f195d95b0d48e363d.tar.gz samba-2fca3f9082a70e1f153f6c9f195d95b0d48e363d.tar.bz2 samba-2fca3f9082a70e1f153f6c9f195d95b0d48e363d.zip |
r21909: Merge some of my recent improvements to the test infrastructure:
- Allow tests to specify what environment they need to run in (dc and none are thecurrent supported ones).
- Move more Samba4-specific code out of the common code
(This used to be commit dbe9de10287c902f4a5ea5d431dea4a79f9b170b)
Diffstat (limited to 'source4/script/tests/test_functions.sh')
-rwxr-xr-x | source4/script/tests/test_functions.sh | 104 |
1 files changed, 3 insertions, 101 deletions
diff --git a/source4/script/tests/test_functions.sh b/source4/script/tests/test_functions.sh index 7f363fd04a..801d6dc05b 100755 --- a/source4/script/tests/test_functions.sh +++ b/source4/script/tests/test_functions.sh @@ -1,95 +1,13 @@ #!/bin/sh -smbd_check_or_start() { - if [ -n "$SMBD_TEST_FIFO" ];then - if [ -p "$SMBD_TEST_FIFO" ];then - return 0; - fi - - if [ -n "$SOCKET_WRAPPER_DIR" ];then - if [ -d "$SOCKET_WRAPPER_DIR" ]; then - rm -f $SOCKET_WRAPPER_DIR/* - else - mkdir -p $SOCKET_WRAPPER_DIR - fi - fi - - rm -f $SMBD_TEST_FIFO - mkfifo $SMBD_TEST_FIFO - - rm -f $SMBD_TEST_LOG - - echo -n "STARTING SMBD..." - (( - if [ -z "$SMBD_MAXTIME" ]; then - SMBD_MAXTIME=5400 - fi - $SMBD_VALGRIND $SRCDIR/bin/smbd --maximum-runtime=$SMBD_MAXTIME -s $CONFFILE -M single -i --leak-report-full < $SMBD_TEST_FIFO > $SMBD_TEST_LOG 2>&1; - ret=$?; - rm -f $SMBD_TEST_FIFO; - if [ -n "$SOCKET_WRAPPER_DIR" -a -d "$SOCKET_WRAPPER_DIR" ]; then - rm -f $SOCKET_WRAPPER_DIR/* - fi - if [ x"$ret" = x"0" ];then - echo "smbd exits with status $ret"; - echo "smbd exits with status $ret" >>$SMBD_TEST_LOG; - elif [ x"$ret" = x"137" ];then - echo "smbd got SIGXCPU and exits with status $ret!" - echo "smbd got SIGXCPU and exits with status $ret!">>$SMBD_TEST_LOG; - else - echo "smbd failed with status $ret!" - echo "smbd failed with status $ret!">>$SMBD_TEST_LOG; - fi - exit $ret; - ) || exit $? &) 2>/dev/null || exit $? - echo "DONE" - fi - return 0; -} - -smbd_check_only() { - if [ -n "$SMBD_TEST_FIFO" ];then - if [ -p "$SMBD_TEST_FIFO" ];then - return 0; - fi - return 1; - fi - return 0; -} - -smbd_have_test_log() { - if [ -n "$SMBD_TEST_LOG" ];then - if [ -r "$SMBD_TEST_LOG" ];then - return 0; - fi - fi - return 1; -} - -slapd_start() { - OLDPATH=$PATH - PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH - export PATH -# running slapd in the background means it stays in the same process group, so it can be -# killed by timelimit - slapd -d0 -f $SLAPD_CONF -h $LDAP_URI_ESCAPE & - PATH=$OLDPATH - export PATH - return $?; -} - -fedora_ds_start() { -# running slapd in the background means it stays in the same process group, so it can be -# killed by timelimit - $FEDORA_DS_PREFIX/sbin/ns-slapd -D $FEDORA_DS_DIR -d0 & - return $?; -} testit() { name=$1 - shift 1 + env=$2 + shift 2 cmdline="$*" echo "-- TEST --" echo $name + echo $env echo $cmdline } @@ -120,22 +38,6 @@ EOF exit $failed } -# wait for a pid with given timeout -# returns 1 if it timed out, 0 if the process exited itself -waitforpid() { - pid=$1 - timeout=$2 # in seconds - _wcount=0 - while kill -0 $pid 2> /dev/null; do - sleep 1; - _wcount=`expr $_wcount + 1` - if [ $_wcount -eq $timeout ]; then - return "1"; - fi - done - return "0"; -} - if [ -z "$VALGRIND" ]; then MALLOC_CHECK_=2 export MALLOC_CHECK_ |