summaryrefslogtreecommitdiff
path: root/testing/fulltests/support/simple_run
blob: 197800985c85c6ec411da59c1a5a2ca2a924d9da (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/sh

if [ $# = 0 ]; then
    echo "Usage: $0 <testscript> [<args>]"
    exit 1
fi

if [ "x$builddir" = "x" ]; then
    cd ..
    builddir=`pwd`
    if cd testing 2>/dev/null; then
       :
    else
       echo "Error: $0 must be started from inside the testing directory in the source tree."
       echo "The builddir environment variable can be set to point to the build directory."
       exit 1
    fi
fi

if [ "x$srcdir" = "x" ]; then
    srcdir=`dirname $0`
    srcdir=`cd $srcdir; cd ../..; pwd`
    srcdir=`dirname $srcdir`
    cd $srcdir
    if cd testing 2>/dev/null; then
       :
    else
       echo "Error: $0 must be started from inside the testing directory in the source tree."
       echo "The builddir environment variable can be set to point to the build directory."
       exit 1
    fi
fi

testscript=$1
if [ `echo $testscript | cut -c 1-1` != '/' ]; then
    testscript="`pwd`/$1"
fi

SNMP_BASEDIR=`dirname $0`

## prefer MIB files found in source hierarchy
SNMP_PREFER_NEAR_MIBS=1

export SNMP_PREFER_NEAR_MIBS
SNMP_TEST_PREFIX=${SNMP_TEST_PREFIX:=T}
export SNMP_TEST_PREFIX

SNMP_ORIGDIR=`pwd`	        ## this script may be invoked with relative path
export SNMP_ORIGDIR

SNMP_UPDIR=${builddir}          ## build directory
if [ "x$DYNAMIC_ANALYZER" = "x" ]; then
    SNMP_SLEEP_DEFAULT=1
else
    SNMP_SLEEP_DEFAULT=10
fi
SNMP_SLEEP=${SNMP_SLEEP:=$SNMP_SLEEP_DEFAULT} 	## default seconds to sleep
export SNMP_SLEEP

# Find executables in source first, then build, then existing PATH.
## Add to PATH if a binary is found.

cd $SNMP_UPDIR
SNMP_UPDIR=`pwd`
bf=snmpget
if [ -x "$bf" ] ; then
   PATH=$SNMP_UPDIR:$PATH
else
  for dd in apps bin ; do
   bf=$dd/snmpget
   if [ -x "$bf" ] ; then
      PATH=$SNMP_UPDIR/$dd:$PATH
      break
   fi
  done
fi
for dd in agent bin sbin ; do
   bf=$dd/snmpd
   if [ -x "$bf" ] ; then
      PATH=$SNMP_UPDIR/$dd:$PATH
      break
   fi
done

bf=include/net-snmp/net-snmp-config.h
if [ ! -s "$bf" ] ; then
   echo "No \"$bf\" in $SNMP_UPDIR . Some tests will be skipped"
fi
unset bf

# Run from the test scripts directory.
cd $SNMP_ORIGDIR ; cd ${SNMP_BASEDIR}
SNMP_BASEDIR=`pwd`
export SNMP_BASEDIR

PATH=${SNMP_BASEDIR}:$PATH
export PATH
SNMP_PATH=yes
export SNMP_PATH

export SNMP_UPDIR

#
# Source the testing configuration file
#

testnum="`basename $testscript`"

. simple_TESTCONF.sh

. simple_eval_tools.sh

cd `dirname $testscript`
PATH=`pwd`:$PATH
export PATH

. `basename $testscript`

FINISHED