~ubuntu-branches/ubuntu/trusty/net-snmp/trusty

« back to all changes in this revision

Viewing changes to testing/test_keychange.sh

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2004-09-13 12:06:21 UTC
  • Revision ID: james.westby@ubuntu.com-20040913120621-g952ntonlleihcvm
Tags: upstream-5.1.1
ImportĀ upstreamĀ versionĀ 5.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# test_keychange.sh
 
4
#
 
5
# Number of SUCCESSes:  3
 
6
#
 
7
#
 
8
# Run test of KeyChange TC against data given by Bert Wijnen in email.
 
9
#
 
10
# NOTE  The snmp_debug flag bit DEBUG_RANDOMZEROS in file snmplib/debug.h
 
11
#       MUST be set before compiling and linking libsnmp.a to testing/ktest
 
12
#       for this to succeed.
 
13
#
 
14
 
 
15
 
 
16
. eval_tools.sh
 
17
 
 
18
VERIFY ktest
 
19
 
 
20
STARTTEST
 
21
 
 
22
 
 
23
#------------------------------------ -o- 
 
24
# Declarations.
 
25
#
 
26
DATAFILE_PREFIX=data.keychange-
 
27
DATAFILE_SUFFIXES="md5 sha1 sha1-des"
 
28
 
 
29
oldkul=
 
30
newkul=
 
31
keychangestring=
 
32
 
 
33
 
 
34
 
 
35
#------------------------------------ -o- 
 
36
# Test.
 
37
#
 
38
for dfs in $DATAFILE_SUFFIXES; do
 
39
        OUTPUT "== Test of KeyChange TC correctness for \"$dfs\"."
 
40
 
 
41
        set x `awk '{ print $1 }' ${DATAFILE_PREFIX}$dfs`
 
42
        shift
 
43
 
 
44
        [ $# -lt 3 ] && FAILED 1 \
 
45
            "Wrong number of lines ($#) in datafile \"$DATAFILE_PREFIX}$dfs\"."
 
46
 
 
47
        oldkey=$1
 
48
        newkey=$2
 
49
        keychangestring=$3
 
50
 
 
51
        CAPTURE "ktest -k -O $oldkey -N $newkey"
 
52
        FAILED $? "ktest"
 
53
 
 
54
        CHECKEXACT $keychangestring
 
55
        [ $? -eq 1 ]
 
56
        FAILED $? "Proper KeyChange string was not generated."
 
57
 
 
58
 
 
59
        SUCCESS "KeyChange TC correctness test for \"$dfs\"."
 
60
done
 
61
 
 
62
 
 
63
 
 
64
 
 
65
#------------------------------------ -o- 
 
66
# Cleanup, exit.
 
67
#
 
68
STOPTEST
 
69
 
 
70
exit $failcount
 
71