source: trunk/athena/bin/hostinfo/regress.sh @ 13429

Revision 13429, 957 bytes checked in by danw, 25 years ago (diff)
reimplement hostinfo as a perl wrapper around /usr/athena/bin/host (from third/bind). Add a regression test in case host's output changes.
  • Property svn:executable set to *
RevLine 
[13429]1#!/bin/sh
2
3SRCDIR=${SRCDIR:-.}
4
5check () {
6    if [ "$2" != "$3" ]; then
7        echo Regression test failed checking $1:
8        echo Expected $2, got $3
9        exit 1
10    fi;
11}
12
13gather () {
14    first=`eval $1`
15    list=$first
16    count=0
17    while [ $count -lt 10 ]; do
18        new=`eval $1`
19        if [ "$new" = "$first" ]; then
20            break
21        fi
22        list="$list\n$new"
23        count=`expr $count + 1`
24    done
25    echo $list | sort | tr '\012' ' ' | sed -e 's/ $//'
26}
27
28check "bitsy's host address" 18.72.0.3 "`$SRCDIR/hostinfo.pl -a bitsy 2>&1`"
29check "18.71.0.151's name" STRAWB.MIT.EDU "`$SRCDIR/hostinfo.pl -h 18.71.0.151 2>&1`"
30check "ls's hostinfo" "DEC/VAXSTATION-2000/UNIX" "`$SRCDIR/hostinfo.pl -i ls 2>&1`"
31check "ai's MX record" life.ai.mit.edu "`$SRCDIR/hostinfo.pl -m ai.mit.edu 2>&1`"
32
33athmx=`gather "$SRCDIR/hostinfo.pl -m athena"`
34mitmx=`gather "$SRCDIR/hostinfo.pl -m mit"`
35check "athena's MX records match mit's MX records" "$athmx" "$mitmx"
36
37echo "Regression tests passed."
38exit 0
Note: See TracBrowser for help on using the repository browser.