legacy_test.sh revision 263081
1#!/bin/sh
2#
3# $FreeBSD: head/tools/regression/usr.bin/lastcomm/regress.t 263081 2014-03-12 10:35:22Z jmmv $
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 -q - $DIR/$1
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 >$DIR/v1v2-$ARCH-acct.in
27cat $DIR/v2-$ARCH.out $DIR/v1-$ARCH.out >$DIR/v1v2-$ARCH.out
28
29echo 1..6
30
31lastcomm -cesuS -f $DIR/v1-$ARCH-acct.in | check 1 v1-$ARCH.out
32lastcomm -cesuS -f - <$DIR/v1-$ARCH-acct.in | tail -r | check 2 v1-$ARCH.out
33lastcomm -cesuS -f $DIR/v2-$ARCH-acct.in | check 3 v2-$ARCH.out
34lastcomm -cesuS -f - <$DIR/v2-$ARCH-acct.in | tail -r | check 4 v2-$ARCH.out
35lastcomm -cesuS -f $DIR/v1v2-$ARCH-acct.in | check 5 v1v2-$ARCH.out
36lastcomm -cesuS -f - <$DIR/v1v2-$ARCH-acct.in | tail -r | check 6 v1v2-$ARCH.out
37
38rm $DIR/v1v2-$ARCH-acct.in
39rm $DIR/v1v2-$ARCH.out
40
41exit 0
42