summaryrefslogtreecommitdiff
path: root/tests/twisted/run-test.sh.in
blob: 20dafc0855335c7a0be9abd1d0abf1094ba365c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh

if test "x$GABBLE_TEST_UNINSTALLED" = x; then
  script_fullname=`readlink -e "@twistedtestsdir@/run-test.sh"`
  if [ `readlink -e "$0"` != "$script_fullname" ] ; then
    echo "This script is meant to be installed at $script_fullname" >&2
    exit 1
  fi

  G_TEST_SRCDIR="@twistedtestsdir@"
  export G_TEST_SRCDIR
  G_TEST_BUILDDIR="@twistedtestsdir@"
  export G_TEST_BUILDDIR

  config_file="@twistedtestsdir@/tools/servicedir/tmp-session-bus.conf"

  PYTHONPATH="@twistedtestsdir@:@twistedtestsdir@/jingle"
  export PYTHONPATH
else
  if test -z "$G_TEST_SRCDIR"; then
    echo "G_TEST_SRCDIR must be set" >&2
    exit 1
  fi
  if test -z "$G_TEST_BUILDDIR"; then
    echo "G_TEST_BUILDDIR must be set" >&2
    exit 1
  fi

  config_file="${G_TEST_BUILDDIR}/tools/servicedir-uninstalled/tmp-session-bus.conf"

  PYTHONPATH="${G_TEST_SRCDIR}:${G_TEST_BUILDDIR}"
  PYTHONPATH="$PYTHONPATH:${G_TEST_SRCDIR}/jingle"
  PYTHONPATH="$PYTHONPATH:${G_TEST_BUILDDIR}/jingle"
  export PYTHONPATH
fi

if [ -n "$1" ] ; then
  list="$1"
else
  list=$(cat "${G_TEST_BUILDDIR}"/gabble-twisted-tests.list)
fi

any_failed=0
for i in $list ; do
  echo "Testing $i ..."
  sh "${G_TEST_SRCDIR}/tools/with-session-bus.sh" \
    ${GABBLE_TEST_SLEEP} \
    --config-file="${config_file}" \
    -- \
    @TEST_PYTHON@ -u "${G_TEST_SRCDIR}/$i"
  e=$?
  case "$e" in
    (0)
      echo "PASS: $i"
      ;;
    (77)
      echo "SKIP: $i"
      ;;
    (*)
      any_failed=1
      echo "FAIL: $i ($e)"
      ;;
  esac
done

exit $any_failed