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