diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-03-30 22:23:30 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-03-30 22:23:30 +0200 |
commit | 004aaf22d421327e910af49367197a20b18010c0 (patch) | |
tree | 0342da07d05575b57f4ecf500ee2f0b8d31b1a42 /tests/scripts | |
parent | 812b2900723880df67a250f18f849dfe4f2e0064 (diff) | |
download | gnutls-004aaf22d421327e910af49367197a20b18010c0.tar.gz |
Reorganized scripts that use test servers, based on patch by Cedric Arbogast.
Diffstat (limited to 'tests/scripts')
-rw-r--r-- | tests/scripts/Makefile.am | 23 | ||||
-rw-r--r-- | tests/scripts/common.sh | 26 |
2 files changed, 49 insertions, 0 deletions
diff --git a/tests/scripts/Makefile.am b/tests/scripts/Makefile.am new file mode 100644 index 0000000000..559de27704 --- /dev/null +++ b/tests/scripts/Makefile.am @@ -0,0 +1,23 @@ +## Process this file with automake to produce Makefile.in +# Copyright (C) 2007, 2008, 2010 Free Software Foundation, Inc. +# +# Author: Simon Josefsson +# +# This file is part of GnuTLS. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +EXTRA_DIST = common.sh + diff --git a/tests/scripts/common.sh b/tests/scripts/common.sh new file mode 100644 index 0000000000..b9183cf51b --- /dev/null +++ b/tests/scripts/common.sh @@ -0,0 +1,26 @@ +fail() { + echo "Failure: $1" >&2 + exit 1 +} + +launch_server() { + PARENT=$1; + shift; + $SERV $DEBUG -p $PORT $* >/dev/null 2>&1 & + LOCALPID="$!"; + trap "[ ! -z \"${LOCALPID}\" ] && kill ${LOCALPID};" 15 + wait "${LOCALPID}" + LOCALRET="$?" + if [ "${LOCALRET}" != "0" -a "${LOCALRET}" != "143" ] ; then + # Houston, we'v got a problem... + echo "Failed to launch a gnutls-serv server !" + kill -10 ${PARENT} + fi +} + +wait_server() { + trap "kill $1" 1 15 2 + sleep 2 +} + +trap "fail \"Failed to launch a gnutls-serv server, aborting test... \"" 10 |