]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/lastcomm/tests/legacy_test.sh
libevent: Import libevent 2.1.12
[FreeBSD/FreeBSD.git] / usr.bin / lastcomm / tests / legacy_test.sh
1 #!/bin/sh
2 #
3 #
4
5 DIR=`dirname $0`
6 ARCH=`uname -m`
7
8 TZ=UTC; export TZ
9
10 check()
11 {
12         NUM=$1
13         shift
14         # Remove tty field, which varies between systems.
15         awk '{$4 = ""; print}' |
16         if diff -a - $1 >&2
17         then
18                 echo "ok $NUM"
19         else
20                 echo "not ok $NUM"
21         fi
22 }
23
24
25 cat $DIR/v1-$ARCH-acct.in $DIR/v2-$ARCH-acct.in >v1v2-$ARCH-acct.in
26 cat $DIR/v2-$ARCH.out $DIR/v1-$ARCH.out >v1v2-$ARCH.out
27
28 echo 1..6
29
30 lastcomm -cesuS -f $DIR/v1-$ARCH-acct.in | check 1 $DIR/v1-$ARCH.out
31 lastcomm -cesuS -f - <$DIR/v1-$ARCH-acct.in | tail -r | check 2 $DIR/v1-$ARCH.out
32 lastcomm -cesuS -f $DIR/v2-$ARCH-acct.in | check 3 $DIR/v2-$ARCH.out
33 lastcomm -cesuS -f - <$DIR/v2-$ARCH-acct.in | tail -r | check 4 $DIR/v2-$ARCH.out
34 lastcomm -cesuS -f v1v2-$ARCH-acct.in | check 5 v1v2-$ARCH.out
35 lastcomm -cesuS -f - <v1v2-$ARCH-acct.in | tail -r | check 6 v1v2-$ARCH.out
36
37 exit 0