1#!/bin/sh
2
3scriptdir="$(dirname "$0")"
4
5killall snmpd snmptrapd >/dev/null 2>&1
6
7export SNMP_VERBOSE=1 &&
8export SNMP_SAVE_TMPDIR=1 &&
9make -s &&
10(
11      cd testing &&
12      if [ -e RUNFULLTESTS ] &&
13	     perl -e 'require TAP::Harness;' >/dev/null 2>&1; then
14          if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
15              for g in default snmpv3 unit-tests; do
16                  echo "==== Test group $g ===="
17	          ./RUNFULLTESTS -g $g || exit $?
18                  echo "==== End of test group $g ===="
19              done
20	  elif [ -n "${CIRRUS_CI}" ]; then
21              for g in default snmpv3 transports unit-tests; do
22                  echo "==== Test group $g ===="
23	          ./RUNFULLTESTS -g $g || exit $?
24                  echo "==== End of test group $g ===="
25              done
26          else
27	      ./RUNFULLTESTS -g all -e dtls -e tls
28          fi
29      else
30	  make -s test
31      fi &&
32      cd .. &&
33      if grep -q "PERLTARGS='perlmodules'" config.log; then
34          "$scriptdir/net-snmp-run-perl-tests"
35      fi
36) &&
37# Running the Python tests fails as follows on OS/X:
38# ImportError: dlopen(/Users/travis/build/bvanassche/net-snmp/python/netsnmp/client_intf.so, 2): Library not loaded: /usr/local/net-snmp-master/lib/libnetsnmp.35.dylib
39# Referenced from: /Users/travis/build/bvanassche/net-snmp/python/netsnmp/client_intf.so
40# Reason: image not found
41if grep -q with-python-modules config.log &&
42	[ "${TRAVIS_OS_NAME}" != "osx" ]; then
43    "$scriptdir/net-snmp-run-python-tests"
44fi
45