Mercurial > ~dholland > hg > ag > index.cgi
comparison mk/testprog-defs.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 # testprog-defs.sh - generate make rules for testprog.mk | |
3 # usage: testprog-defs.sh "tests" "diffonly-tests" > rules.mk | |
4 | |
5 if [ $# != 2 ]; then | |
6 echo "$0: usage: $0 'tests' 'diffonly-tests'" 1>&2 | |
7 exit 1 | |
8 fi | |
9 | |
10 TESTS="$1" | |
11 DIFFONLY="$2" | |
12 | |
13 ( | |
14 for T in $TESTS; do | |
15 echo 1 "$T" | |
16 done | |
17 for T in $DIFFONLY; do | |
18 echo 0 "$T"; | |
19 done | |
20 ) | awk ' | |
21 { | |
22 dorun=$1; | |
23 file=$2; | |
24 if (file ~ "/") { | |
25 srcdir = file; | |
26 sub("^.*/", "", file); | |
27 sub("/[^/]*$", "", srcdir); | |
28 srcdir = "$(TOP)/" srcdir; | |
29 } | |
30 else { | |
31 srcdir = "$(SRCDIR)" | |
32 } | |
33 base=file; | |
34 sub("\\.[a-z][0-9]*$", "", base); | |
35 out = base ".out"; | |
36 err = base ".err"; | |
37 diff = base ".diff"; | |
38 | |
39 printf "run-tests: %s\n", diff; | |
40 printf "%s: $(SRCDIR)/good/%s %s\n", diff, out, out; | |
41 printf "%s: $(SRCDIR)/good/%s %s\n", diff, err, err; | |
42 printf "\t@echo \" [DIFF] %s\"\n", file; | |
43 printf "\t@diff -uN $(SRCDIR)/good/%s %s > $@ || true\n", out, out; | |
44 printf "\t@diff -uN $(SRCDIR)/good/%s %s >> $@ || true\n", err, err; | |
45 printf "\n"; | |
46 | |
47 if (dorun) { | |
48 printf "%s %s: $(SRCDIR)/%s $(RUNPROG)\n", out, err, file; | |
49 printf "\t@echo \" [TEST] %s\"\n", file; | |
50 printf "\t@($(CROSSRUN) $(RUNPROG) %s/%s;", srcdir, file; | |
51 printf " echo Exit $$? 1>&2) \\\n" | |
52 printf "\t > %s 2> %s; \\\n", out, err; | |
53 printf "\n"; | |
54 } | |
55 } | |
56 ' | |
57 |