xref: /aosp_15_r20/external/one-true-awk/testdir/Compare.tt (revision 9a7741de182b2776d7b30d6355f2585c0780a51b)
1*9a7741deSElliott Hughes#!/bin/sh
2*9a7741deSElliott Hughes
3*9a7741deSElliott Hughesoldawk=${oldawk-awk}
4*9a7741deSElliott Hughesawk=${awk-../a.out}
5*9a7741deSElliott Hughes
6*9a7741deSElliott Hughesecho compiling time.c
7*9a7741deSElliott Hughescc time.c -o time
8*9a7741deSElliott Hughestime=./time
9*9a7741deSElliott Hughes
10*9a7741deSElliott Hughesecho time command = $time
11*9a7741deSElliott Hughes
12*9a7741deSElliott Hughes#case `uname` in
13*9a7741deSElliott Hughes#SunOS)
14*9a7741deSElliott Hughes#	time=/usr/bin/time ;;
15*9a7741deSElliott Hughes#Linux)
16*9a7741deSElliott Hughes#	time=/usr/bin/time ;;
17*9a7741deSElliott Hughes#*)
18*9a7741deSElliott Hughes#	time=time ;;
19*9a7741deSElliott Hughes#esac
20*9a7741deSElliott Hughes
21*9a7741deSElliott Hughesecho oldawk = $oldawk, awk = $awk, time command = $time
22*9a7741deSElliott Hughes
23*9a7741deSElliott Hughes
24*9a7741deSElliott Hughes# an arbitrary collection of input data
25*9a7741deSElliott Hughes
26*9a7741deSElliott Hughescat td.1 td.1 >foo.td
27*9a7741deSElliott Hughessed 's/^........................//' td.1 >>foo.td
28*9a7741deSElliott Hughespr -m td.1 td.1 td.1 >>foo.td
29*9a7741deSElliott Hughespr -2 td.1 >>foo.td
30*9a7741deSElliott Hughescat bib >>foo.td
31*9a7741deSElliott Hugheswc foo.td
32*9a7741deSElliott Hughes
33*9a7741deSElliott Hughestd=foo.td
34*9a7741deSElliott Hughes>footot
35*9a7741deSElliott Hughes
36*9a7741deSElliott Hughesfor i in $*
37*9a7741deSElliott Hughesdo
38*9a7741deSElliott Hughes	echo $i "($oldawk vs $awk)":
39*9a7741deSElliott Hughes	# ind <$i
40*9a7741deSElliott Hughes	$time $oldawk -f $i $td >foo2 2>foo2t
41*9a7741deSElliott Hughes	cat foo2t
42*9a7741deSElliott Hughes	$time $awk -f $i $td >foo1 2>foo1t
43*9a7741deSElliott Hughes	cat foo1t
44*9a7741deSElliott Hughes	cmp foo1 foo2
45*9a7741deSElliott Hughes	echo $i: >>footot
46*9a7741deSElliott Hughes	cat foo1t foo2t >>footot
47*9a7741deSElliott Hughesdone
48*9a7741deSElliott Hughes
49*9a7741deSElliott Hughesctimes footot
50