Mercurial > ~dholland > hg > ag > index.cgi
comparison mk/testagcl-run.sh @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:13d2b8934445 |
---|---|
1 #!/bin/sh | |
2 # testagcl-run.sh - build with agcl and diff results | |
3 # usage: testagcl-run.sh crossrun agcl-executable src-dir good-dir syn-file | |
4 | |
5 if [ $# != 5 ]; then | |
6 echo "Usage: $0 crossrun ag-executable src-dir good-dir syn-file" 1>&2 | |
7 exit 1 | |
8 fi | |
9 | |
10 if [ ! -x "$2" ]; then | |
11 echo "$0: agcl executable $2 not found" 1>&2 | |
12 exit 1 | |
13 fi | |
14 | |
15 if [ ! -d "$3" -o ! -f "$3/$5" ]; then | |
16 echo "$0: source dir and syntax file $3/$5 not found" 1>&2 | |
17 exit 1 | |
18 fi | |
19 | |
20 if [ ! -d "$4" ]; then | |
21 echo "$0: good dir $4 not found" 1>&2 | |
22 exit 1 | |
23 fi | |
24 | |
25 CROSSRUN="$1" | |
26 AGCL="$2" | |
27 SRCDIR="$3" | |
28 GOODDIR="$4" | |
29 SYN="$5" | |
30 | |
31 BASE=`echo "$SYN" | sed 's,\.syn$,,'` | |
32 DIFF="$BASE.diff" | |
33 | |
34 if [ "x$CROSSRUN" != x ]; then | |
35 #echo "$CROSSRUN" "$AGCL" "$SRCDIR/$SYN" | |
36 "$CROSSRUN" "$AGCL" "$SRCDIR/$SYN" > $BASE.log 2>&1 | |
37 else | |
38 #echo "$AGCL" "$SRCDIR/$SYN" | |
39 "$AGCL" "$SRCDIR/$SYN" > $BASE.log 2>&1 | |
40 fi | |
41 echo "Exit $?" >> $BASE.log | |
42 | |
43 rm -f "$DIFF" | |
44 | |
45 for F in "$BASE".*; do | |
46 SUFF=`echo "$F" | sed 's,.*\.,.,'` | |
47 if [ $SUFF = ".syn" ]; then | |
48 continue; | |
49 fi | |
50 case $SUFF in | |
51 .h|.c|.cpp) | |
52 tr -d '\r' < "$F" | sed ' | |
53 s/^\(#ifndef [A-Z_][A-Z0-9_-]*_H\)_[0-9][0-9]*$/\1/ | |
54 s/^\(#define [A-Z_][A-Z0-9_-]*_H\)_[0-9][0-9]*$/\1/ | |
55 s,^\(#line [0-9][0-9]* "\)[^"]*[/\\]\([^"]*\.syn"\),\1\2, | |
56 s|^\(/\* *Line [0-9]*, \).*[/\\]\(.*\.syn \*/\)$|\1\2| | |
57 s,^\(#line \)[0-9]*\( "[^"]*"\),\1-\2, | |
58 s|^\(/\* *Line \)[0-9]*, \(.* \*/\)$|\1-, \2| | |
59 s,^\( \* File generated by:\).*$,\1 ..., | |
60 ' > "$F.new" | |
61 mv -f "$F.new" "$F" | |
62 ;; | |
63 *.log) | |
64 tr -d '\r' < "$F" | sed ' | |
65 s,^.*[/\\]\('"$SYN"': \),\1, | |
66 s,^.*[/\\]\('"$SYN"'([0-9][0-9]*-[0-9][0-9]*): \),\1, | |
67 ' > "$F.new" | |
68 mv -f "$F.new" "$F" | |
69 ;; | |
70 *) | |
71 ;; | |
72 esac | |
73 diff -uN "$GOODDIR"/"$F" "$F" >> "$DIFF" | |
74 done | |
75 | |
76 exit 0 |