/[gnu-crypto]/gnu-crypto/source/choose-classes
ViewVC logotype

Contents of /gnu-crypto/source/choose-classes

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Thu Dec 19 09:29:55 2002 UTC (21 years, 4 months ago) by raif
Branch: MAIN
CVS Tags: ver_1_1_0
Branch point for: stable-2-0
+ removed the JUnit classes.
+ added Mauve classes and tests (ported from JUnit classes).

1 #! /bin/sh
2
3 # Copyright (c) 1998, 1999 Cygnus Solutions
4 # Written by Tom Tromey <tromey@cygnus.com>
5
6 # Copyright (c) 2002 Free Software Foundation, Inc.
7 # Adapted by Mark Wielaard <mark@klomp.org>
8
9 # This file is part of Mauve.
10
11 # Mauve is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2, or (at your option)
14 # any later version.
15
16 # Mauve is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20
21 # You should have received a copy of the GNU General Public License
22 # along with Mauve; see the file COPYING. If not, write to
23 # the Free Software Foundation, 59 Temple Place - Suite 330,
24 # Boston, MA 02111-1307, USA. */
25
26 # Choose the tests we want to run. Output generated in file 'test_classes'.
27 # Usage: choose-classes [-verbose] output-directory [tag] ...
28 # Run in the source directory.
29 # See README for information on tags.
30
31 verbose=
32 spectags=
33 tags=
34 file_specs=
35
36 if test "$1" = "-verbose"; then
37 verbose=yes
38 shift
39 fi
40
41 outdir="$1"
42 shift
43 test -z "$outdir" \
44 && echo "Usage: choose-classes [-verbose] output-directory [tag] ..." \
45 && exit -1
46
47 # Some tags imply other tags. For instance, JDK1.2 implies JDK1.1 and
48 # JDK1.0. This makes it easier to keep the tags up to date in the
49 # source -- we only have to keep track of differences (as opposed to
50 # editing every source file when a new tag is added). If we see an
51 # otherwise-unrecognized tag, and the file `mauve-TAG' exists, then we
52 # treat the contents of that file as a list of implied tags.
53 taglist=${1+"$@"}
54 seen_dashdash=
55 while test -n "$taglist"; do
56 set $taglist
57 i="$1"
58 shift
59 taglist=${1+"$@"}
60
61 case "$i" in
62 X--)
63 seen_dashdash=yes
64 ;;
65 !!java.*)
66 echo "Invalid tag: $i" 1>&2
67 exit 1
68 ;;
69 # !java.* | java.* | !javax.* | javax.*)
70 !java.* | java.* | !javax.* | javax.* | !gnu.* | gnu.*)
71 file="`echo $i | tr . /`"
72 file_specs="$file_specs $file"
73 ;;
74 JAVA2)
75 tags="$tags JDK1.0 JDK1.1 JDK1.2 $i"
76 test -z "$seen_dashdash" && spectags="$spectags $i"
77 ;;
78 JDK1.2)
79 tags="$tags JDK1.0 JDK1.1 JAVA2 $i"
80 test -z "$seen_dashdash" && spectags="$spectags $i"
81 ;;
82 JDK1.1)
83 tags="$tags JDK1.0 JLS1.1 $i"
84 test -z "$seen_dashdash" && spectags="$spectags $i"
85 ;;
86 JDK1.0)
87 tags="$tags JLS1.0"
88 test -z "$seen_dashdash" && spectags="$spectags $i"
89 ;;
90 JLS1.1)
91 tags="$tags JDK1.0 JDK1.1"
92 test -z "$seen_dashdash" && spectags="$spectags $i"
93 ;;
94 JLS1.0)
95 tags="$tags JDK1.0"
96 test -z "$seen_dashdash" && spectags="$spectags $i"
97 ;;
98 *)
99 file=
100 # Always prefer a tag file in the build directory.
101 if test -f "$outdir/mauve-$i"; then
102 file="$outdir/mauve-$i"
103 else
104 if test -f "mauve-$i"; then
105 file="mauve-$i"
106 fi
107 fi
108 if test -n "$file"; then
109 # We don't want tags from a file to be treated as specified
110 # on the command line. So we add a `X--' before the
111 # expansion. We don't use just `--' as this would confuse
112 # `set'.
113 taglist="$taglist X-- `sed -e 's/#.*$//g' $file`"
114 fi
115 tags="$tags $i"
116 test -z "$seen_dashdash" && spectags="$spectags $i"
117 ;;
118 esac
119 done
120
121 # By default, use JDK1.1.
122 test -z "$tags" && tags="JDK1.0 JDK1.1"
123
124 test -n "$verbose" && echo "tags = $tags"
125 test -n "$verbose" && echo "spectags = $spectags"
126 test -n "$verbose" && echo "file_specs = $file_specs"
127
128 classes=/tmp/classes-$$
129 : > $classes
130
131 #(cd gnu/testlet; find java javax -name '*.java' -print) |
132 (cd gnu/testlet; find gnu -name '*.java' -print) |
133 while read file; do
134 exact_match=no
135 test -n "$verbose" && echo "Examining $file"
136 if test -n "$file_specs"; then
137 ok=yes
138 for pat in $file_specs; do
139 # PAT can be like `java.lang' or `!java.lang'.
140 # If `!FILE' matches `PAT', then we know the pattern
141 # starts with `!' and is an exclusion pattern.
142 # Otherwise, if `!FILE' matches `!PAT', then we know that
143 # the file should be included.
144 case "!$file" in
145 ${pat}*)
146 ok=no
147 test -n "$verbose" && echo " ... excluded by $pat"
148 ;;
149 !${pat}.java)
150 # If the tag list includes an exact match, then we
151 # unconditionally accept it.
152 ok=yes
153 exact_match=yes
154 test -n "$verbose" && echo " ... included by $pat (exact match)"
155 ;;
156 !${pat}*)
157 ok=yes
158 test -n "$verbose" && echo " ... included by $pat"
159 ;;
160 esac
161 done
162 else
163 ok=yes
164 fi
165
166 if test "$ok" = no; then
167 continue
168 fi
169
170 # Surround value with spaces so that case statements will work
171 # correctly.
172 taglist=" `grep '^// Tags:' gnu/testlet/$file | sed -e 's,^// Tags:,,'` "
173 istest=yes
174 case "$taglist" in
175 *\ not-a-test\ *)
176 istest=no
177 ;;
178 esac
179
180 # For an exact match, we don't look at the tags.
181 if test "$exact_match" = no; then
182 ok=no
183 # If any tag on the tag list matches, then we are ok.
184 for tag in $tags; do
185 case "$taglist" in
186 *" ${tag} "*)
187 ok=yes
188 break
189 ;;
190 esac
191 done
192
193 # If any specified tag hits a `not' tag, then we are not ok.
194 if test "$ok" = yes; then
195 for tag in $spectags; do
196 case "$taglist" in
197 *" !${tag} "*)
198 ok=no
199 test -n "$verbose" && echo "File $file has tag !$tag"
200 break
201 ;;
202 esac
203 done
204 else
205 test -n "$verbose" && echo " ... excluded because no tag matched"
206 fi
207 fi
208
209 if test "$ok" = yes; then
210 class="gnu.testlet.`echo $file | sed -e 's/\.java$//' | tr / .`"
211 if test "$istest" = yes; then
212 echo $class >> $classes
213 test -n "$verbose" && echo "Chose $class"
214 else
215 test -n "$verbose" && echo " ... excluded because not-a-test"
216 fi
217 fi
218 done
219
220 if test -f $outdir/test_classes \
221 && cmp $classes $outdir/test_classes > /dev/null 2>&1; then
222 # Files are the same.
223 rm $classes
224 else
225 mv $classes $outdir/test_classes
226 fi
227
228 exit 0

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26