|
1 #!/bin/bash |
|
2 # |
|
3 # |
|
4 # CDDL HEADER START |
|
5 # |
|
6 # The contents of this file are subject to the terms of the |
|
7 # Common Development and Distribution License (the "License"). |
|
8 # You may not use this file except in compliance with the License. |
|
9 # |
|
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
11 # or http://www.opensolaris.org/os/licensing. |
|
12 # See the License for the specific language governing permissions |
|
13 # and limitations under the License. |
|
14 # |
|
15 # When distributing Covered Code, include this CDDL HEADER in each |
|
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
17 # If applicable, add the following below this CDDL HEADER, with the |
|
18 # fields enclosed by brackets "[]" replaced with your own identifying |
|
19 # information: Portions Copyright [yyyy] [name of copyright owner] |
|
20 # |
|
21 # CDDL HEADER END |
|
22 # |
|
23 # Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
|
24 # |
|
25 # |
|
26 |
|
27 unset LD_LIBRARY_PATH |
|
28 unset LD_LIBRARY_PATH_32 |
|
29 unset LD_LIBRARY_PATH_64 |
|
30 unset LD_PRELOAD |
|
31 unset LD_PRELOAD_32 |
|
32 unset LD_PRELOAD_64 |
|
33 |
|
34 export TOPDIR="../../" |
|
35 export DO_CLEANUP="no" |
|
36 export INDEX_HTML="index.html" |
|
37 export LD_LIBRARY_PATH="../lib" |
|
38 export LD_LIBRARY_PATH_32="../lib" |
|
39 export LD_LIBRARY_PATH_64="../lib" |
|
40 |
|
41 UNKNOWN_ARG=no |
|
42 PRINT_HELP=no |
|
43 |
|
44 check_args() { |
|
45 while [ "$#" -gt 0 ] ; do |
|
46 UNKNOWN_ARG=no |
|
47 case "$1" in |
|
48 --topdir=*) |
|
49 TOPDIR=`echo $1 | sed "s,^--topdir=\(.*\),\1,"` |
|
50 ;; |
|
51 --cleanup) |
|
52 DO_CLEANUP=yes |
|
53 ;; |
|
54 --help) |
|
55 PRINT_HELP=yes |
|
56 ;; |
|
57 *) |
|
58 UNKNOWN_ARG=yes |
|
59 ;; |
|
60 esac |
|
61 |
|
62 if [ "${UNKNOWN_ARG}" = "yes" ] ; then |
|
63 echo "$1: Invalid argument" |
|
64 PRINT_HELP=yes |
|
65 shift |
|
66 continue |
|
67 fi |
|
68 |
|
69 shift |
|
70 done |
|
71 |
|
72 export TOPDIR DO_CLEANUP |
|
73 |
|
74 if [ "$PRINT_HELP" = "yes" ] || [ "$UNKNOWN_ARG" = "yes" ] ; then |
|
75 echo "Usage [1]: `basename $0` [ --topdir=\$(top_srcdir) ]" |
|
76 echo "Usage [2]: `basename $0` [ --cleanup ]" |
|
77 exit 1 |
|
78 fi |
|
79 } |
|
80 |
|
81 setup_index_html() { |
|
82 cat /dev/null > ${INDEX_HTML} |
|
83 } |
|
84 |
|
85 run_examples() { |
|
86 if [ "${DO_CLEANUP}" = "yes" ] ; then |
|
87 return |
|
88 fi |
|
89 |
|
90 for file in \ |
|
91 "accumulate" \ |
|
92 "adj_diff" \ |
|
93 "advance" \ |
|
94 "alg1" \ |
|
95 "alg2" \ |
|
96 "alg3" \ |
|
97 "alg4" \ |
|
98 "alg5" \ |
|
99 "alg6" \ |
|
100 "alg7" \ |
|
101 "auto_ptr" \ |
|
102 "binary_search" \ |
|
103 "binders" \ |
|
104 "bitset" \ |
|
105 "codecvt" \ |
|
106 "codecvt1" \ |
|
107 "collate" \ |
|
108 "complex" \ |
|
109 "complx" \ |
|
110 "copyex" \ |
|
111 "count" \ |
|
112 "ctype" \ |
|
113 "deque" \ |
|
114 "distance" \ |
|
115 "dynatype" \ |
|
116 "equal" \ |
|
117 "equal_range" \ |
|
118 "failure" \ |
|
119 "filebuf" \ |
|
120 "fill" \ |
|
121 "find" \ |
|
122 "find_end" \ |
|
123 "find_first_of" \ |
|
124 "fmtflags_manip" \ |
|
125 "for_each" \ |
|
126 "fstream" \ |
|
127 "funct_ob" \ |
|
128 "generate" \ |
|
129 "graph" \ |
|
130 "gslice" \ |
|
131 "gslice_array" \ |
|
132 "has_facet" \ |
|
133 "heap_ops" \ |
|
134 "icecream" \ |
|
135 "ifstream" \ |
|
136 "includes" \ |
|
137 "indirect_array" \ |
|
138 "inner_product" \ |
|
139 "insert_iterator" \ |
|
140 "insert_wchar" \ |
|
141 "isalnum" \ |
|
142 "istream1" \ |
|
143 "istreambuf_iterator" \ |
|
144 "istringstream" \ |
|
145 "istrstream" \ |
|
146 "lex_compare" \ |
|
147 "limits" \ |
|
148 "list" \ |
|
149 "locale" \ |
|
150 "map" \ |
|
151 "mask_array" \ |
|
152 "max" \ |
|
153 "max_elem" \ |
|
154 "mbsrtowcs" \ |
|
155 "memfunc" \ |
|
156 "memfunref" \ |
|
157 "merge" \ |
|
158 "messages" \ |
|
159 "mismatch" \ |
|
160 "money_get" \ |
|
161 "moneypunct" \ |
|
162 "moneyput" \ |
|
163 "multimap" \ |
|
164 "multiset" \ |
|
165 "mutex" \ |
|
166 "negator" \ |
|
167 "nthelem" \ |
|
168 "num_get" \ |
|
169 "numpunct" \ |
|
170 "num_put" \ |
|
171 "ostream" \ |
|
172 "ostreambuf_iterator" \ |
|
173 "partial_sort" \ |
|
174 "partial_sum" \ |
|
175 "partition" \ |
|
176 "permutation" \ |
|
177 "pnt2fnct" \ |
|
178 "priority_queue" \ |
|
179 "queue" \ |
|
180 "radix" \ |
|
181 "random_shuffle" \ |
|
182 "remove" \ |
|
183 "replace" \ |
|
184 "reverse" \ |
|
185 "reverse_iterator" \ |
|
186 "rotate" \ |
|
187 "rwexcept" \ |
|
188 "search" \ |
|
189 "set_diff" \ |
|
190 "setex" \ |
|
191 "set_intr" \ |
|
192 "set_sym_diff" \ |
|
193 "set_union" \ |
|
194 "sieve" \ |
|
195 "slice" \ |
|
196 "slice_array" \ |
|
197 "sort" \ |
|
198 "stack" \ |
|
199 "stdexcept" \ |
|
200 "stringbuf" \ |
|
201 "strstream" \ |
|
202 "strstreambuf" \ |
|
203 "swap" \ |
|
204 "tele" \ |
|
205 "teller" \ |
|
206 "time_get" \ |
|
207 "time_put" \ |
|
208 "toupper" \ |
|
209 "transform" \ |
|
210 "ul_bound" \ |
|
211 "unique" \ |
|
212 "use_facet" \ |
|
213 "valarray" \ |
|
214 "vector" \ |
|
215 "widwork" \ |
|
216 "wostream" \ |
|
217 "wstringstream" |
|
218 do |
|
219 echo "------------------------------------------------------------" |
|
220 if [ -f ${file} ] ; then |
|
221 echo -n "Running example program ${file} ..." |
|
222 logfile="${file}.out" |
|
223 ./${file} > ${logfile} 2>&1 |
|
224 ret=$? |
|
225 if [ ${ret} -eq 0 ] ; then |
|
226 echo "SUCCESS." |
|
227 else |
|
228 echo "FAIL." |
|
229 fi |
|
230 echo "<a href=\"${file}.out\">${file}.out</a>" >> ${INDEX_HTML} |
|
231 echo "</br>" >> ${INDEX_HTML} |
|
232 else |
|
233 echo "Example program ${file} not found. Skipping." |
|
234 fi |
|
235 echo "------------------------------------------------------------" |
|
236 done |
|
237 } |
|
238 |
|
239 run_examples_with_input() { |
|
240 if [ "${DO_CLEANUP}" = "yes" ] ; then |
|
241 return |
|
242 fi |
|
243 |
|
244 echo "------------------------------------------------------------" |
|
245 echo -n "Running example program spell ... " |
|
246 echo spelltest | ./spell > ./spell.out 2>&1 |
|
247 ret=$? |
|
248 if [ ${ret} -eq 0 ] ; then |
|
249 echo "SUCCESS." |
|
250 else |
|
251 echo "FAIL." |
|
252 fi |
|
253 echo "------------------------------------------------------------" |
|
254 echo "<a href=\"spell.out\">spell.out</a>" >> ${INDEX_HTML} |
|
255 echo "</br>" >> ${INDEX_HTML} |
|
256 |
|
257 echo "------------------------------------------------------------" |
|
258 echo -n "Running example program stocks ... " |
|
259 echo y y q | ./stocks >> ./stocks.out 2>&1 |
|
260 ret=$? |
|
261 if [ ${ret} -eq 0 ] ; then |
|
262 echo "SUCCESS." |
|
263 else |
|
264 echo "FAIL." |
|
265 fi |
|
266 echo "------------------------------------------------------------" |
|
267 echo "<a href=\"stocks.out\">stocks.out</a>" >> ${INDEX_HTML} |
|
268 echo "</br>" >> ${INDEX_HTML} |
|
269 |
|
270 echo "------------------------------------------------------------" |
|
271 echo -n "Running example program calc ... " |
|
272 echo '5 1 2 + 4 * 3 - +' p q | ./calc >> ./calc.out 2>&1 |
|
273 ret=$? |
|
274 if [ ${ret} -eq 0 ] ; then |
|
275 echo "SUCCESS." |
|
276 else |
|
277 echo "FAIL." |
|
278 fi |
|
279 echo "------------------------------------------------------------" |
|
280 echo "<a href=\"calc.out\">calc.out</a>" >> ${INDEX_HTML} |
|
281 echo "</br>" >> ${INDEX_HTML} |
|
282 |
|
283 echo "------------------------------------------------------------" |
|
284 echo -n "Running example program concord ... " |
|
285 echo 'this is a line of text' | ./concord >> ./concord.out 2>&1 |
|
286 ret=$? |
|
287 if [ ${ret} -eq 0 ] ; then |
|
288 echo "SUCCESS." |
|
289 else |
|
290 echo "FAIL." |
|
291 fi |
|
292 echo "------------------------------------------------------------" |
|
293 echo "<a href=\"concord.out\">concord.out</a>" >> ${INDEX_HTML} |
|
294 echo "</br>" >> ${INDEX_HTML} |
|
295 |
|
296 echo "------------------------------------------------------------" |
|
297 echo -n "Running example program money_manip ... " |
|
298 echo '1234.56' | ./money_manip >> ./money_manip.out 2>&1 |
|
299 ret=$? |
|
300 if [ ${ret} -eq 0 ] ; then |
|
301 echo "SUCCESS." |
|
302 else |
|
303 echo "FAIL." |
|
304 fi |
|
305 echo "------------------------------------------------------------" |
|
306 echo "<a href=\"money_manip.out\">money_manip.out</a>" >> ${INDEX_HTML} |
|
307 echo "</br>" >> ${INDEX_HTML} |
|
308 |
|
309 echo "------------------------------------------------------------" |
|
310 echo -n "Running example program string ... " |
|
311 echo 'This is a test string' | ./string >> ./string.out 2>&1 |
|
312 ret=$? |
|
313 if [ ${ret} -eq 0 ] ; then |
|
314 echo "SUCCESS." |
|
315 else |
|
316 echo "FAIL." |
|
317 fi |
|
318 echo "------------------------------------------------------------" |
|
319 echo "<a href=\"string.out\">string.out</a>" >> ${INDEX_HTML} |
|
320 echo "</br>" >> ${INDEX_HTML} |
|
321 |
|
322 echo "------------------------------------------------------------" |
|
323 echo -n "Running example program time_manip ... " |
|
324 echo 'Thu Sep 17 13:23:53 2009' | ./time_manip >> ./time_manip.out 2>&1 |
|
325 ret=$? |
|
326 if [ ${ret} -eq 0 ] ; then |
|
327 echo "SUCCESS." |
|
328 else |
|
329 echo "FAIL." |
|
330 fi |
|
331 echo "------------------------------------------------------------" |
|
332 echo "<a href=\"time_manip.out\">time_manip.out</a>" >> ${INDEX_HTML} |
|
333 echo "</br>" >> ${INDEX_HTML} |
|
334 } |
|
335 |
|
336 do_cleanup() { |
|
337 if [ "${DO_CLEANUP}" = "no" ] ; then |
|
338 return |
|
339 fi |
|
340 |
|
341 for file in \ |
|
342 "accumulate" \ |
|
343 "adj_diff" \ |
|
344 "advance" \ |
|
345 "alg1" \ |
|
346 "alg2" \ |
|
347 "alg3" \ |
|
348 "alg4" \ |
|
349 "alg5" \ |
|
350 "alg6" \ |
|
351 "alg7" \ |
|
352 "auto_ptr" \ |
|
353 "binary_search" \ |
|
354 "binders" \ |
|
355 "bitset" \ |
|
356 "calc" \ |
|
357 "codecvt" \ |
|
358 "codecvt1" \ |
|
359 "collate" \ |
|
360 "complex" \ |
|
361 "complx" \ |
|
362 "concord" \ |
|
363 "copyex" \ |
|
364 "count" \ |
|
365 "ctype" \ |
|
366 "deque" \ |
|
367 "distance" \ |
|
368 "dynatype" \ |
|
369 "equal" \ |
|
370 "equal_range" \ |
|
371 "failure" \ |
|
372 "filebuf" \ |
|
373 "fill" \ |
|
374 "find" \ |
|
375 "find_end" \ |
|
376 "find_first_of" \ |
|
377 "fmtflags_manip" \ |
|
378 "for_each" \ |
|
379 "fstream" \ |
|
380 "funct_ob" \ |
|
381 "generate" \ |
|
382 "graph" \ |
|
383 "gslice" \ |
|
384 "gslice_array" \ |
|
385 "has_facet" \ |
|
386 "heap_ops" \ |
|
387 "icecream" \ |
|
388 "ifstream" \ |
|
389 "includes" \ |
|
390 "indirect_array" \ |
|
391 "inner_product" \ |
|
392 "insert_iterator" \ |
|
393 "insert_wchar" \ |
|
394 "isalnum" \ |
|
395 "istream1" \ |
|
396 "istreambuf_iterator" \ |
|
397 "istringstream" \ |
|
398 "istrstream" \ |
|
399 "lex_compare" \ |
|
400 "limits" \ |
|
401 "list" \ |
|
402 "locale" \ |
|
403 "map" \ |
|
404 "mask_array" \ |
|
405 "max" \ |
|
406 "max_elem" \ |
|
407 "mbsrtowcs" \ |
|
408 "memfunc" \ |
|
409 "memfunref" \ |
|
410 "merge" \ |
|
411 "messages" \ |
|
412 "mismatch" \ |
|
413 "money_get" \ |
|
414 "moneypunct" \ |
|
415 "moneyput" \ |
|
416 "money_manip" \ |
|
417 "multimap" \ |
|
418 "multiset" \ |
|
419 "mutex" \ |
|
420 "negator" \ |
|
421 "nthelem" \ |
|
422 "num_get" \ |
|
423 "numpunct" \ |
|
424 "num_put" \ |
|
425 "ostream" \ |
|
426 "ostreambuf_iterator" \ |
|
427 "partial_sort" \ |
|
428 "partial_sum" \ |
|
429 "partition" \ |
|
430 "permutation" \ |
|
431 "pnt2fnct" \ |
|
432 "priority_queue" \ |
|
433 "queue" \ |
|
434 "radix" \ |
|
435 "random_shuffle" \ |
|
436 "remove" \ |
|
437 "replace" \ |
|
438 "reverse" \ |
|
439 "reverse_iterator" \ |
|
440 "rotate" \ |
|
441 "rwexcept" \ |
|
442 "search" \ |
|
443 "set_diff" \ |
|
444 "setex" \ |
|
445 "set_intr" \ |
|
446 "set_sym_diff" \ |
|
447 "set_union" \ |
|
448 "sieve" \ |
|
449 "slice" \ |
|
450 "slice_array" \ |
|
451 "sort" \ |
|
452 "spell" \ |
|
453 "stack" \ |
|
454 "stdexcept" \ |
|
455 "stocks" \ |
|
456 "string" \ |
|
457 "stringbuf" \ |
|
458 "strstream" \ |
|
459 "strstreambuf" \ |
|
460 "swap" \ |
|
461 "tele" \ |
|
462 "teller" \ |
|
463 "time_get" \ |
|
464 "time_manip" \ |
|
465 "time_put" \ |
|
466 "toupper" \ |
|
467 "transform" \ |
|
468 "ul_bound" \ |
|
469 "unique" \ |
|
470 "use_facet" \ |
|
471 "valarray" \ |
|
472 "vector" \ |
|
473 "widwork" \ |
|
474 "wostream" \ |
|
475 "wstringstream" |
|
476 do |
|
477 rm -f "${file}.out" |
|
478 done |
|
479 |
|
480 rm -f core |
|
481 } |
|
482 |
|
483 check_args $@ |
|
484 run_examples |
|
485 run_examples_with_input |
|
486 do_cleanup |
|
487 |
|
488 exit 0 |
|
489 |
|
490 |