~ubuntu-branches/debian/lenny/net-snmp/lenny

« back to all changes in this revision

Viewing changes to testing/eval_tools.sh

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-05-10 22:20:23 UTC
  • Revision ID: james.westby@ubuntu.com-20070510222023-3fr07xb9i17xvq32
Tags: upstream-5.3.1
ImportĀ upstreamĀ versionĀ 5.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
105
105
 
106
106
#------------------------------------ -o-
107
107
#
 
108
SKIP() {
 
109
        REMOVETESTDATA
 
110
        echo "SKIPPED"
 
111
        exit 0
 
112
}
 
113
 
108
114
SKIPIFNOT() {
109
115
        grep "^#define $1 " $SNMP_UPDIR/include/net-snmp/net-snmp-config.h $SNMP_UPDIR/include/net-snmp/agent/mib_module_config.h $SNMP_UPDIR/include/net-snmp/agent/agent_module_config.h > /dev/null
110
116
        if [ $? != 0 ]; then
111
 
            REMOVETESTDATA
112
 
            echo "SKIPPED"
113
 
            exit 0;
 
117
            SKIP
114
118
        fi
115
119
}
116
120
 
117
121
SKIPIF() {
118
122
        grep "^#define $1 " $SNMP_UPDIR/include/net-snmp/net-snmp-config.h $SNMP_UPDIR/include/net-snmp/agent/mib_module_config.h $SNMP_UPDIR/include/net-snmp/agent/agent_module_config.h > /dev/null
119
123
        if [ $? = 0 ]; then
120
 
            REMOVETESTDATA
121
 
            echo "SKIPPED"
122
 
            exit 0;
 
124
            SKIP
123
125
        fi
124
126
}
125
127
        
253
255
    CHECKFILE $SNMP_SNMPTRAPD_LOG_FILE $@
254
256
}
255
257
 
 
258
CHECKTRAPDORDIE() {
 
259
    CHECKORDIE $@ $SNMP_SNMPTRAPD_LOG_FILE
 
260
}
 
261
 
256
262
CHECKAGENT() {
257
 
    CHECKGAENT $SNMP_SNMPD_LOG_FILE $@
 
263
    CHECKFILE $SNMP_SNMPD_LOG_FILE $@
258
264
}
259
265
 
260
266
WAITFORAGENT() {
317
323
    ECHO "."
318
324
}
319
325
 
320
 
# CHECKFILE "grep string" ["file"]
 
326
# CHECKORDIE "grep string" ["file"] .. FAIL if "grep string" is *not* found
321
327
CHECKORDIE() {
322
328
    CHECKFILE "$2" "$1"
323
329
    if [ "$snmp_last_test_result" = 0 ] ; then
326
332
    ECHO "."
327
333
}
328
334
 
 
335
# CHECKANDDIE "grep string" ["file"] .. FAIL if "grep string" *is* found
 
336
CHECKANDDIE() {
 
337
    CHECKFILE "$2" "$1"
 
338
    EXPECTRESULT 0 # make sure return_value gets set correctly
 
339
    if [ "$snmp_last_test_result" != 0 ] ; then
 
340
        FINISHED
 
341
    fi
 
342
    ECHO "."
 
343
}
 
344
 
329
345
#------------------------------------ -o-
330
346
# Returns: Count of matched lines.
331
347
#
393
409
    LOG_FILE=$SNMP_SNMPD_LOG_FILE
394
410
    PORT_SPEC="$SNMP_SNMPD_PORT"
395
411
    if [ "x$SNMP_TRANSPORT_SPEC" != "x" ]; then
396
 
        PORT_SPEC="$SNMP_TRANSPORT_SPEC:$PORT_SPEC"
 
412
        PORT_SPEC="${SNMP_TRANSPORT_SPEC}:${SNMP_TEST_DEST}${PORT_SPEC}"
397
413
    fi
398
414
    STARTPROG
399
415
    WAITFORAGENT "NET-SNMP version"
402
418
#------------------------------------ -o-
403
419
STARTTRAPD() {
404
420
    TRAPDSTARTED=1
405
 
    COMMAND="snmptrapd -d -u $SNMP_SNMPTRAPD_PID_FILE -Lf $SNMP_SNMPTRAPD_LOG_FILE $TRAPD_FLAGS"
 
421
    COMMAND="snmptrapd -d -p $SNMP_SNMPTRAPD_PID_FILE -Lf $SNMP_SNMPTRAPD_LOG_FILE $TRAPD_FLAGS"
406
422
    CFG_FILE=$SNMPTRAPD_CONFIG_FILE
407
423
    LOG_FILE=$SNMP_SNMPTRAPD_LOG_FILE
408
424
    PORT_SPEC="$SNMP_SNMPTRAPD_PORT"
409
425
    if [ "x$SNMP_TRANSPORT_SPEC" != "x" ]; then
410
 
        PORT_SPEC="$SNMP_TRANSPORT_SPEC:$PORT_SPEC"
 
426
        PORT_SPEC="${SNMP_TRANSPORT_SPEC}:${SNMP_TEST_DEST}${PORT_SPEC}"
411
427
    fi
412
428
    STARTPROG
413
429
    WAITFORTRAPD "NET-SNMP version"
414
430
}
415
431
 
 
432
## sending SIGHUP for reconfiguration
 
433
#
 
434
HUPPROG() {
 
435
    if [ -f $1 ]; then
 
436
        if [ "x$OSTYPE" = "xmsys" ]; then
 
437
          COMMAND='echo "Skipping SIGHUP (not supported by kill.exe on MinGW)"'
 
438
        else
 
439
          COMMAND="kill -HUP `cat $1`"
 
440
        fi
 
441
        echo $COMMAND >> $SNMP_TMPDIR/invoked
 
442
        $COMMAND > /dev/null 2>&1
 
443
    fi
 
444
}
 
445
 
 
446
HUPAGENT() {
 
447
    HUPPROG $SNMP_SNMPD_PID_FILE
 
448
    if [ "x$OSTYPE" != "xmsys" ]; then
 
449
        WAITFORAGENT "restarted"
 
450
    fi
 
451
}
 
452
 
 
453
HUPTRAPD() {
 
454
    HUPPROG $SNMP_SNMPTRAPD_PID_FILE
 
455
    if [ "x$OSTYPE" != "xmsys" ]; then
 
456
        WAITFORTRAPD "restarted"
 
457
    fi
 
458
}
 
459
 
416
460
 
417
461
## used by STOPAGENT and STOPTRAPD
418
462
# delay before kill to allow previous action to finish