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