aboutsummaryrefslogtreecommitdiff
path: root/doc/dejagnu.texi
blob: 34b11a1f667f9ce663f4c670a4684fb2aa80948c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
\input texinfo       @c                    -*- Texinfo -*-
@setfilename dejagnu.info
@documentencoding us-ascii
@settitle DejaGnu
@finalout

@c man begin INCLUDE
@include version.texi
@c man end

@copying
@c man begin COPYRIGHT
Copyright @copyright{} 1992-2019 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.  A copy of the license is included in the section entitled
``GNU Free Documentation License''.

@c man end
@end copying

@dircategory Software development
@direntry
* DejaGnu: (dejagnu).           The GNU testing framework.
@end direntry

@titlepage
@title DejaGnu
@ifset VERSION_PACKAGE
@subtitle @value{VERSION_PACKAGE}
@end ifset
@subtitle Version @value{VERSION}
@sp 1
@subtitle @value{UPDATED}
@author Rob Savoye et al.
@author Cygnus Support and the GNU Project
@page

@vskip 0pt plus 1filll
@insertcopying
@end titlepage
@contents

@node Top, Introduction, , (dir)
@top DejaGnu

@menu
* Introduction::
* Running tests::
* Running other DejaGnu commands::
* Customizing DejaGnu::
* Extending DejaGnu::
* Unit testing::
* Built-in Procedures::
* GNU Free Documentation License::
* Concept Index::
* Procedure Index::
* Variable Index::

@detailmenu

Introduction

* What is DejaGnu?::
* New in this release: Release Notes
* Design goals::
* A POSIX conforming test framework: A POSIX Conforming Test Framework.
* Installation::

Running tests

* Running 'make check': Make Check.
* Running runtest: Runtest.
* Output files: Output Files.

Running other DejaGnu commands

* Invoking dejagnu::            Command line options for the launcher itself.
* Invoking dejagnu help::	Reading man pages for dejagnu subcommands.
* Invoking dejagnu report card::  Summarizing test results from many tools.

Customizing DejaGnu

* Global configuration file::
* Local configuration file::
* Board configuration file::
* Remote host testing::
* Configuration file values::

Extending DejaGnu

* Adding a new testsuite::
* Adding a new tool::
* Adding a new target::
* Adding a new board::
* Board file values::
* Writing a test case::
* Debugging a test case::
* Adding a test case to a testsuite::
* Test case special variables: Test case variables.

Unit testing

* What is unit testing?::
* The dejagnu.h header file: The dejagnu_h header file.
* C unit testing API::
* C++ unit testing API::

Reference

* Built-in Procedures::

Indices

* Concept Index::
* Procedure Index::
* Variable Index::

@end detailmenu
@end menu

@node Introduction, Running tests, Top, Top
@chapter Introduction

@menu
* What is DejaGnu?::
* New in this release: Release Notes.
* Design goals::
* A POSIX compliant test framework: A POSIX Conforming Test Framework.
* Installation::
@end menu

@node What is DejaGnu?, Release Notes, , Introduction
@section What is DejaGnu?

DejaGnu is a framework for testing other programs, providing a single
front-end for all tests.  You can think of it as a library of Tcl
procedures to help with writing a test harness.  A @emph{test harness}
is the infrastructure that is created to test a specific program or
tool.  Each program can have multiple testsuites, all supported by a
single test harness.  DejaGnu is written in Expect, which in turn uses
Tcl, the Tool command language.  There is more information on Tcl at
the @uref{http://www.tcl.tk,Tcl/Tk web site} and the
@uref{http://expect.nist.gov,Expect web site}.

Julia Menapace first coined the term @emph{DejaGnu} to describe an
earlier testing framework she wrote at Cygnus Support for testing GDB.
When we replaced it with the Expect-based framework, it was like
DejaGnu all over again.  More importantly, it was also named after my
daughter, Deja Snow Savoye, who was a toddler during DejaGnu's
beginnings.

DejaGnu offers several advantages for testing:

@itemize

@item
The flexibility and consistency of the DejaGnu framework make it easy to
write tests for any program, with either batch-oriented, or interactive
programs.

@item
DejaGnu provides a layer of abstraction which allows you to write
tests that are portable to any host or target where a program must be
tested.  For instance, a test for @code{GDB} can run from any
supported host system on any supported target system.  DejaGnu runs
tests on many single board computers, whose operating software ranges
from a simple boot monitor to a real-time OS.

@item
All tests have the same output format.  This makes it easy to
integrate testing into other software development processes.
DejaGnu's output is designed to be parsed by other filtering script
and it is also human readable.

@item
Using Tcl and Expect, it's easy to create wrappers for existing
testsuites.  By incorporating existing tests under DejaGnu, it's
easier to have a single set of report analyse programs..
@end itemize

Running tests requires two things: the testing framework and the
testsuites themselves.  Tests are usually written in Expect using Tcl,
but you can also use a Tcl script to run a testsuite that is not based
on Expect.  Expect script filenames conventionally use @file{.exp} as
a suffix.  For example, the main implementation of the DejaGnu test
driver is in the file @file{runtest.exp}.

@node Release Notes, Design goals, What is DejaGnu?, Introduction
@section New in this release

The following major, user-visible changes have been introduced since
version 1.5.3.

@enumerate

@item
Support for target communication via SSH has been added.

@item
A large number of very old config and baseboard files have been
removed.  If you need to resurrect these, you can get them from
version 1.5.3.  If you can show that a board is still in use, it can
be put back in the distribution.

@item
The @command{--status} command line option is now the default.  This
means that any error in the testsuite Tcl scripts will cause runtest
to abort with exit status code 2.  The @command{--status} option has
been removed from the documentation, but will continue to be accepted
for backward compatibility.

@item
@command{runtest} now exits with exit code 0 if the testsuite
"passed", 1 if something unexpected happened (eg, FAIL, XPASS or
UNRESOLVED), and 2 if an exception is raised by the Tcl interpreter.

@item
@command{runtest} now exits with the standard exit codes of programs
that are terminated by the SIGINT, SIGTERM and SIGQUIT signals.

@item
The user-visible utility procedures @code{absolute}, @code{psource}
and @code{slay} have been removed.  If a testsuite uses any of these
procedures, a copy of the procedure should be made and placed in the
lib directory of the testsuite.

@item
Support was added for testing the D compiler.

@item
@file{~/.dejagnurc} is now loaded last, not first.  This allows the
user to have the ability to override anything in their environment
(even the @file{site.exp} file specified by @code{$DEJAGNU}).

@item
The user-visible utility procedure @code{unsetenv} is
@strong{deprecated} and will be removed in the next release.  If a
testsuite uses this procedure, a copy should be made and placed in the
lib directory of the testsuite.

@end enumerate

@node Design goals, A POSIX Conforming Test Framework, Release Notes, Introduction
@section Design goals
@cindex design goals

DejaGnu grew out of the internal needs of Cygnus Solutions (formerly
Cygnus Support).  Cygnus maintained and enhanced a variety of free
programs in many different environments and needed a testing tool
that:

@itemize

@item
was useful to developers while fixing bugs;

@item
automated running many tests during a software release process;

@item
was portable among a variety of host computers;

@item
supported a cross-development environment;

@item
permitted testing of interactive programs like @code{GDB}; and

@item
permitted testing of batch-oriented programs like @code{GCC}.
@end itemize

Some of the requirements proved challenging.  For example, interactive
programs do not lend themselves very well to automated testing.  But
all the requirements are important.  For instance, it is imperative to
make sure that @code{GDB} works as well when cross-debugging as it
does in a native configuration.

Probably the greatest challenge was testing in a cross-development
environment.  Most cross-development environments are customized by
each developer.  Even when buying packaged boards from vendors there
are many differences.  The communication interfaces vary from a serial
line to Ethernet.  DejaGnu was designed with a modular communication
setup, so that each kind of communication can be added as required and
supported thereafter.  Once a communication procedure is written, any
test can use it.  Currently DejaGnu can use @code{ssh}, @code{rsh},
@code{rlogin}, @code{telnet}, @code{tip}, and @code{kermit} for remote
communications.

@node A POSIX Conforming Test Framework, Installation, Design goals, Introduction
@section A POSIX compliant test framework
@cindex POSIX compliant test framework
@cindex POSIX 1003.3

DejaGnu conforms to the POSIX 1003.3 standard for test frameworks.
Rob Savoye was a member of that committee.

POSIX standard 1003.3 defines what a testing framework needs to
provide to create a POSIX compliant testsuite.  This standard is
primarily oriented to checking POSIX conformance, but its requirements
also support testing of features not related to POSIX conformance.
POSIX 1003.3 does not specify a particular testing framework, but at
this time there is only one other POSIX conforming test framework.
TET was created by Unisoft for a consortium comprised of X/Open, Unix
International and the Open Software Foundation.

@cindex assertions
The POSIX documentation refers to @dfn{assertions}.  An assertion is a
description of behavior.  For example, if a standard says ``The sun
shall shine'', a corresponding assertion might be ``The sun is
shining.''  A test based on this assertion would pass or fail
depending on whether it is day or night.  It is important to note that
the standard being tested is never 1003.3; the standard being tested
is some other standard, for which the assertions were written.

As there is no testsuite to verify that testing frameworks are POSIX
1003.3 compliant, this is done by repeatedly reading the standard and
experimenting.  One of the main things POSIX 1003.3 does specify is
the set of allowed output messages and their definitions.  Four
messages are supported for a required feature of POSIX conforming
systems and a fifth for a conditional feature.  DejaGnu supports all
five output messages.  In this sense a testsuite that uses exactly
these messages can be considered POSIX compliant.  These definitions
specify the output of a test case:

@table @asis

@item PASS
A test has succeeded.  That is, it demonstrated that the assertion is
true.

@item FAIL
A test has not succeeded -- the assertion is false.  The @emph{FAIL}
message is based on this test case only.  Other messages are used to
indicate a failure of the framework.  As with @emph{PASS}, POSIX tests
must return @emph{FAIL} rather than @emph{XFAIL} even if a failure was
expected.

@item XFAIL
POSIX 1003.3 does not incorporate the notion of expected failures, so
@emph{PASS}, instead of @emph{XPASS}, must also be returned for test
cases which were expected to fail and did not.  This means that
@emph{PASS} is in some sense more ambiguous than if @emph{XPASS} is
also used.

@item UNRESOLVED
A test produced indeterminate results.  Usually, this means the test
executed in an unexpected fashion.  This outcome requires a human to
go over results to determine if the test should have passed or failed.
This message is also used for any test that requires human
intervention because it is beyond the abilities of the testing
framework.  Any unresolved test should resolved to @emph{PASS} or
@emph{FAIL} before a test run can be considered finished.

Note that for POSIX, each assertion must produce a test result code.
If the test isn't actually run, it must produce @emph{UNRESOLVED}
rather than just leaving that test out of the output.  This means that
you have to be careful when writing tests to not carelessly use Tcl
commands like @emph{return}---if you alter the flow of control of the
Tcl code you must insure that every test still produces some result
code.

Here are some of the ways a test may wind up @emph{UNRESOLVED}:
@end table

@itemize

@item
Execution of a test is interrupted.

@item
A test does not produce a clear result.  This is usually because there
was an @emph{ERROR} from DejaGnu while processing the test, or because
there were three or more @emph{WARNING} messages.  Any @emph{WARNING}
or @emph{ERROR} messages can invalidate the output of the test.  This
usually requires a human to examine the output to determine what
really happened -- and to improve the test case.

@item
A test depends on a previous test, which has failed.

@item
The test was set up incorrectly.
@end itemize

@table @asis

@item UNTESTED
A test was not run.  This is a placeholder used when there is no real
test case yet.
@end table

@table @asis

@item UNSUPPORTED
There is no support for the tested case.  This may mean that a
conditional feature of an operating system, or of a compiler, is not
implemented.  DejaGnu also uses this message when a testing
environment (often a ``bare board'' target) lacks basic support for
compiling or running the test case.  For example, a test for the
system subroutine @emph{gethostname} would never work on a target
board running only a boot monitor.
@end table

DejaGnu uses the same output procedures to produce these messages for
all testsuites and these procedures are already known to conform to
POSIX 1003.3.  For a DejaGnu testsuite to conform to POSIX 1003.3, you
must avoid the @emph{setup_xfail} procedure as described in the
@emph{PASS} section above and you must be careful to return
@emph{UNRESOLVED} where appropriate, as described in the
@emph{UNRESOLVED} section above.

@node Installation, , A POSIX Conforming Test Framework, Introduction
@section Installation

Refer to the @file{INSTALL} in the source distribution for detailed
installation instructions.  Note that there is no compilation step as
with many other GNU packages, as DejaGnu consists of interpreted code
only.

Save for its own small testsuite, the DejaGnu distribution does not
include any testsuites.  Testsuites for the various GNU development
tools are included with those packages.  After configuring the
top-level DejaGnu directory, unpack and configure the test directories
for the tools you want to test; then, in each test directory, run
@emph{make check} to build auxiliary programs required by some of the
tests, and run the test suites.

@node Running tests, Running other DejaGnu commands, Introduction, Top
@chapter Running tests

There are two ways to execute a testsuite.  The most common way is
when there is existing support in the @file{Makefile} of the tool
being tested.  This usually consists of a @emph{check} target.  The
other way is to execute the @code{runtest} program directly.  To run
@code{runtest} directly from the command line requires either all of
the correct command line options, or a @ref{Local configuration file}
must be set up correctly.

@menu
* Running 'make check': Make Check.
* Running runtest: Runtest.
* Output files: Output Files.
@end menu

@node Make Check, Runtest, , Running tests
@section Running 'make check'

To run tests from an existing collection, first use @code{configure}
as usual to set up the build directory.  Then type @code{make check}.
If the @emph{check} target exists, it usually saves you some trouble.
For instance, it can set up any auxiliary programs or other files
needed by the tests.  The most common file the @emph{check} target
depends on is the @file{site.exp} file.  The @file{site.exp} contains
various variables that DejaGnu uses to determine the configuration of
the program being tested.

Once you have run @emph{make check} to build any auxiliary files, you
can invoke the test driver @code{runtest} directly to repeat the
tests.  You will also have to execute @code{runtest} directly for test
collections with no @emph{check} target in the @file{Makefile}.

GNU Automake has built-in support for DejaGnu.  To add DejaGnu support
to your generated @file{Makefile.in}, just add the keyword
@code{dejagnu} to the AUTOMAKE_OPTIONS variable in @file{Makefile.am}.
This will ensure that the generated @file{Makefile.in} has a
@code{check} target that invokes DejaGnu correctly.

@node Runtest, Output Files, Make Check, Running tests
@section Running runtest
@pindex runtest

@code{runtest} is the test driver for DejaGnu.  You can specify two
kinds of things on the @code{runtest} command line: command line
options, and Tcl variables that are passed to the test scripts.  The
options are listed alphabetically below.

@code{runtest} returns one of the following exit codes:

@table @asis
@item 0
if all tests passed including expected failures and unsupported tests.
@item 1
if any test failed, passed unexpectedly, or was unresolved.
@item 2
if Expect encountered any error in the test scripts.
@end table

@menu
* Output States::
* Invoking runtest::
* Common Options: Common Operations.
@end menu

@node Output States, Invoking runtest, , Runtest
@subsection Output States
@cindex output states

@file{runtest} flags the outcome of each test as one of these cases.
See @ref{A POSIX Conforming Test Framework} for a discussion of how
POSIX specifies the meanings of these cases.

@table @asis

@item PASS
The most desirable outcome: the test was expected to succeed and did
succeed.

@item XPASS
A pleasant kind of failure: a test was expected to fail, but
succeeded.  This may indicate progress; inspect the test case to
determine whether you should amend it to stop expecting failure.

@item FAIL
A test failed, although it was expected to succeed.  This may indicate
regress; inspect the test case and the failing software to locate the
bug.

@item XFAIL
A test failed, but it was expected to fail.  This result indicates no
change in a known bug.  If a test fails because the operating system
where the test runs lacks some facility required by the test, the
outcome is @emph{UNSUPPORTED} instead.

@item UNRESOLVED
Output from a test requires manual inspection; the testsuite could not
automatically determine the outcome.  For example, your tests can
report this outcome is when a test does not complete as expected.

@item UNTESTED
A test case is not yet complete, and in particular cannot yet produce
a @emph{PASS} or @emph{FAIL}.  You can also use this outcome in dummy
``tests'' that note explicitly the absence of a real test case for a
particular property.

@item UNSUPPORTED
A test depends on a conditionally available feature that does not
exist (in the configured testing environment).  For example, you can
use this outcome to report on a test case that does not work on a
particular target because its operating system support does not
include a required subroutine.
@end table

@code{runtest} may also display the following messages:

@table @asis

@item ERROR
Indicates a major problem (detected by the test case itself) in
running the test.  This is usually an unrecoverable error, such as a
missing file or loss of communication to the target.  POSIX testsuites
should not emit this message; use @emph{UNSUPPORTED}, @emph{UNTESTED},
or @emph{UNRESOLVED} instead, as appropriate.

@item WARNING
Indicates a possible problem in running the test.  Usually warnings
correspond to recoverable errors, or display an important message
about the following tests.

@item NOTE
An informational message about the test case.
@end table

@node Invoking runtest, Common Operations, Output States, Runtest
@subsection Invoking runtest
@cindex runtest, invoking

This is the full set of command line options that @code{runtest}
recognizes.  Option names may be abbreviated to the shortest unique
string.

@table @asis

@item @code{-a}, @code{--all}
Display all test output.  By default, @emph{runtest} shows only the
output of tests that produce unexpected results; that is, tests with
status @emph{FAIL} (unexpected failure), @emph{XPASS} (unexpected
success), or @emph{ERROR} (a severe error in the test case itself).
Specify @code{--all} to see output for tests with status @emph{PASS}
(success, as expected) @emph{XFAIL} (failure, as expected), or
@emph{WARNING} (minor error in the test case itself).

@item @code{--build [triplet]}
@emph{triplet} is a system triplet of the form
@emph{cpu-manufacturer-os}.  This is the type of machine DejaGnu and
the tools to be tested are built on.  For a normal cross environment
this is the same as the host, but for a Canadian cross, they are
different.

@item @code{-D0}, @code{-D1}
Start the internal Tcl debugger.  The Tcl debugger supports
breakpoints, single stepping, and other common debugging activities.
See the document @uref{http://expect.sourceforge.net/doc/tcl-debug.ps,
Debugger for Tcl Applications} by Don Libes.  If you specify
@emph{-D1}, the @emph{expect} shell stops at a breakpoint as soon as
DejaGnu invokes it.  If you specify @emph{-D0}, DejaGnu starts as
usual, but you can enter the debugger by sending an interrupt (e.g. by
typing @key{Ctrl}-@key{c}).

@item @code{--debug}
Turns on the Expect internal debugging output.  Debugging output is
displayed as part of the @emph{runtest} output, and logged to a file
called @file{dbg.log}.  The extra debugging output does @emph{not}
appear on standard output, unless the verbose level is greater than 2
(for instance, to see debug output immediately, specify @code{--debug
-v -v}).  The debugging output shows all attempts at matching the test
output of the tool with the scripted patterns describing expected
output.  The output generated with @code{--strace} also goes into
@file{dbg.log}.

@item @code{--global_init [name]}
Use @emph{name} as the global init file instead of @file{site.exp} in
@emph{libdir}.  The default is, of course, @file{site.exp}.  Note that
this option accepts a relative file name, interpreted starting at
@emph{libdir}, so a file in a subdirectory may be used.  This is
probably less useful for most sites, but is orthogonal with the
@code{--local_init} option and may be useful in large testing labs.

@item @code{--help}
Prints out a short summary of the @emph{runtest} options, then exits
(even if you specify other options).

@item @code{--host [triplet]}
@emph{triplet} is a system triplet of the form
@emph{cpu-manufactuer-os}.  Use this option to override the default
string recorded by your configuration's choice of host.  This choice
does not change how anything is actually configured unless --build is
also specified; it affects @emph{only} DejaGnu procedures that compare
the host string with particular values.  The procedures @emph{ishost},
@emph{istarget}, @emph{isnative}, and @emph{setup_xfail} are affected
by @code{--host}.  In this usage, @emph{host} refers to the machine
that the tests are to be run on, which may not be the same as the
@emph{build} machine.  If @code{--build} is also specified, then
@code{--host} refers to the machine that the tests will be run on, not
the machine DejaGnu is run on.

@item @code{--host_board [name]}
The host board to use.

@item @code{--ignore [tests(s)] }
The name(s) of specific tests to ignore.

@item @code{--local_init [name]}
Use @emph{name} as the testsuite local init file instead of
@file{site.exp} in the current directory and in @emph{objdir}.  The
default is, of course, @file{site.exp}.  Note that this option accepts
a relative file name, so a file in a subdirectory may be used.

@item @code{--log_dialog}
Emit Expect output to stdout.  The Expect output is usually only
written to the @file{.log} file.  By enabling this option, they are
also printed to standard output.

@item @code{--mail [address(es)]}
Send test results to one or more email addresses.

@item @code{--objdir [path]}
Use @emph{path} as the top directory containing any auxiliary compiled
test code.  The default is '.'.  Use this option to locate
pre-compiled test code.  You can normally prepare any auxiliary files
needed with @emph{make}.

@item @code{--outdir [path]}
Write log files in directory @file{path}.  The default is '.', the
directory where you start @emph{runtest}.  This option affects only
the summary (@file{.sum}) and the detailed log files (@file{.log}).
The DejaGnu debug log @file{dbg.log} always appears (when requested)
in the local directory.

@item @code{--reboot [name]}
Reboot the target board when @code{runtest} starts.  When running
tests on a separate target board, it is safer to reboot the target to
be certain of its state.  However, when developing test scripts,
rebooting can take a lot of time.

@item @code{--srcdir [path]}
Use @file{path} as the top directory for test scripts to run.
@emph{runtest} looks in this directory for any subdirectory whose name
begins with the toolname (specified with @code{--tool}).  For
instance, with @code{--tool gdb}, @emph{runtest} uses tests in
subdirectories @file{gdb.*} (with the usual shell-like filename
expansion).  If you do not use @code{--srcdir}, @emph{runtest} looks
for test directories under the current working directory.

@item @code{--strace [n]}
Turn on internal tracing for @emph{expect}, to n levels deep.  By
adjusting the level, you can control the extent to which your output
expands multi-level Tcl statements.  This allows you to ignore some
levels of @emph{case} or @emph{if} statements.  Each procedure call or
control structure counts as one ``level''.  The output is recorded in
the same file, @file{dbg.log}, used for output from @code{--debug}.

@item @code{--target [triplet]}
Use this option to override the default setting (native testing).
@emph{triplet} is a system triplet of the form
@emph{cpu-manufacturer-os}.  This option changes the configuration
@code{runtest} uses for the default tool names, and other setup
information.

@item @code{--target_board [name(s)]}
The list of target boards to run tests on.

@item @code{--tool [name(s)]}
Specifies which testsuite to run, and what initialization module to
use.  @code{--tool} is used @emph{only} for these two purposes.  It is
@emph{not} used to name the executable program to test.  Executable
tool names (and paths) are recorded in @file{site.exp} and you can
override them by specifying Tcl variables on the command line.

For example, including @code{--tool} gcc on the command line runs
tests from all test subdirectories whose names match @file{gcc.*}, and
uses one of the initialization modules named @file{config/*-gcc.exp}.
To specify the name of the compiler (perhaps as an alternative path to
what @emph{runtest} would use by default), use @emph{GCC=path-to-gcc}
on the @emph{runtest} command line.

@item @code{--tool_exec [name]}
The path to the tool executable to test.

@item @code{--tool_opts [options]}
A list of additional options to pass to the tool.

@item @code{-v}, @code{--verbose}
Turns on more output.  Repeating this option increases the amount of
output displayed.  Level one (@emph{-v}) is simply test output.  Level
two (@emph{-v -v}) shows messages on options, configuration, and
process control.  Verbose messages appear in the detailed
(@file{*.log}) log file, but not in the summary (@file{*.sum}) log
file.

@item @code{-V}, @code{--version}
Prints out the version numbers of DejaGnu, Expect, and Tcl.

@item @code{-x}, @code{--xml}
Generate XML output.  The output file is named after the tool with an
.xml extension.

@item @file{testfile}.exp[=arg(s)]
Specify the names of testsuites to run.  By default, @emph{runtest}
runs all tests for the tool, but you can restrict it to particular
testsuites by giving the names of the @emph{.exp} scripts that control
them.  @emph{testsuite}.exp cannot include directory names, only plain
filenames.

@code{arg(s)} specifies a subset of test cases to run.  For compiler
or assembler tests, which often use a single @emph{.exp} script
covering many different test case files, this option allows you to
further restrict the tests by listing particular test cases.  For
larger testsuites such as that included in GCC, this can save a lot of
time.  Some tools support wildcards here, but this varies from tool to
tool.  Typically the wildcards @emph{?}, @emph{*}, and @emph{[chars]}
are recognized.

@item @code{tclvar}=value
You can define Tcl variables for use by your test scripts in the same
style used with @emph{make} for environment variables.  For example,
@emph{runtest GDB=gdb.old} defines a variable called @code{GDB}; when
your scripts refer to @code{$GDB} in this run, they use the value
@emph{gdb.old}.

The default Tcl variables used for most tools are defined in the main
DejaGnu @emph{Makefile}; their values are captured in the
@file{site.exp} file.
@end table

@node Common Operations, , Invoking runtest, Runtest
@subsection Common Options
@cindex options, common

Typically, you don't need to use any command line options.  The
@code{--tool} option is only required when there is more than one
testsuite in the same directory.  The default options are in the local
@file{site.exp} file, created by @code{make site.exp}.

For example, if the directory @file{gdb/testsuite} contains a
collection of DejaGnu tests for GDB, you can run them like this:

@example
$ cd gdb/testsuite
$ runtest --tool gdb
@end example

The test output follows, then ends with:

@example
=== gdb Summary ===

# of expected passes 508
# of expected failures 103
/usr/latest/bin/gdb version 4.14.4 -nx
@end example

You can use the option @code{--srcdir} to point to some other
directory containing a collection of tests:

@example
$ runtest --srcdir /devo/gdb/testsuite
@end example

By default, @code{runtest} prints only the names of the tests it runs,
output from any tests that have unexpected results, and a summary
showing how many tests passed and how many failed.  To display output
from all tests (whether or not they behave as expected), use the
@code{-a} (all) option.  For more verbose output about processes being
run, communication, and so on, use @code{-v} (verbose).  To see even
more output, use multiple @code{-v} options.  See @ref{Invoking
runtest} for a more detailed explanation of each @code{runtest}
option.

@node Output Files, , Runtest, Running tests
@section Output files

DejaGnu always writes two kinds of output files.  Summary output is
written to the @file{.sum} file, and detailed output is written to the
@file{.log} file.  The tool name determines the prefix for these
files.  For example, after running with @code{--tool gdb}, the output
files will be called @file{gdb.sum} and @file{gdb.log}.  For
troubleshooting, a debug log file that logs the operation of Expect is
available.  Each of these will be described in turn.

@menu
* Summary log file::
* Detailed log file::
* Debug log file::
@end menu

@node Summary log file, Detailed log file, , Output Files
@subsection Summary log file
@cindex output file, summary log

DejaGnu always produces a summary (@file{.sum}) output file.  This
summary lists the names of all test files run.  For each test file,
one line of output from each @code{pass} command (showing status
@emph{PASS} or @emph{XPASS}) or @code{fail} command (status
@emph{FAIL} or @emph{XFAIL}), trailing summary statistics that count
passing and failing tests (expected and unexpected), the full pathname
of the tool tested, and the version number of the tool.  All possible
outcomes, and all errors, are always reflected in the summary output
file, regardless of whether or not you specify @code{--all}.

If any of your tests use the procedures @code{unresolved},
@code{unsupported}, or @code{untested}, the summary output also
tabulates the corresponding outcomes.

For example, after running @code{runtest --tool binutils} a summary
log file will be written to @file{binutils.sum}.  Normally, DejaGnu
writes this file in your current working directory.  Use the
@code{--outdir} option to select a different output directory.

@strong{Sample summary log}

@example
Test Run By bje on Sat Nov 14 21:04:30 AEDT 2015

@                === gdb tests ===

Running ./gdb.t00/echo.exp ...
PASS:   Echo test
Running ./gdb.all/help.exp ...
PASS:   help add-symbol-file
PASS:   help aliases
PASS:   help breakpoint "bre" abbreviation
FAIL:   help run "r" abbreviation
Running ./gdb.t10/crossload.exp ...
PASS:   m68k-elf (elf-big) explicit format; loaded
XFAIL:  mips-ecoff (ecoff-bigmips) "ptype v_signed_char" signed C types

@                === gdb Summary ===

# of expected passes            5
# of expected failures          1
# of unexpected failures        1
/usr/latest/bin/gdb version 4.6.5 -q

@end example

@node Detailed log file, Debug log file, Summary log file, Output Files
@subsection Detailed log file
@cindex output file, detailed log

DejaGnu also saves a detailed log file (@file{.log}), showing any
output generated by test cases as well as the summary output.  For
example, after running @code{runtest --tool binutils}, a detailed log
file will be written to @file{binutils.log}.  Normally, DejaGnu writes
this file in your current working directory.  Use the @code{--outdir}
option to select a different output directory.

@strong{Sample detailed log for g++ tests}

@example
Test Run By bje on Sat Nov 14 21:07:23 AEDT 2015

@                === g++ tests ===

Running ./g++.other/t01-1.exp ...
PASS:   operate delete

Running ./g++.other/t01-2.exp ...
FAIL:   i960 bug EOF
p0000646.C: In function `int  warn_return_1 ()':
p0000646.C:109: warning: control reaches end of non-void function
p0000646.C: In function `int  warn_return_arg (int)':
p0000646.C:117: warning: control reaches end of non-void function
p0000646.C: In function `int  warn_return_sum (int, int)':
p0000646.C:125: warning: control reaches end of non-void function
p0000646.C: In function `struct foo warn_return_foo ()':
p0000646.C:132: warning: control reaches end of non-void function
Running ./g++.other/t01-4.exp ...
FAIL:   abort
900403_04.C:8: zero width for bit-field `foo'
Running ./g++.other/t01-3.exp ...
FAIL:   segment violation
900519_12.C:9: parse error before `;'
900519_12.C:12: Segmentation violation
/usr/latest/bin/gcc: Internal compiler error: program cc1plus got fatal signal

@                === g++ Summary ===

# of expected passes            1
# of expected failures          3
/usr/latest/bin/g++ version cygnus-2.0.1

@end example

@node Debug log file, , Detailed log file, Output Files
@subsection Debug log file
@cindex output file, debug log

The @code{runtest} option @code{--debug} creates a file showing the
output from Expect in debugging mode.  The @file{dbg.log} file is
created in the current directory.  The log file shows the string sent
to the tool being tested by each @code{send} command and the pattern
it compares with the tool output by each @code{expect} command.

The log messages begin with a message of the form:

@example
expect: does @{tool output@} (spawn_id n)
   match pattern @{expected pattern@}?
@end example

For every unsuccessful match, Expect issues a @emph{no} after this
message.  If other patterns are specified for the same Expect command,
they are reflected also, but without the first part of the message
(@emph{expect... match pattern}).

When Expect finds a match, the log for the successful match ends with
@emph{yes}, followed by a record of the Expect variables set to
describe a successful match.

@strong{Example debug log file for a GDB test}

@example
send: sent @{break gdbme.c:34\n@} to spawn id 6
expect: does @{@} (spawn_id 6) match pattern @{Breakpoint.*at.* file
gdbme.c, line 34.*\(gdb\) $@}? no
@{.*\(gdb\) $@}? no
expect: does @{@} (spawn_id 0) match pattern @{return@} ? no
@{\(y or n\) @}? no
@{buffer_full@}? no
@{virtual@}? no
@{memory@}? no
@{exhausted@}? no
@{Undefined@}? no
@{command@}? no
break gdbme.c:34
Breakpoint 8 at 0x23d8: file gdbme.c, line 34.
(gdb) expect: does @{break gdbme.c:34\r\nBreakpoint 8 at 0x23d8:
file gdbme.c, line 34.\r\n(gdb) @} (spawn_id 6) match pattern
@{Breakpoint.*at.* file gdbme.c, line 34.*\(gdb\) $@}? yes
expect: set expect_out(0,start) @{18@}
expect: set expect_out(0,end) @{71@}
expect: set expect_out(0,string) @{Breakpoint 8 at 0x23d8: file
gdbme.c, line 34.\r\n(gdb) @}
epect: set expect_out(spawn_id) @{6@}
expect: set expect_out(buffer) @{break gdbme.c:34\r\nBreakpoint 8
at 0x23d8: file gdbme.c, line 34.\r\n(gdb) @}
PASS:   70      0       breakpoint line number in file

@end example

This example exhibits three properties of Expect and DejaGnu that
might be surprising at first glance:

@itemize

@item
Empty output for the first attempted match.  The first set of
attempted matches shown ran against the output @emph{@{@}} --- that
is, no output.  Expect begins attempting to match the patterns
supplied immediately; often, the first pass is against incomplete
output (or completely before all output, as in this case).

@item
Interspersed tool output.  The beginning of the log entry for the
second attempted match may be hard to spot: this is because the prompt
@emph{@{(gdb) @}} appears on the same line, just before the
@emph{expect:} that marks the beginning of the log entry.

@item
Fail-safe patterns.  Many of the patterns tested are fail-safe
patterns provided by GDB testing utilities, to reduce possible
indeterminacy.  It is useful to anticipate potential variations caused
by extreme system conditions (GDB might issue the message
@emph{virtual memory exhausted} in rare circumstances), or by changes
in the tested program (@emph{Undefined command} is the likeliest
outcome if the name of a tested command changes).

The pattern @emph{@{return@}} is a particularly interesting fail-safe
to notice; it checks for an unexpected @key{RET} prompt.  This may
happen, for example, if the tested tool can filter output through a
pager.

These fail-safe patterns (like the debugging log itself) are primarily
useful while developing test scripts.  Use the @code{error} procedure
to make the actions for fail-safe patterns produce messages starting
with @emph{ERROR} on standard output, and in the detailed log file.

@end itemize

@node Running other DejaGnu commands, Customizing DejaGnu, Running tests, Top
@chapter Running other DejaGnu commands

DejaGnu now features auxiliary commands not directly related to
running tests, but somehow related to the broader purpose of testing.

These commands are run via the @command{dejagnu} multiplex launcher,
which locates an appropriate script and the required interpreter and
then runs the requested command.

@menu
* Invoking dejagnu::            Command line options for the launcher itself.
* Invoking dejagnu help::       Reading man pages for dejagnu subcommands.
* Invoking dejagnu report card::  Summarizing test results from many tools.
@end menu

@node Invoking dejagnu, Invoking dejagnu help, Running other DejaGnu commands, Running other DejaGnu commands
@section Invoking @command{dejagnu}
@cindex dejagnu, invoking

The @command{dejagnu} launcher is primarily designed to pass most
options on to the scripts that it runs, but does process the
@option{--help} and @option{--version} options entirely internally,
while also recognizing the @option{--verbose} option.

@example
@command{dejagnu} <command> [options...]
@command{dejagnu} --help
@command{dejagnu} --version
@end example

Note that the command names may contain multiple words.  In this case,
the command can be given as separate arguments to @command{dejagnu} or
combined with dashes (@samp{-}); both forms are equivalent.

All words of the command name must appear before any options.  The
search for a command terminates when an option is found.

Note that the first valid command found is used.  A longer command
name can be shadowed by a shorter command name that happens to be a
prefix of the longer name, if the command name is given as multiple
arguments.  The equivalent form with the longer command name combined
using dashes into a single argument will correctly refer to the
otherwise shadowed command.

The @command{dejagnu} launcher can also be run using symbolic links,
provided that the shell places the name under which @command{dejagnu}
was invoked in @code{$0}.  Any dash-separated words after ``dejagnu''
in the name of such a link are taken to be the leading words of a
command name.

The @command{dejagnu} launcher supports alternate implementations
depending upon available interpreters.

Options for the @command{dejagnu} launcher itself cannot be
abbreviated, since the launcher has no way to know which abbreviations
are unique and which would be ambiguous to the invoked command.

@table @asis

@item @code{--help}
Print a help message instead of running a command.

@item @code{-V}, @code{--version}
Print a version banner for the launcher itself including the version
of DejaGnu.  Any command given is ignored.

@item @code{-v}, @code{--verbose}
Emit additional output describing the inner workings of the
@command{dejagnu} launcher.  This option is also passed on to the
invoked command.

@end table

All arguments after the command name are passed to the invoked
command.

@node Invoking dejagnu help, Invoking dejagnu report card, Invoking dejagnu, Running other DejaGnu commands
@section Invoking @command{dejagnu help}
@cindex dejagnu help, invoking

The @command{dejagnu help} tool displays long-form documentation for
DejaGnu auxiliary commands that are invoked using the
@command{dejagnu} launcher.

@example
@command{dejagnu help} [options...] <command>
@end example

Again, command names may contain multiple words.  This command forms
an operand by joining all words in the command name using dashes
(@samp{-}) and prepending @samp{dejagnu-}.  This is then used as the
name of a manual page and passed to the @command{man} command.

If the manual page is in a particular directory relative to the script
implementing this command, a full file name is produced, otherwise,
@command{man} performs its normal search.

The @option{--verbose} option causes additional output describing the
inner workings of the @command{dejagnu help} command to be produced.

The @option{--path}, @option{-w}, and @option{-W} options are passed
to @command{man}.

@node Invoking dejagnu report card,  , Invoking dejagnu help, Running other DejaGnu commands
@section Invoking @command{dejagnu report card}
@cindex dejagnu report card, invoking
@cindex dejagnu report-card, invoking

The @command{dejagnu report card} tool produces a tabular summary of
the results from test runs by reading the summary files that DejaGnu
produces.

@example
@command{dejagnu report card} [<option>|<tool>|<file>]...
@end example

The @option{--verbose} option causes additional output describing the
inner workings of the @command{dejagnu report card} command to be
produced.

Aside from options, the command may include a list of tools or files.
Names ending in @samp{.sum} are used as-is.  Names ending in
@samp{.log} are changed to instead refer to the summary file.  Names
ending with a simple dot (@samp{.}) have @samp{sum} appended, for
convenience when using Readline filename completion in a shell, which
will complete to the dot, since there are both @samp{.sum} and
@samp{.log} files produced for each tool tested.  Lastly, all other
names are taken as tool names and @samp{.sum} is appended to refer to
the summary file produced by DejaGnu.

The relevant summary files are read and an ASCII-art table is
produced.  The table has columns for counts of tests passed, failed,
unsupported, unresolved, and untested.  Tests that are expected to
pass and tests that are expected to fail are counted in separate
columns, but known failures (@samp{KFAIL} and @samp{KPASS}) are
summarized together with expected failures (@samp{XFAIL} and
@samp{XPASS}) in two additional columns: @samp{?PASS} and
@samp{?FAIL}.  Additionally, if a test produced any warnings or
errors, tags @samp{!W!} or @samp{!E!} are added at the end of the row.

@node Customizing DejaGnu, Extending DejaGnu, Running other DejaGnu commands, Top
@chapter Customizing DejaGnu
@cindex customization

The site configuration file, @file{site.exp}, captures
configuration-dependent values and propagates them to the DejaGnu test
environment using Tcl variables.  This ties the DejaGnu test scripts
into the @code{configure} and @code{make} programs.  If this file is
setup correctly, it is possible to execute a testsuite merely by
typing @code{runtest}.

DejaGnu supports two @file{site.exp} files.  The multiple instances of
@file{site.exp} are loaded in a fixed order.  The first file loaded is
the local file @file{site.exp}, and then the optional global
@file{site.exp} file as pointed to by the @code{DEJAGNU} environment
variable.

There is an optional global @file{site.exp}, containing configuration
values that apply to DejaGnu site-wide.  @code{runtest} loads these
values first.  The global @file{site.exp} contains the default values
for all targets and hosts supported by DejaGnu.  This global file is
identified by setting the environment variable @code{DEJAGNU} to the
name of the file.  If @code{DEJAGNU} is set, but the file cannot be
located, an error will be raised and @code{runtest} will abort.

Any directory containing a configured testsuite also has a local
@file{site.exp}, capturing configuration values specific to the tool
being tested.  Since @code{runtest} loads these values last, the
individual test configuration can either rely on and use, or override,
any of the global values from the global @file{site.exp} file.

You can usually generate or update the testsuite's local
@file{site.exp} by typing @code{make site.exp} in the testsuite
directory, after the test suite is configured.

You can also have a file in your home directory called
@file{.dejagnurc}.  This gets loaded after the other config files.
Usually this is used for personal stuff, like setting the
@code{all_flag} so all the output gets printed, or your own verbosity
levels.  This file is usually restricted to setting command line
options.

You can further override the default values in a user-editable section
of any @file{site.exp}, or by setting variables on the @code{runtest}
command line.

@menu
* Local configuration file::
* Global configuration file::
* Board configuration file::
* Remote host testing::
* Configuration file values::
@end menu

@node Global configuration file, Local configuration file, , Customizing DejaGnu
@section Global configuration file
@cindex configuration file, global

The global configuration file is where all the target specific
configuration variables for a site are set.  For example, a
centralized testing lab where multiple developers have to share an
embedded development board.  There are settings for both remote hosts
and remote targets.  Below is an example of a global configuration
file for a Canadian cross environment.  A Canadian cross is a
toolchain that is built on, runs on, and targets three different
system triplets (for example, building a Solaris-hosted MIPS R4000
toolchain on a GNU/Linux system).  This example is based on a
configuration once used at Cygnus.

@strong{Example global configuration file}

@example
# Make sure we look in the right place for the board description files.
lappend boards_dir "/nfs/cygint/s1/cygnus/dejagnu/boards"

verbose "Global config file: target_triplet is $target_triplet" 2
global target_list

switch -glob -- $target_triplet @{
@    "native" @{
@        set target_list "unix"
@    @}
@    "sparc64-*elf" @{
@        set target_list "sparc64-sim"
@    @}
@    "mips-*elf" @{
@        set target_list "mips-sim wilma barney"
@    @}
@    "mips-lsi-elf" @{
@        set target_list "mips-lsi-sim@{,soft-float,el@}"
@    @}
@}
@end example

In this case, we have support for several cross compilers, that all
run on this host.  To run DejaGnu tests on tools hosted on operating
systems that do not run Expect, DejaGnu can be run on the build
machine and connect to the remote host to run all the tests.  As you
can see, all one does is set the variable @code{target_list} to the
list of targets and options to test.

In this example, simple cases like @emph{sparc64-elf} only require
setting the name of the single board configuration file.  The
@emph{mips-elf} target is more complicated and sets the list to three
target boards.  @emph{mips-sim} is a symbolic name for a simulator
``board'' and @emph{wilma} and @emph{barney} are symbolic names for
physical boards.  Symbolic names are covered in the @ref{Adding a new
board} section.  The more complicated example is the entry for
@emph{mips-lsi-elf}.  This one runs the tests with multiple iterations
using all possible combinations of the @code{--soft-float} and the
@code{--el} (little endian) options.  The braced string includes an
initial comma so that the set of combinations includes no options at
all.  Needless to say, this last target example is mostly specific to
compiler testing.

@node Local configuration file, Board configuration file, Global configuration file, Customizing DejaGnu
@section Local configuration file
@cindex configuration file, local

It is usually more convenient to keep these @emph{manual overrides} in
the @file{site.exp} local to each test directory, rather than in the
global @file{site.exp} in the installed DejaGnu library.  This file is
mostly for supplying tool specific info that is required by the
testsuite.

All local @file{site.exp} files have two sections, separated by
comments.  The first section is generated by @code{make}.  It is
essentially a collection of Tcl variable definitions based on
@file{Makefile} environment variables.  Since they are generated by
@code{make}, they contain the values as specified by @code{configure}.
In particular, this section contains the @file{Makefile} variables for
host and target configuration data.  Do not edit this first section;
if you do, your changes will be overwritten the next time you run
@code{make}.  The first section starts with:

@example
## these variables are automatically generated by make ##
# Do not edit here. If you wish to override these values
# add them to the last section
@end example

In the second section, you can override any default values for all the
variables.  The second section can also contain your preferred
defaults for all the command line options to @code{runtest}.  This
allows you to easily customize @code{runtest} for your preferences in
each configured testsuite tree, so that you need not type options
repeatedly on the command line.  The second section may also be empty
if you do not wish to override any defaults.

@strong{The first section ends with this line}

@example
## All variables above are generated by configure. Do Not Edit ##
@end example

You can make any changes under this line.  If you wish to redefine a
variable in the top section, then just put a duplicate value in this
second section.  Usually the values defined in this configuration file
are related to the configuration of the test run.  This is the ideal
place to set the variables @code{host_triplet}, @code{build_triplet},
@code{target_triplet}.  All other variables are tool dependent, i.e.,
for testing a compiler, the value for @code{CC} might be set to a
freshly built binary, as opposed to one in the user's path.

Here's an example local site.exp file, as used for GCC/G++ testing.

@strong{Local Configuration File}

@example
## these variables are automatically generated by make ##
# Do not edit here. If you wish to override these values
# add them to the last section
set rootme "/build/devo-builds/i686-pc-linux-gnu/gcc"
set host_triplet i686-pc-linux-gnu
set build_triplet i686-pc-linux-gnu
set target_triplet i686-pc-linux-gnu
set target_alias i686-pc-linux-gnu
set CFLAGS ""
set CXXFLAGS "-isystem /build/devo-builds/i686-pc-linux-gnu/gcc/../libio -isystem $srcdir/../libg++/src -isystem $srcdir/../libio -isystem $srcdir/../libstdc++ -isystem $srcdir/../libstdc++/stl -L/build/devo-builds/i686-pc-linux-gnu/gcc/../libg++ -L/build/devo-builds/i686-pc-linux-gnu/gcc/../libstdc++"
append LDFLAGS " -L/build/devo-builds/i686-pc-linux-gnu/gcc/../ld"
set tmpdir /build/devo-builds/i686-pc-linux-gnu/gcc/testsuite
set srcdir "$@{srcdir@}/testsuite"
## All variables above are generated by configure. Do Not Edit ##
@end example

This file defines the required fields for a local configuration file,
namely the three system triplets, and the srcdir.  It also defines
several other Tcl variables that are used exclusively by the GCC
testsuite.  For most test cases, the CXXFLAGS and LDFLAGS are supplied
by DejaGnu itself for cross testing, but to test a compiler, GCC needs
to manipulate these itself.

@vindex test_timeout
The local @file{site.exp} may also set Tcl variables such as
@code{test_timeout} which can control the amount of time (in seconds)
to wait for a remote test to complete.  If not specified,
@code{test_timeout} defaults to 300 seconds.

@node Board configuration file, Remote host testing, Local configuration file, Customizing DejaGnu
@section Board configuration file
@cindex configuration file, board

The board configuration file is where board-specific configuration
details are stored.  A board configuration file contains all the
higher-level configuration settings.  There is a rough inheritance
scheme, where it is possible to derive a new board description file
from an existing one.  There are also collections of custom procedures
for common environments.  For more information on adding a new board
config file, see @ref{Adding a new board}.

An example board configuration file for a GNU simulator is as follows.
@code{set_board_info} is a procedure that sets the field name to the
specified value.  The procedures mentioned in brackets are
@emph{helper procedures}.  These are used to find parts of a toolchain
required to build an executable image that may reside in various
locations.  This is mostly of use when the startup code, the standard
C libraries, or the toolchain itself is part of your build tree.

@strong{Example file}
@example
# This is a list of toolchains that are supported on this board.
set_board_info target_install @{sparc64-elf@}

# Load the generic configuration for this board. This will define any
# routines needed by the tool to communicate with the board.
load_generic_config "sim"

# We need this for find_gcc and *_include_flags/*_link_flags.
load_base_board_description "basic-sim"

# Use long64 by default.
process_multilib_options "long64"

setup_sim sparc64

# We only support newlib on this target. We assume that all multilib
# options have been specified before we get here.

set_board_info compiler "[find_gcc]"
set_board_info cflags "[libgloss_include_flags] [newlib_include_flags]"
set_board_info ldflags "[libgloss_link_flags] [newlib_link_flags]"
# No linker script.
set_board_info ldscript ""

# Used by a few gcc.c-torture testcases to delimit how large the
# stack can be.
set_board_info gcc,stack_size 16384
# The simulator doesn't return exit status and we need to indicate this
# the standard GCC wrapper will work with this target.
set_board_info needs_status_wrapper 1
# We can't pass arguments to programs.
set_board_info noargs 1
@end example

There are five helper procedures used in this example:

@itemize
@item
@code{find_gcc} looks for a copy of the GNU compiler in your build
tree, or it uses the one in your path.  This will also return the
proper transformed name for a cross compiler if you whole build tree
is configured for one.  DejaGnu will use this procedure to locate a
compiler if the @code{compiler} field is not set.

@item
@code{libgloss_include_flags} returns the flags to compile using
@ref{Libgloss, libgloss}, the GNU board support package (BSP).

@item
@code{libgloss_link_flags} returns the flags to link an executable
using @ref{Libgloss, libgloss}.

@item
@code{newlib_include_flags} returns the flags to compile using
@uref{https://sourceware.org/newlib, newlib}, a re-entrant standard C
library for embedded systems comprising of non-GPL'd code

@item
@code{newlib_link_flags} returns the flags to link an executable with
@uref{https://sourceware.org/newlib, newlib}.

@end itemize

@node Remote host testing, Configuration file values, Board configuration file, Customizing DejaGnu
@section Remote host testing
@cindex testing on remote hosts

DejaGnu also supports running the tests on a remote host.  To set this
up, the remote host needs an FTP server, and a telnet server.
Currently foreign operating systems used as remote hosts are VxWorks,
VRTX, DOS/Windows 3.1, MacOS and Windows.

The recommended source for a Windows-based FTP server is to get IIS
(either IIS 1 or Personal Web Server) from
@uref{http://www.microsoft.com,http://www.microsoft.com}.  When you
install it, make sure you install the FTP server - it's not selected
by default.  Go into the IIS manager and change the FTP server so that
it does not allow anonymous FTP.  Set the home directory to the root
directory (i.e. c:\) of a suitable drive.  Allow writing via FTP.

It will create an account like IUSR_FOOBAR where foobar is the name of
your machine.  Go into the user editor and give that account a
password that you don't mind hanging around in the clear (i.e. not the
same as your admin or personal passwords).  Also, add it to all the
various permission groups.

You'll also need a telnet server.  For Windows, go to the
@uref{http://ataman.com,Ataman} web site, pick up the Ataman Remote
Logon Services for Windows, and install it.  You can get started on
the eval period anyway.  Add IUSR_FOOBAR to the list of allowed users,
set the HOME directory to be the same as the FTP default directory.
Change the Mode prompt to simple.

Now you need to pick a directory name to do all the testing in.  For
the sake of this example, we'll call it piggy (i.e. c:\piggy).  Create
this directory.

You'll need a Unix machine.  Create a directory for the scripts you'll
need.  For this example, we'll use /usr/local/swamp/testing.  You'll
need to have a source tree somewhere, say /usr/src/devo.  Now, copy
some files from releng's area in SV to your machine:

@strong{Remote host setup}

@example
cd /usr/local/swamp/testing
mkdir boards
scp darkstar.welcomehome.org:/dejagnu/cst/bin/MkTestDir .
scp darkstar.welcomehome.org:/dejagnu/site.exp .
scp darkstar.welcomehome.org:/dejagnu/boards/useless98r2.exp boards/foobar.exp
export DEJAGNU=/usr/local/swamp/testing/site.exp
@end example

You must edit the boards/foobar.exp file to reflect your machine;
change the hostname (foobar.com), username (iusr_foobar), password,
and ftp_directory (c:/piggy) to match what you selected.

Edit the global @file{ site.exp} to reflect your boards directory:

@strong{Add The Board Directory}

@example
lappend boards_dir "/usr/local/swamp/testing/boards"
@end example

Now run MkTestDir, which is in the contrib directory.  The first
parameter is the toolchain prefix, the second is the location of your
devo tree.  If you are testing a cross compiler (ex: you have
sh-hms-gcc.exe in your PATH on the PC), do something like this:

@strong{Setup Cross Remote Testing}

@example
./MkTestDir sh-hms /usr/dejagnu/src/devo
@end example

If you are testing a native PC compiler (ex: you have gcc.exe in your
PATH on the PC), do this:

@strong{Setup Native Remote Testing}

@example
./MkTestDir '' /usr/dejagnu/src/devo
@end example

To test the setup, @code{ftp} to your PC using the username
(iusr_foobar) and password you selected.  CD to the test directory.
Upload a file to the PC.  Now telnet to your PC using the same
username and password.  CD to the test directory.  Make sure the file
is there.  Type "set" and/or "gcc -v" (or sh-hms-gcc -v) and make sure
the default PATH contains the installation you want to test.

@strong{Run Test Remotely}

@example
cd /usr/local/swamp/testing
make  -k -w check RUNTESTFLAGS="--host_board foobar --target_board foobar -v -v" > check.out 2>&1
@end example

To run a specific test, use a command like this (for this example,
you'd run this from the gcc directory that MkTestDir created):

@strong{Run a Test Remotely}

@example
make check RUNTESTFLAGS="--host_board sloth --target_board sloth -v compile.exp=921202-1.c"
@end example

Note: if you are testing a cross-compiler, put in the correct target
board.  You'll also have to download more .exp files and modify them
for your local configuration.  The -v's are optional.

@node Configuration file values, , Remote host testing, Customizing DejaGnu
@section Configuration file values
@cindex configuration values

@vindex target_info
DejaGnu uses a Tcl associative array to hold all the info for each
machine.  In the case of a Canadian cross, this means host information
as well as target information.  The named array is called
@code{target_info}, and it has two indices.  The following fields are
part of the array.

@menu
* Command line option variables::
* User configuration file::
@end menu

@node Command line option variables, User configuration file, , Configuration file values
@subsection Command line option variables

In the user editable second section of the @ref{User configuration
file} you can not only override the configuration variables captured
in the first section, but also specify default values for all of the
@code{runtest} command line options.  Excepting @code{--debug},
@code{--help}, and @code{--version}, each command line option has an
associated Tcl variable.  Use the Tcl @code{set} command to specify a
new default value (as for the configuration variables).  The following
table describes the correspondence between command line options and
variables you can set in @file{site.exp}.  Refer to @ref{Invoking
runtest}, for explanations of the command-line options.

@multitable {--target_board} {TOOL_EXECUTABLE} {verbosity level greater than or equal to 0}
@headitem
Option@tab Tcl variable@tab Description

@item
-a, --all@tab all_flag@tab display all test results if set

@item
--build@tab build_triplet@tab system triplet for the build host

@item
--dir@tab cmdline_dir_to_run@tab run only tests in the specified directory

@item
--global_init@tab global_init_file@tab file name for global init file in @code{libdir}

@item
--host@tab host_triplet@tab system triplet for the host

@item
--host_board@tab host_board@tab host board definition to use

@item
--ignore@tab ignoretests @tab do not run the specified tests

@item
--local_init@tab local_init_file@tab file name for local init file in @code{objdir}

@item
--log_dialog@tab log_dialog@tab emit Expect output to standard output

@item
--outdir@tab outdir@tab directory for @file{.sum} and @file{.log} files

@item
--objdir@tab objdir@tab directory for pre-compiled binaries

@item
--reboot@tab reboot@tab reboot the target if set to 1

@item
--srcdir@tab srcdir@tab directory of test subdirectories

@item
--target@tab target_triplet@tab system triplet for the target

@item
--target_board@tab target_list@tab list of target boards to run tests on

@item
--tool@tab tool@tab name of tool to test (selects tests to run)

@item
--tool_exec@tab TOOL_EXECUTABLE@tab path to the executable to test

@item
--tool_opts@tab TOOL_OPTIONS@tab additional options to pass to the tool

@item
--tool_root_dir@tab tool_root_dir@tab tool root directory

@item
-v, --verbose@tab verbose@tab verbosity level greater than or equal to 0

@end multitable

@node User configuration file, , Command line option variables, Configuration file values
@subsection Per-user configuration file (.dejagnurc)

The per-user configuration file is named @file{.dejagnurc} in the
user's home directory.  It is used to customize the behaviour of
@code{runtest} for each user -- typically the user's preference for
log verbosity, and for storing any experimental Tcl procedures.  An
example @file{~/.dejagnurc} file looks like:

@strong{Example .dejagnurc}

@example
set all_flag 1
set RLOGIN /usr/ucb/rlogin
set RSH /usr/local/sbin/ssh
@end example

Here @code{all_flag} is set so that I see all the test cases that PASS
along with the ones that FAIL.  I also set @code{RLOGIN} to the BSD
(non-Kerberos) version.  I also set @code{RSH} to the SSH secure
shell, as rsh is mostly used to test Unix machines within a local
network.

@node Extending DejaGnu, Unit testing, Customizing DejaGnu, Top
@chapter Extending DejaGnu
@cindex extensions
@cindex extending DejaGnu

This chapter describes how to extend DejaGnu with new testsuites, new
tools, new targets and new boards.

@menu
* Adding a new testsuite::
* Adding a new tool::
* Adding a new target::
* Adding a new board::
* Board file values::
* Writing a test case::
* Debugging a test case::
* Adding a test case to a testsuite::
* Test case special variables: Test case variables.
@end menu

@node Adding a new testsuite, Adding a new tool, , Extending DejaGnu
@section Adding a new testsuite
@cindex adding, testsuite

The testsuite for a new package should always be located in the source
directory of that package.  DejaGnu requires this directory to be
named @file{testsuite}.  Under this directory, the test cases go in
various subdirectories whose name begins with the tool name.  The
organization of the various testsuite subdirectories is up to you.
For a tool named @code{gdb}, for instance, each subdirectory
containing tests must start with @samp{gdb.}.

@node Adding a new tool, Adding a new target, Adding a new testsuite, Extending DejaGnu
@section Adding a new tool

In general, the best way to learn how to write code, or even prose, is
to read something similar.  This principle applies to test cases and
to testsuites.  Unfortunately, well-established testsuites have a way
of developing their own conventions: as test writers become more
experienced with DejaGnu and with Tcl, they accumulate more utilities,
and take advantage of more and more features of Expect and Tcl in
general.  Inspecting such established testsuites may make the prospect
of creating an entirely new testsuite appear overwhelming.
Nevertheless, it is straightforward to start a new testsuite.

To help orient you further in this task, here is an outline of the
steps to begin building a testsuite for a program example.

Create or select a directory to contain your new collection of tests.
Change into that directory (shown here as @file{testsuite}):

Create a @file{configure.in} file in this directory, to control
configuration-dependent choices for your tests.  So far as DejaGnu is
concerned, the important thing is to set a value for the variable
@code{target_abbrev}; this value is the link to the init file you will
write soon.  (For simplicity, we assume the environment is Unix, and
use @emph{unix} as the value.)

What else is needed in @file{configure.in} depends on the requirements
of your tool, your intended test environments, and which configure
system you use.  This example is a minimal @file{configure.ac} for use
with GNU Autoconf.

@subsection Sample Makefile.in Fragment

Create @file{Makefile.in} (if using Autoconf), or @file{Makefile.am}
(if using Automake), the source file used by configure to build your
@file{Makefile}.  If you are using GNU Automake.just add the keyword
@emph{dejagnu} to the @emph{AUTOMAKE_OPTIONS} variable in your
@file{Makefile.am} file.  This will add all the @file{Makefile}
support needed to run DejaGnu, and support the @ref{Make Check, make
check} target.

You also need to include two targets important to DejaGnu:
@emph{check}, to run the tests, and @emph{site.exp}, to set up the Tcl
copies of configuration-dependent values.  This is called the
@ref{Local configuration file} The @emph{check} target must invoke the
@code{runtest} program to run the tests.

The @emph{site.exp} target should usually set up (among other things)
the @emph{$tool} variable for the name of your program.  If the local
@file{site.exp} file is setup correctly, it is possible to execute the
tests by merely typing @code{runtest} on the command line.

@example
# Look for a local version of DejaGnu, otherwise use one in the path
RUNTEST = `if test -f $(top_srcdir)/../dejagnu/runtest; then \
      echo $(top_srcdir) ../dejagnu/runtest; \
    else \
      echo runtest; \
    fi`

# Flags to pass to runtest
RUNTESTFLAGS =

# Execute the tests
check: site.exp all
@        $(RUNTEST) $(RUNTESTFLAGS) --tool $@{example@} --srcdir $(srcdir)

# Make the local config file
site.exp: ./config.status Makefile
@        @@echo "Making a new config file..."
@        -@@rm -f ./tmp?
@        @@touch site.exp

@        -@@mv site.exp site.bak
@        @@echo "## these variables are automatically generated by make ##" > ./tmp0
@        @@echo "# Do not edit here. If you wish to override these values" >> ./tmp0
@        @@echo "# add them to the last section" >> ./tmp0
@        @@echo "set host_os $@{host_os@}" >> ./tmp0
@        @@echo "set host_alias $@{host_alias@}" >> ./tmp0
@        @@echo "set host_cpu $@{host_cpu@}" >> ./tmp0
@        @@echo "set host_vendor $@{host_vendor@}" >> ./tmp0
@        @@echo "set target_os $@{target_os@}" >> ./tmp0
@        @@echo "set target_alias $@{target_alias@}" >> ./tmp0
@        @@echo "set target_cpu $@{target_cpu@}" >> ./tmp0
@        @@echo "set target_vendor $@{target_vendor@}" >> ./tmp0
@        @@echo "set host_triplet $@{host_canonical@}" >> ./tmp0
@        @@echo "set target_triplet $@{target_canonical@}">>./tmp0
@        @@echo "set tool binutils" >> ./tmp0
@        @@echo "set srcdir $@{srcdir@}" >> ./tmp0
@        @@echo "set objdir `pwd`" >> ./tmp0
@        @@echo "set $@{examplename@} $@{example@}" >> ./tmp0
@        @@echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
@        @@cat ./tmp0 > site.exp
@        @@sed < site.bak \
@            -e '1,/^## All variables above are.*##/ d' \
@            >> site.exp
@        -@@rm -f ./tmp?
@end example

@subsection Simple tool init file for batch programs

Create a directory (under @file{testsuite}) called @file{config}.
Make a tool init file in this directory.  Its name must start with the
@code{target_abbrev} value, or be named @file{default.exp} so call it
@file{config/unix.exp} for our Unix based example.  This is the file
that contains the target-dependent procedures.  Fortunately, on a
native Unix system, most of them do not have to do very much in order
for @code{runtest} to run.  If the program being tested is not
interactive, you can get away with this minimal @file{unix.exp} to
begin with:

@example
proc myprog_exit @{@} @{@}
proc myprog_version @{@} @{@}
@end example

If the program being tested is interactive, however, you might as well
define a @emph{start} routine and invoke it by using a tool init file
like this:

@subsection Simple tool init file for interactive programs

@example
proc myprog_exit @{@} @{@}
proc myprog_version @{@} @{@}

proc myprog_start @{@} @{
@     global $@{examplename@}
@     spawn $@{examplename@}
@     expect @{
@        -re "" @{@}
@     @}
@}

# Start the program running we want to test
myprog_start
@end example

Create a directory whose name begins with your tool's name, to contain
tests.  For example, if the tool name is @emph{example}, then the
directories all need to start with @samp{example.}.  Create a sample
test file ending in @file{.exp}.  You can name the file
@file{first-try.exp}.  To begin with, just write one line of Tcl code
to issue a message:

@example
send_user "Testing: one, two...\n"
@end example

@subsection Testing A New Tool Config

Back in the @file{testsuite} (top level) directory, run
@code{configure}.  Typically you do this while in the build directory.
You are now ready to type @code{make check} or @code{runtest}.  You
should see something like this:

@example
Test Run By bje on Sat Nov 14 15:08:54 AEDT 2015

@                === example tests ===

Running ./example.0/first-try.exp ...
Testing: one, two...

@                === example Summary ===
@end example

There is no output in the summary, because so far the example does not
call any of the procedures that report a test outcome.

Write some real tests.  For an interactive tool, you should probably
write a real exit routine in fairly short order.  In any case, you
should also write a real version routine soon.

@node Adding a new target, Adding a new board, Adding a new tool, Extending DejaGnu
@section Adding a new target
@cindex adding, target

DejaGnu has some additional requirements for target support, beyond
the general-purpose provisions of a @code{configure} script.  DejaGnu
must actively communicate with the target, rather than simply
generating or managing code for the target architecture.  Therefore,
each tool requires an initialization module for each target.  For new
targets, you must supply a few Tcl procedures to adapt DejaGnu to the
target.

Usually the best way to write a new initialization module is to edit
an existing initialization module; some trial and error will be
required.  If necessary, you can use the @code{--debug} option to see
what is really going on.

When you code an initialization module, be generous in printing
information using the @code{verbose} procedure.  In cross-development
environments, most of the work is in getting the communications right.
Code for communicating via TCP/IP networks or serial lines is
available in a DejaGnu library files such as @file{lib/telnet.exp}.

If you suspect a communication problem, try running the connection
interactively from Expect.  (There are three ways of running Expect as
an interactive interpreter.  You can run Expect with no arguments, and
control it completely interactively; or you can use @code{expect -i}
together with other command-line options and arguments; or you can run
the command @code{interpreter} from any Expect procedure.  Use
@code{return} to get back to the calling procedure (if any), or
@code{return -tcl} to make the calling procedure itself return to its
caller; use @code{exit} or end-of-file to leave Expect altogether.)
Run the program whose name is recorded in @code{$connectmode}, with
the arguments in @code{$targetname}, to establish a connection.  You
should at least be able to get a prompt from any target that is
physically connected.

@node Adding a new board, Board file values, Adding a new target, Extending DejaGnu
@section Adding a new board
@cindex adding, board

Adding a new board consists of creating a new board configuration
file.  Examples are in @file{dejagnu/baseboards}.  Usually to make a
new board file, it's easiest to copy an existing one.  It is also
possible to have your file be based on a @emph{baseboard} file with
only one or two changes needed.  Typically, this can be as simple as
just changing the linker script.  Once the new baseboard file is done,
add it to the @code{boards_DATA} list in the
@file{dejagnu/baseboards/Makefile.am}, and regenerate the Makefile.in
using automake.  Then just rebuild and install DejaGnu.  You can test
it by:

There is a crude inheritance scheme going on with board files, so you
can include one board file into another, The two main procedures used
to do this are @code{load_generic_config} and
@code{load_base_board_description}.  The generic configuration file
contains other procedures used for a certain class of target.  The
board description file is where the board specific settings go.
Commonly there are similar target environments with just different
processors.

@strong{Testing a New Board Configuration File}

@example
make check RUNTESTFLAGS="--target_board=newboardfile".
@end example

Here's an example of a board configuration file.  There are several
@emph{helper procedures} used in this example.  A helper procedure is
one that look for a tool of files in commonly installed locations.
These are mostly used when testing in the build tree, because the
executables to be tested are in the same tree as the new DejaGnu
files.  The helper procedures are the ones in brackets, which
indicates a Tcl procedure call.

@strong{Example Board Configuration File}

@example
# Load the generic configuration for this board. This will define a basic
# set of routines needed by the tool to communicate with the board.
load_generic_config "sim"

# basic-sim.exp is a basic description for the standard Cygnus simulator.
load_base_board_description "basic-sim"

# The compiler used to build for this board. This has *nothing* to do
# with what compiler is tested if we're testing gcc. Further, this is
# the default, so this line is optional for most boards.
set_board_info compiler "[find_gcc]"

# We only support newlib on this target.
# However, we include libgloss so we can find the linker scripts.
set_board_info cflags "[newlib_include_flags] [libgloss_include_flags]"
set_board_info ldflags "[newlib_link_flags]"

# No linker script for this board.
set_board_info ldscript "-Tsim.ld"

# The simulator doesn't return exit statuses and we need to indicate this.
set_board_info needs_status_wrapper 1

# Can't pass arguments to this target.
set_board_info noargs 1

# No signals.
set_board_info gdb,nosignals 1

# And it can't call functions.
set_board_info gdb,cannot_call_functions 1
@end example

@node Board file values, Writing a test case, Adding a new board, Extending DejaGnu
@section Board configuration file values

The following fields are in the @code{board_info} array.  These are
set by the @code{set_board_info} procedure (or @code{add_board_info}
procedure for appending to lists).  Both procedures take a field name
and a value for the field (or is added to the field), respectively.
Some common board info fields are shown below.

@multitable @columnfractions 0.2 0.2 0.6
@item
@strong{Field} @tab @strong{Example value} @tab @strong{Description}
@item
compiler@tab @code{[find_gcc]}@tab The path to the compiler to use.
@item
cflags@tab @code{-mca}@tab Compilation flags for the compiler.
@item
ldflags@tab @code{[libgloss_link_flags] [newlib_link_flags]}@tab Linking flags for the compiler.
@item
ldscript@tab @code{-Wl,-Tidt.ld}@tab The linker script to use when cross compiling.
@item
libs@tab @code{-lgcc}@tab Any additional libraries to link in.
@item
shell_prompt@tab @code{cygmon>}@tab The command prompt of the remote shell.
@item
hex_startaddr@tab @code{0xa0020000}@tab The Starting address as a string.
@item
start_addr@tab 0xa0008000@tab The starting address as a value.
@item
startaddr@tab @code{a0020000}@tab
@item
exit_statuses_bad@tab 1@tab Whether there is an accurate exit status.
@item
reboot_delay@tab 10@tab The delay between power off and power on.
@item
unreliable@tab 1@tab Whether communication with the board is unreliable.
@item
sim@tab [find_sim]@tab The path to the simulator to use.
@item
objcopy@tab $tempfil@tab The path to the @code{objcopy} program.
@item
support_libs@tab @code{$@{prefix_dir@}/i386-coff/}@tab Support libraries needed for cross compiling.
@item
addl_link_flags@tab @code{-N}@tab Additional link flags, rarely used.
@item
remotedir@tab @code{/tmp/runtest.[pid]}@tab Directory on the remote target in which executables are downloaded and executed.
@end multitable

These fields are used by the GCC and GDB tests, and are mostly only
useful to somewhat trying to debug a new board file for one of these
tools.  Many of these are used only by a few testcases, and their
purpose is esoteric.  These are listed with sample values as a guide
to better guessing if you need to change any of these.

@strong{Board Info Fields For GCC & GDB}

@multitable @columnfractions 0.333333333333333 0.333333333333333 0.333333333333333
@item
Field@tab Sample Value@tab Description
@item
strip@tab $tempfile@tab Strip the executable of symbols.
@item
gdb_load_offset@tab "0x40050000"@tab
@item
gdb_protocol@tab "remote"@tab The GDB debugging protocol to use.
@item
gdb_sect_offset@tab "0x41000000";@tab
@item
gdb_stub_ldscript@tab "-Wl,-Teva-stub.ld"@tab The linker script to use with a GDB stub.
@item
gdb,noargs@tab 1@tab Whether the target can take command line arguments.
@item
gdb,nosignals@tab 1@tab Whether there are signals on the target.
@item
gdb,short_int@tab 1@tab
@item
gdb,target_sim_options@tab "-sparclite"@tab Special options to pass to the simulator.
@item
gdb,timeout@tab 540@tab Timeout value to use for remote communication.
@item
gdb_init_command@tab "set mipsfpu none"@tab A single command to send to GDB before the program being
debugged is started.
@item
gdb_init_commands@tab "print/x \$fsr = 0x0"@tab Same as @emph{gdb_init_command}, except
that this is a list, more commands can be added.
@item
gdb_load_offset@tab "0x12020000"@tab
@item
gdb_opts@tab "--command gdbinit"@tab
@item
gdb_prompt@tab "\\(gdb960\\)"@tab The prompt GDB is using.
@item
gdb_run_command@tab "jump start"@tab
@item
gdb_stub_offset@tab "0x12010000"@tab
@item
use_gdb_stub@tab 1@tab Whether to use a GDB stub.
@item
wrap_m68k_aout@tab 1@tab
@item
gcc,no_label_values@tab 1@tab
@item
gcc,no_trampolines@tab 1@tab
@item
gcc,no_varargs@tab 1@tab
@item
gcc,stack_size@tab 16384@tab Stack size to use with some GCC testcases.
@item
ieee_multilib_flags@tab "-mieee"@tab
@item
is_simulator@tab 1@tab
@item
needs_status_wrapper@tab 1@tab
@item
no_double@tab 1@tab
@item
no_long_long@tab 1@tab
@item
noargs@tab 1@tab
@item
target_install@tab @{sh-hms@}@tab
@end multitable

@node Writing a test case, Debugging a test case, Board file values, Extending DejaGnu
@section Writing a test case
@cindex Writing a test case

The easiest way to prepare a new test case is to base it on an
existing one for a similar situation.  There are two major categories
of tests: batch-oriented and interactive.  Batch-oriented tests are
usually easier to write.

The GCC tests are a good example of batch-oriented tests.  All GCC
tests consist primarily of a call to a single common procedure, since
all the tests either have no output, or only have a few warning
messages when successfully compiled.  Any non-warning output
constitutes a test failure.  All the C code needed is kept in the test
directory.  The test driver, written in Tcl, need only get a listing
of all the C files in the directory, and compile them all using a
generic procedure.  This procedure and a few others supporting for
these tests are kept in the library module @file{lib/c-torture.exp} of
the GCC testsuite.  Most tests of this kind use very few Expect
features, and are coded almost purely in Tcl.

Writing the complete suite of C tests, then, consisted of these steps:

@itemize
@item
Copying all the C code into the test directory.  These tests were
based on the C-torture test created by Torbjorn Granlund (on behalf of
the Free Software Foundation) for GCC development.

@item
Writing (and debugging) the generic Tcl procedures for compilation.

@item
Writing the simple test driver: its main task is to search the
directory (using the Tcl procedure @emph{glob} for filename expansion
with wildcards) and call a Tcl procedure with each filename.  It also
checks for a few errors from the testing procedure.
@end itemize

Testing interactive programs is intrinsically more complex.  Tests for
most interactive programs require some trial and error before they are
complete.

However, some interactive programs can be tested in a simple fashion
reminiscent of batch tests.  For example, prior to the creation of
DejaGnu, the GDB distribution already included a wide-ranging testing
procedure.  This procedure was very robust, and had already undergone
much more debugging and error checking than many recent DejaGnu test
cases.  Accordingly, the best approach was simply to encapsulate the
existing GDB tests, for reporting purposes.  Thereafter, new GDB tests
built up a family of Tcl procedures specialized for GDB testing.

@subsection Hints on writing a test case
@cindex hints on writing a test case
@cindex test cases, writing

It is safest to write patterns that match all the output generated by
the tested program; this is called closure.  If a pattern does not
match the entire output, any output that remains will be examined by
the next @code{expect} command.  In this situation, the precise
boundary that determines which @code{expect} command sees what is very
sensitive to timing between the Expect task and the task running the
tested tool.  As a result, the test may sometimes appear to work, but
is likely to have unpredictable results.  (This problem is
particularly likely for interactive tools, but can also affect batch
tools---especially for tests that take a long time to finish.) The
best way to ensure closure is to use the @code{-re} option for the
@code{expect} command to write the pattern as a full regular
expressions; then you can match the end of output using a @emph{$}.
It is also a good idea to write patterns that match all available
output by using @emph{.*\} after the text of interest; this will also
match any intervening blank lines.  Sometimes an alternative is to
match end of line using @emph{\r} or @emph{\n}, but this is usually
too dependent on terminal settings.

Always escape punctuation, such as @emph{(} or @emph{"}, in your
patterns; for example, write @emph{\(}.  If you forget to escape
punctuation, you will usually see an error message like:

@example
extra characters after close-quote
@end example

If you have trouble understanding why a pattern does not match the
program output, try using the @code{--debug} option to @code{runtest},
and examine the debug log carefully.

Be careful not to neglect output generated by setup rather than by the
interesting parts of a test case.  For example, while testing GDB, I
issue a send @emph{set height 0\n} command.  The purpose is simply to
make sure GDB never calls a paging program.  The @emph{set height}
command in GDB does not generate any output; but running any command
makes GDB issue a new @emph{(gdb) } prompt.  If there were no
@code{expect} command to match this prompt, the output @emph{(gdb) }
begins the text seen by the next @code{expect} command---which might
make that pattern fail to match.

To preserve basic sanity, I also recommended that no test ever pass if
there was any kind of problem in the test case.  To take an extreme
case, tests that pass even when the tool will not spawn are
misleading.  Ideally, a test in this sort of situation should not fail
either.  Instead, print an error message by calling one of the DejaGnu
procedures @code{error} or @code{warning}.

@subsubheading Priority of Expect patterns

Be particularly careful about how you write the patterns.  Expect
attempts to match each pattern in the order that they are written in
the @code{expect} command.  Unless a regexp pattern is anchored at the
beginning of the buffer, Expect can search ahead for a match for a
pattern that appears earlier in the @code{expect} command and skip
over text that would match a later pattern.  @emph{The text thus
skipped is discarded.}  This is a source of very hard to trace bugs,
especially when reading input from batch-oriented unit tests.

For example, consider a simple model once used by the DejaGnu
testsuite for unit testing.  In this example, a test has failed, but
the tests before and after it have passed.  First the relevant input
to DejaGnu:

@example
PASSED: foo
FAILED: bar
PASSED: baz
@end example

The test script is reading this with two Expect patterns, simplified
for this example by omitting handling of the actual messages and other
possible results:

@example
expect @{
       -re @{PASSED: [^\r\n]+[\r\n]+@} @{ pass ... @}
       -re @{FAILED: [^\r\n]+[\r\n]+@} @{ fail ... @}
@}
@end example

At every cycle, Expect attempts to match each pattern in the order
that they are written against the available input.  If DejaGnu is
processing the input as quickly as it arrives, this example will
actually work.  However, if the system scheduler sets DejaGnu aside
for a bit, or the external program produces output in a burst, Expect
can find that its input buffer contains the text in the first example
above all at once as the cycle begins.

If this occurs, Expect will first attempt to match @code{@{PASSED:
[^\r\n]+[\r\n]+@}} against the input and will succeed, since the input
begins with @samp{PASSED: foo}.  The @code{pass} procedure is called
and the test result recorded.  Expect then starts a new matching
cycle.

If the input had been presented one line at a time, the expected
result would occur: the @code{@{FAILED: [^\r\n]+[\r\n]+@}} pattern
would match and the test driver would work correctly.  But we are
considering the case where all three lines arrived ``at once'' so we
must examine what Expect will do in this case.  After the first line
has been processed, the Expect buffer now contains:

@example
FAILED: bar
PASSED: baz
@end example

Expect again attempts to match each pattern in order.  Expect will
attempt to match @code{@{PASSED: [^\r\n]+[\r\n]+@}} before attempting
to match @code{@{FAILED: [^\r\n]+[\r\n]+@}} and the first attempt
succeeds because the pattern is not anchored.  The @samp{FAILED: bar}
message is simply discarded when Expect finds the later
@samp{PASSED:baz} message in the buffer.

How to prevent this?  There are two ways: either group all of your
test matches into a single regexp using alternation, or ensure that
all patterns can match only at the start of Expect's buffer.  Both
options can be made to work.  Grouping all status results into a
single regexp allows some other unspecified text to still be silently
discarded, while ensuring that all patterns are anchored absolutely
requires closure, as any unmatched text will cause Expect to run out
of buffer space.  Expect discards the entire buffer when this occurs.

@node Debugging a test case, Adding a test case to a testsuite, Writing a test case, Extending DejaGnu
@section Debugging a test case
@cindex test cases, debugging

These are the kinds of debugging information available from DejaGnu:

@itemize

@item
Output controlled by test scripts themselves, explicitly allowed for
by the test author.  This kind of debugging output appears in the
detailed output recorded in the DejaGnu log file.  To do the same for
new tests, use the @code{verbose} procedure (which in turn uses the
Tcl variable @samp{verbose}) to control how much output to generate.
This will make it easier for other people running the test to debug it
if necessary.  If @samp{verbose} is zero, there should be no output
other than the output from the framework (eg. FAIL).  Then, to
whatever extent is appropriate for the particular test, allow
successively higher values of @samp{verbose} to generate more
information.  Be kind to other programmers who use your tests --
provide plenty of debugging information.

@item
Output from the internal debugging functions of Tcl and Expect.  There
is a command line options for each; both forms of debugging output are
recorded in the file @file{dbg.log} in the current directory.

Use @code{--debug} for information from Expect.  It logs how Expect
attempts to match the tool output with the patterns specified.  This
can be very helpful while developing test scripts, since it shows
precisely the characters received.  Iterating between the latest
attempt at a new test script and the corresponding @file{dbg.log} can
allow you to create the final patterns by ``cut and paste''.  This is
sometimes the best way to write a test case.

@item
Use @code{--strace} to see more detail from Tcl.  This logs how Tcl
procedure definitions are expanded as they execute.  The trace level
argument controls the depth of definitions expanded.

@item
If the value of @samp{verbose} is 3 or greater (@code{runtest -v -v
-v}), DejaGnu activates the Expect command @code{log_user}.  This
command prints all Expect actions to standard output, to the
@file{.log} file and, if @code{--debug} is given, to @file{dbg.log}.
@end itemize

@node Adding a test case to a testsuite, Test case variables, Debugging a test case, Extending DejaGnu
@section Adding a test case to a testsuite
@cindex test cases, adding

There are two slightly different ways to add a test case.  One is to
add the test case to an existing directory.  The other is to create a
new directory to hold your test.  The existing test directories
represent several styles of testing, all of which are slightly
different.  Examine the testsuite subdirectories for the tool of
interest to see which approach is most suitable.

Adding a GCC test may be very simple: just add the source file to any
test directory beginning with @file{gcc.} and it will be tested on the
next test run.

Adding a test by creating a new directory involves:

@enumerate
@item
Create the new directory.  All subdirectory names begin with the name
of the tool to test; e.g. G++ tests might be in a directory called
@file{g++.other}.  There can be multiple testsuite subdirectories with
the same tool name prefix.

@item
Add the new test case to the directory, as above.
@end enumerate

@node Test case variables, , Adding a test case to a testsuite, Extending DejaGnu
@section Test case special variables

There are special variables that contain other information from
DejaGnu.  Your test cases can inspect these variables, as well as the
variables saved in @file{site.exp}.  These variables should never be
changed.

@table @code

@item $prms_id
@vindex prms_id
The bug tracking system (eg. PRMS/GNATS) number identifying a
corresponding bug report (@emph{0} if you do not specify it).

@item $bug_id
@vindex bug_id
An optional bug ID, perhaps a bug identification number from another
organization (@emph{0} if you do not specify it).

@item $subdir
@vindex subdir
The subdirectory for the current test case.

@item $exec_output
@vindex exec_output
This is the output from a @code{$@{tool@}_load} command.  This only
applies to tools like GCC and GAS which produce an object file that
must in turn be executed to complete a test.

@item $comp_output
@vindex comp_output
This is the output from a @code{$@{tool@}_start} command.  This is
conventionally used for batch-oriented programs, like GCC and GAS,
that may produce interesting output (warnings, errors) without further
interaction.

@item $expect_out(buffer)
@vindex expect_out(buffer)
The output from the last command.  This is an internal variable set by
Expect.  More information can be found in the Expect manual.
@end table

@node Unit testing, Built-in Procedures, Extending DejaGnu, Top
@chapter Unit testing

@menu
* What is unit testing?::
* The dejagnu.h header file: The dejagnu_h header file.
* C unit testing API::
* C++ unit testing API::
@end menu

@node What is unit testing?, The dejagnu_h header file, , Unit testing
@section What is unit testing?
@cindex unit testing

Most regression testing as done by DejaGnu is system testing: the
complete application is tested all at once.  Unit testing is for
testing single files, or small libraries.  In this case, each file is
linked with a test case in C or C++, and each function or class and
method is tested in turn, with the test case having to check private
data or global variables to see if the function or method worked.

This works particularly well for testing APIs and at level where it is
easier to debug them, than by needing to trace through the entire
application.  Also if there is a specification for the API to be
tested, the testcase can also function as a compliance test.

@node The dejagnu_h header file, C unit testing API, What is unit testing?, Unit testing
@section The dejagnu.h header file
@cindex dejagnu.h header

DejaGnu uses a single header file, @file{dejagnu.h} to assist in unit
testing.  As this file also produces its one test state output, it can
be run stand-alone, which is very useful for testing on embedded
systems.  This header file has a C and C++ API for the test states,
with simple totals, and standardized output.  Because the output has
been standardized, DejaGnu can be made to work with this test case,
without writing almost any Tcl.  The library module, dejagnu.exp, will
look for the output messages, and then merge them into DejaGnu's.

@node C unit testing API, C++ unit testing API, The dejagnu_h header file, Unit testing
@section C unit testing API
@cindex C unit testing API

All of the functions that take a @code{msg} parameter use a C
@code{char *} that is the message to be displayed.  There currently is
no support for variable length arguments.

@itemize
@item
@code{pass} prints a message for a successful test completion.

@quotation
@t{@b{pass}(@i{msg});}
@end quotation

@item
@code{fail} prints a message for an unsuccessful test completion.

@quotation
@t{@b{fail}(@i{msg});}
@end quotation

@item
@code{untested} prints a message for an test case that isn't run for
some technical reason.

@quotation
@t{@b{untested}(@i{msg});}
@end quotation

@item
@code{unresolved} prints a message for an test case that is run, but
there is no clear result.  These output states require a human to look
over the results to determine what happened.

@quotation
@t{@b{unresolved}(@i{msg});}
@end quotation

@item
@code{totals} prints out the total numbers of all the test state
outputs.

@quotation
@t{@b{totals}();}
@end quotation

@end itemize

@node C++ unit testing API, , C unit testing API, Unit testing
@section C++ unit testing API
@cindex C++ unit testing API

All of the methods that take a @code{msg} parameter use a C char * or
STL string, that is the message to be displayed.  There currently is
no support for variable length arguments.

@itemize

@item
@code{pass} prints a message for a successful test completion.

@quotation
@t{@b{TestState::pass}(@i{msg});}
@end quotation

@code{fail} prints a message for an unsuccessful test completion.

@quotation
@t{@b{TestState::fail}(@i{msg});}
@end quotation

@code{untested} prints a message for an test case that isn't run for
some reason.

@quotation
@t{@b{TestState::untested}(@i{msg});}
@end quotation

@item
@code{unresolved} prints a message for an test case that is run, but
there is no clear result.  These output states require a human to look
over the results to determine what happened.

@quotation
@t{@b{TestState::unresolved}(@i{msg});}
@end quotation

@item
@code{totals} prints out the total numbers of all the test state
outputs.

@quotation
@t{@b{TestState::totals}(@i{});}
@end quotation

@end itemize

@node Built-in Procedures, GNU Free Documentation License, Unit testing, Top
@appendix Built-in Procedures

DejaGnu provides these Tcl procedures.

@menu
* Core Internal Procedures::
* Procedures For Remote Communication::
* Procedures For Using Utilities to Connect: connprocs.
* Procedures For Target Boards::
* Target Database Procedures: target database library file.
* Platform Dependent Procedures: platform dependent procedures.
* Utility Procedures::
* Libgloss, a free board support package (BSP): Libgloss.
* Debugging Procedures::
@end menu

@node Core Internal Procedures, Procedures For Remote Communication, , Built-in Procedures
@section Core Internal Procedures

@menu
* open_logs Procedure: open_logs procedure
* close_logs Procedure: close_logs procedure
* isbuild Procedure: isbuild procedure
* isremote Procedure: isremote procedure
* is_remote Procedure: is_remote procedure
* is3way Procedure: is3way procedure
* ishost Procedure: ishost procedure
* istarget Procedure: istarget procedure
* isnative Procedure: isnative procedure
* log_and_exit Procedure: log_and_exit procedure
* log_summary Procedure: log_summary procedure
* setup_xfail Procedure: setup_xfail procedure
* pass Procedure: pass procedure
* fail Procedure: fail procedure
* xpass Procedure: xpass procedure
* xfail Procedure: xfail procedure
* set_warning_threshold Procedure: set_warning_threshold procedure
* get_warning_threshold Procedure: get_warning_threshold procedure
* warning Procedure: warning procedure
* perror Procedure: perror procedure
* note Procedure: note procedure
* untested Procedure: untested procedure
* unresolved Procedure: unresolved procedure
* unsupported Procedure: unsupported procedure
* transform Procedure: transform procedure
* check_conditional_xfail Procedure: check_conditional_xfail procedure
* clear_xfail Procedure: clear_xfail procedure
* verbose Procedure: verbose procedure
* load_lib Procedure: load_lib procedure
* testsuite Procedure: testsuite procedure
@end menu

@node open_logs procedure, close_logs procedure, , Core Internal Procedures
@subsubheading open_logs Procedure
@findex open_logs

Open the output logs.

@quotation
@t{@b{open_logs}}
@end quotation

@node close_logs procedure, isbuild procedure, open_logs procedure, Core Internal Procedures
@subsubheading close_logs Procedure
@findex close_logs

Close the output logs.

@quotation
@t{@b{close_logs}}
@end quotation

@node isbuild procedure, isremote procedure, close_logs procedure, Core Internal Procedures
@subsubheading isbuild Procedure
@findex isbuild

Tests for a particular build host environment.  If the currently
configured host matches the @code{pattern} argument, the result is
@emph{1}; otherwise the result is @emph{0}.  @emph{pattern} must be a
full three-part configure triplet; in particular, you may not use the
shorter aliases supported by @code{configure} (but you can use Tcl
globbing to specify a range of triplets).  If called with no arguments
or an empty pattern, this procedure returns the build system triplet.

@quotation
@t{@b{isbuild} @i{pattern}}
@end quotation

@node isremote procedure, is_remote procedure, isbuild procedure, Core Internal Procedures
@subsubheading isremote Procedure
@findex isremote

Is @i{board} remote?  Return a non-zero value, if so.

@quotation
@t{@b{isremote} @i{ board }}
@end quotation

This procedure is to be used instead of @code{is_remote}.

@node is_remote procedure, is3way procedure, isremote procedure, Core Internal Procedures
@subsubheading is_remote Procedure
@findex is_remote

Is @i{board} remote?  Return a non-zero value, if so.

@quotation
@t{@b{is_remote} @i{ board }}
@end quotation

Note that this procedure is now deprecated.  Use @code{isremote}
instead.

@node is3way procedure, ishost procedure, is_remote procedure, Core Internal Procedures
@subsubheading is3way Procedure
@findex is3way

Tests for a Canadian cross.  This is when the tests will be run on a
remotely hosted cross-compiler.  If it is a Canadian cross, then the
result is @emph{1}; otherwise @emph{0}.

@quotation
@t{@b{is3way}}
@end quotation

@node ishost procedure, istarget procedure, is3way procedure, Core Internal Procedures
@subsubheading ishost Procedure
@findex ishost

Tests for a particular host environment.  If the currently configured
host matches the argument string, the result is @emph{1}; otherwise
the result is @emph{0}.  @emph{pattern} must be a full three-part
configure triplet; in particular, you may not use the shorter aliases
supported by @code{configure} (but you can use Tcl globbing to specify
a range of triplets).  If called with no arguments or an empty
pattern, this procedure returns the host triplet.

@quotation
@t{@b{ishost} @i{pattern}}
@end quotation

@node istarget procedure, isnative procedure, ishost procedure, Core Internal Procedures
@subsubheading istarget Procedure
@findex istarget

Tests for a particular target environment.  If the currently
configured target matches the argument string, the result is @emph{1}
; otherwise the result is @emph{0}.  @emph{pattern} must be a full
three-part configure triplet; in particular, you may not use the
shorter aliases supported by @code{configure} (but you can use Tcl
globbing to specify a range of triplets).  If called with no arguments
or an empty pattern, this procedure returns the target triplet.

@quotation
@t{@b{istarget} @i{pattern} }
@end quotation

@node isnative procedure, log_and_exit procedure, istarget procedure, Core Internal Procedures
@subsubheading isnative Procedure
@findex isnative

This procedure returns @emph{1} if the current configuration has the
same host and target (ie. it is a native configuration).  Otherwise it
returns @emph{0}.

@quotation
@t{@b{isnative}}
@end quotation

@node log_and_exit procedure, log_summary procedure, isnative procedure, Core Internal Procedures
@subsubheading log_and_exit Procedure
@findex log_and_exit

@quotation
@t{@b{log_and_exit}}
@end quotation

This procedure writes out the end of the test log and terminates
@code{runtest}.


@node log_summary procedure, setup_xfail procedure, log_and_exit procedure, Core Internal Procedures
@subsubheading log_summary Procedure
@findex log_summary

@quotation
@t{@b{log_summary} @i{args}}
@end quotation

@table @asis
@item @code{args}
@end table

@node setup_xfail procedure, pass procedure, log_summary procedure, Core Internal Procedures
@subsubheading setup_xfail Procedure
@findex setup_xfail

Declares that the test is expected to fail on a particular set of
configurations.  The config argument must be a list of full three-part
configure target name; in particular, you may not use the shorter
nicknames supported by configure (but you can use the common shell
wildcard characters to specify a range of triplets).  The @emph{bugid}
argument is optional, and used only in the logging file output; use it
as a link to a bug-tracking system such as GNATS.

Once you use @code{setup_xfail}, the @code{fail} and @code{pass}
procedures produce the messages @emph{XFAIL} and @emph{XPASS}
respectively, allowing you to distinguish expected failures (and
unexpected success!) from other test outcomes.

@quotation

@strong{Warning}

Warning you must clear the expected failure after using setup_xfail in
a test case.  Any call to @code{pass }or @code{fail} clears the
expected failure implicitly; if the test has some other outcome,
e.g. an error, you can call @code{clear_xfail} to clear the expected
failure explicitly.  Otherwise, the expected-failure declaration
applies to whatever test runs next, leading to surprising results.
@end quotation

@quotation
@t{@b{setup_xfail} @i{config} @i{bugid}}
@end quotation

@table @asis
@item @code{config}
The config triplet to trigger whether this is an unexpected or expect
failure.

@item @code{bugid}
The optional bugid, used to tie this test case to a bug tracking
system.
@end table

@node pass procedure, fail procedure, setup_xfail procedure, Core Internal Procedures
@subsubheading pass Procedure
@findex pass

Declares a test to have passed.  @code{pass} writes in the log files a
message beginning with @emph{PASS} (or @emph{XPASS}, if failure was
expected), appending the @code{message} argument.

@quotation
@t{@b{pass} @i{message} }
@end quotation

@node fail procedure, xpass procedure, pass procedure, Core Internal Procedures
@subsubheading fail Procedure
@findex fail

Declares a test to have failed.  @code{fail} writes in the log files a
message beginning with @emph{FAIL} (or @emph{XFAIL}, if failure was
expected), appending the @code{message} argument.

@quotation
@t{@b{fail} @i{message} }
@end quotation

@node xpass procedure, xfail procedure, fail procedure, Core Internal Procedures
@subsubheading xpass Procedure
@findex xpass

Declares a test to have passed when it was expected to fail.
@code{xpass} writes in the log files a message beginning with
@emph{XPASS} (or @emph{XFAIL} if failure was expected) and the
@code{message} argument.

@quotation
@t{@b{xpass} @i{message} }
@end quotation

@node xfail procedure, set_warning_threshold procedure, xpass procedure, Core Internal Procedures
@subsubheading xfail Procedure
@findex xfail

Declares a test to have expectedly failed.  @code{xfail} writes in the
log files a message beginning with @emph{XFAIL} (or @emph{PASS}, if
success was expected), appending the @code{message} argument.

@quotation
@t{@b{xpass} @i{message} }
@end quotation

@node set_warning_threshold procedure, get_warning_threshold procedure, xfail procedure, Core Internal Procedures
@subsubheading set_warning_threshold Procedure
@findex set_warning_threshold

Sets the value of @code{warning_threshold}.  A value of @emph{0}
disables it: calls to @code{warning} will not turn a @emph{PASS} or
@emph{FAIL} into an @emph{UNRESOLVED}.

@quotation
@t{@b{set_warning_threshold} @i{threshold}}
@end quotation

@table @asis

@item @code{threshold}
This is the value of the new warning threshold.
@end table

@node get_warning_threshold procedure, warning procedure, set_warning_threshold procedure, Core Internal Procedures
@subsubheading get_warning_threshold Procedure
@findex get_warning_threshold

Returns the current value of @code{@{warning_threshold}.  The default
value is 3.  This value controls how many @code{warning} procedures
can be called before becoming @emph{UNRESOLVED}.

@quotation
@t{@b{get_warning_threshold}}
@end quotation

@node warning procedure, perror procedure, get_warning_threshold procedure, Core Internal Procedures
@subsubheading warning Procedure
@findex warning

Declares detection of a minor error in the test case itself.
@code{warning} writes in the log files a message beginning with
@emph{WARNING}, appending the argument @code{string}.  Use
@code{warning} rather than @code{perror} for cases (such as
communication failure to be followed by a retry) where the test case
can recover from the error.  If the optional @code{number} is
supplied, then this is used to set the internal count of warnings to
that value.

As a side effect, @code{warning_threshold} or more calls to warning in
a single test case also changes the effect of the next @code{pass} or
@code{fail} command: the test outcome becomes @emph{UNRESOLVED} since
an automatic @emph{PASS} or @emph{FAIL} may not be trustworthy after
many warnings.  If the optional numeric value is @emph{0}, then there
are no further side effects to calling this function, and the
following test outcome doesn't become @emph{UNRESOLVED}.  This can be
used for errors with no known side effects.

@quotation
@t{@b{warning} @i{messsage} @i{number} }
@end quotation

@table @asis

@item @code{message}
The warning message.

@item @code{number}
The optional number to set the error counter.  This is only used to
fake out the counter when using the @code{xfail} procedure to control
when it flips the output over to @emph{UNRESOLVED} state.
@end table

@node perror procedure, note procedure, warning procedure, Core Internal Procedures
@subsubheading perror Procedure
@findex perror

Declares a severe error in the testing framework itself.
@code{perror} writes in the log files a message beginning with
@emph{ERROR}, appending the argument @code{string}.

As a side effect, perror also changes the effect of the next
@code{pass} or @code{fail} command: the test outcome becomes
@emph{UNRESOLVED}, since an automatic @emph{PASS} or @emph{FAIL}
cannot be trusted after a severe error in the test framework.  If the
optional numeric value is @emph{0}, then there are no further side
effects to calling this function, and the following test outcome
doesn't become @emph{UNRESOLVED}.  This can be used for errors with no
known side effects.

@quotation
@t{@b{perror} @i{message} @i{number} }
@end quotation

@table @asis
@item @code{message}
The message to be logged.

@item @code{number}
The optional number to set the error counter.  This is only used to
fake out the counter when using the @code{xfail} procedure to control
when it flips the output over to @emph{UNRESOLVED} state.
@end table

@node note procedure, untested procedure, perror procedure, Core Internal Procedures
@subsubheading note Procedure
@findex note

Appends an informational message to the log file.  @code{note} writes
in the log files a message beginning with @emph{NOTE}, appending the
@code{message} argument.  Use @code{note} sparingly.  The
@code{verbose} should be used for most such messages, but in cases
where a message is needed in the log file regardless of the verbosity
level use @code{note}.

@quotation
@t{@b{note} @i{messsage} }
@end quotation


@node untested procedure, unresolved procedure, note procedure, Core Internal Procedures
@subsubheading untested Procedure
@findex untested

Declares a test was not run.  @code{untested} writes in the log file a
message beginning with @emph{UNTESTED}, appending the @code{message}
argument.  For example, you might use this in a dummy test whose only
role is to record that a test does not yet exist for some feature.

@quotation
@t{@b{untested} @i{message} }
@end quotation


@node unresolved procedure, unsupported procedure, untested procedure, Core Internal Procedures
@subsubheading unresolved Procedure
@findex unresolved

Declares a test to have an unresolved outcome.  @code{unresolved}
writes in the log file a message beginning with @emph{UNRESOLVED},
appending the @code{message} argument.  This usually means the test
did not execute as expected, and a human being must go over results to
determine if it passed or failed (and to improve the test case).

@quotation
@t{@b{unresolved} @i{message} }
@end quotation


@node unsupported procedure, transform procedure, unresolved procedure, Core Internal Procedures
@subsubheading unsupported Procedure
@findex unsupported

Declares that a test case depends on some facility that does not exist
in the testing environment.  @code{unsupported} writes in the log file
a message beginning with @emph{UNSUPPORTED}, appending the
@code{message} argument.

@quotation
@t{@b{unsupported} @i{message} }
@end quotation


@node transform procedure, check_conditional_xfail procedure, unsupported procedure, Core Internal Procedures
@subsubheading transform Procedure
@findex transform

Generates a string for the name of a tool as it was configured and
installed, given its native name (as the argument @code{toolname}).
This makes the assumption that all tools are installed using the same
naming conventions: For example, for a cross compiler supporting the
@emph{m68k-vxworks} configuration, the result of transform @code{gcc}
is @code{m68k-vxworks-gcc}.

@quotation
@t{@b{transform} @i{toolname}}
@end quotation

@table @asis

@item @code{toolname}
The name of the cross-development program to transform.
@end table

@node check_conditional_xfail procedure, clear_xfail procedure, transform procedure, Core Internal Procedures
@subsubheading check_conditional_xfail Procedure
@findex check_conditional_xfail

This procedure adds a conditional xfail, based on compiler options
used to create a test case executable.  If an include options is found
in the compiler flags, and it's the right architecture, it'll trigger
an @emph{XFAIL}.  Otherwise it'll produce an ordinary @emph{FAIL}.
You can also specify flags to exclude.  This makes a result be a
@emph{FAIL}, even if the included options are found.  To set the
conditional, set the variable @code{compiler_conditional_xfail_data}
to the fields

@example
"[message string] [targets list] [includes list] [excludes list]"
@end example

(descriptions below).  This is the checked at pass/fail decision time,
so there is no need to call the procedure yourself, unless you wish to
know if it gets triggered.  After a pass/fail, the variable is reset,
so it doesn't effect other tests.  It returns @emph{1} if the
conditional is true, or @emph{0} if the conditional is false.

@quotation
@t{@b{check_conditional_xfail} @i{message} @i{targets} @i{includes}
@i{excludes}}
@end quotation

@table @asis

@item @code{message}
This is the message to print with the normal test result.

@item @code{targets}
This is a string with the list targets to activate this conditional
on.

@item @code{includes}
This is a list of sets of options to search for in the compiler
options to activate this conditional.  If the list of sets of options
is empty or if any set of the options matches, then this conditional
is true.  (It may be useful to specify an empty list of include sets
if the conditional is always true unless one of the exclude sets
matches.)

@item @code{excludes}
This is a list of sets of options to search for in the compiler
options to activate this conditional.  If any set of the options
matches, (regardless of whether any of the include sets match) then
this conditional is de-activated.
@end table

@strong{Specifying the conditional xfail data}

@example
set compiler_conditional_xfail_data @{ \
     "I sure wish I knew why this was hosed" \
     "sparc*-sun*-* *-pc-*-*" \
     @{"-Wall -v" "-O3"@} \
     @{"-O1" "-Map"@} \
@}
@end example

What this does is it matches only for these two targets if @code{-Wall
-v} or @code{-O3} is set, but neither @code{-O1} or @code{-Map} is
set.  For a set to match, the options specified are searched for
independently of each other, so a @code{-Wall -v} matches either
@code{-Wall -v} or @code{-v -Wall}.  A space separates the options in
the string.  Glob patterns are also permitted.

@node clear_xfail procedure, verbose procedure, check_conditional_xfail procedure, Core Internal Procedures
@subsubheading clear_xfail Procedure
@findex clear_xfail

Cancel an expected failure (previously declared with
@code{setup_xfail}) for a particular set of configurations.  The
@code{config} argument is a list of configuration target names.  It is
only necessary to call @code{clear_xfail} if a test case ends without
calling either @code{pass} or @code{fail}, after calling
@code{setup_xfail}.

@quotation
@t{@b{clear_xfail} @i{config}}
@end quotation

@table @asis

@item @code{config}
The system triplets to clear.
@end table

@node verbose procedure, load_lib procedure, clear_xfail procedure, Core Internal Procedures
@subsubheading verbose Procedure
@findex verbose

Test cases can use this procedure to issue helpful messages depending
on the number of @code{-v}/@code{--verbose} options passed on the
command line to @code{runtest}.  It prints @i{message} if the value of
the number of @code{-v} options passed is greater than or equal to the
@i{loglevel} argument.  The default log level is 1.

@quotation
@t{ @b{verbose}
@i{-log}
@i{-x}
@i{-n}
@i{message}
@i{loglevel}}
@end quotation

@table @asis

@item @code{-log}
Always write @i{message} to the log file, even if it won't be printed
on the console.

@item @code{-x}
Log the @i{message} into an XML file.

@item @code{-n}
Print @i{message} without a trailing newline.

@item @code{--}
Use this option if @i{message} begins with @samp{-}.

@item @code{message}
The log messsage.

@item @code{loglevel}
The specified log level.  The default level is 1.
@end table

@node load_lib procedure, testsuite procedure, verbose procedure, Core Internal Procedures
@subsubheading load_lib Procedure
@findex load_lib

@code{load_lib} loads a DejaGnu library file by searching the default
fixed paths built into DejaGnu.  If DejaGnu has been installed, it
looks in a path starting with the installed library directory.  If you
are running DejaGnu directly from a source directory, without first
running @code{make install}, this path defaults to the current
directory.  In either case, it then looks in the current directory for
a directory called @file{lib}.  If there are duplicate definitions,
the last one loaded takes precedence over the earlier ones.

@quotation
@t{@b{load_lib} @i{filespec}}
@end quotation

@table @asis

@item @code{filespec}
The name of the DejaGnu library file to load.
@end table

The global variable @code{libdirs}, handled as a list, is appended to
the default fixed paths built into DejaGnu.

@strong{Additional search directories for load_lib}

@example
# append a non-standard search path
global libdirs
lappend libdirs $srcdir/../../gcc/testsuite/lib
# now loading $srcdir/../../gcc/testsuite/lib/foo.exp works
load_lib foo.exp
@end example

@node testsuite procedure,  , load_lib procedure, Core Internal Procedures
@subsubheading testsuite Procedure
@findex testsuite

The @code{testsuite} procedure is a multiplex call for retrieving or
providing information about the current testsuite.

@subsubheading testsuite file

The @code{testsuite file} command returns an absolute file name
specified relative to either the testsuite source or object trees.

@quotation
@t{  @b{testsuite file}
?@b{-source}|@b{-object}?
@b{-top}|@b{-test}
?@b{-hypothetical}?
?@b{--}? @i{name}... }
@end quotation

Any number of @i{name}s are accepted and combined as if by @code{file
join} with a directory relevant to the testsuite prepended.

@table @asis

@item @code{-object}
Return a file name in the object tree.

@item @code{-source}
Return a file name in the source tree.

@item @code{-top}
Prepend the @code{testsuite} directory itself.

@item @code{-test}
Prepend the directory containing the current test script.

@item @code{-hypothetical}
Allow the returned value to imply directories that do not exist.

@item @code{--}
Use this option if the first @i{name} could begin with @samp{-}.

@end table

One of @code{-top} or @code{-test} must be given; an error is raised
otherwise.

Unless the @code{-hypothetical} option is given, any directories
implied by the returned value will exist upon return.  Implied
directories are created in the object tree if needed.  An error is
raised if an implied directory does not exist in the source tree.

@node Procedures For Remote Communication, connprocs, Core Internal Procedures, Built-in Procedures
@section Procedures For Remote Communication

The file @file{lib/remote.exp} defines procedures for establishing and
managing communications.  Each of these procedures tries to establish
the connection up to three times before returning.  Warnings (if
retries will continue) or errors (if the attempt is abandoned) report
on communication failures.  The result for any of these procedures is
either @emph{-1}, when the connection cannot be established, or the
spawn ID returned by the Expect command @code{spawn}.

It use the value of the @code{connect} field in the @code{target_info}
array as the type of connection to make.  Current supported connection
types are ssh, tip, kermit, telnet, rsh, and rlogin.  If the
@code{--reboot} option was used on the @command{runtest} command line,
then the target is rebooted before the connection is made.

@menu
* call_remote Procedure: call_remote procedure
* check_for_board_status Procedure: check_for_board_status procedure
* file_on_build Procedure: file_on_build procedure
* file_on_host Procedure: file_on_host procedure
* local_exec Procedure: local_exec procedure
* remote_binary Procedure: remote_binary procedure
* remote_close Procedure: remote_close procedure
* remote_download Procedure: remote_download procedure
* remote_exec Procedure: remote_exec procedure
* remote_expect Procedure: remote_expect procedure
* remote_file Procedure: remote_file procedure
* remote_ld Procedure: remote_ld procedure
* remote_load Procedure: remote_load procedure
* remote_open Procedure: remote_open procedure
* remote_pop_conn Procedure: remote_pop_conn procedure
* remote_push_conn Procedure: remote_push_conn procedure
* remote_raw_binary Procedure: remote_raw_binary procedure
* remote_raw_close Procedure: remote_raw_close procedure
* remote_raw_file Procedure: remote_raw_file procedure
* remote_raw_ld Procedure: remote_raw_ld procedure
* remote_raw_load Procedure: remote_raw_load procedure
* remote_raw_open Procedure: remote_raw_open procedure
* remote_raw_send Procedure: remote_raw_send procedure
* remote_raw_spawn Procedure: remote_raw_spawn procedure
* remote_raw_transmit Procedure: remote_raw_transmit procedure
* remote_raw_wait Procedure: remote_raw_wait procedure
* remote_reboot Procedure: remote_reboot procedure
* remote_send Procedure: remote_send procedure
* remote_spawn Procedure: remote_spawn procedure
* remote_swap_conn Procedure: remote_swap_conn procedure
* remote_transmit Procedure: remote_transmit procedure
* remote_upload Procedure: remote_upload procedure
* remote_wait Procedure: remote_wait procedure
* standard_close Procedure: standard_close procedure
* standard_download Procedure: standard_download procedure
* standard_exec Procedure: standard_exec procedure
* standard_file Procedure: standard_file procedure
* standard_load Procedure: standard_load procedure
* standard_reboot Procedure: standard_reboot procedure
* standard_send Procedure: standard_send procedure
* standard_spawn Procedure: standard_spawn procedure
* standard_transmit Procedure: standard_transmit procedure
* standard_upload Procedure: standard_upload procedure
* standard_wait Procedure: standard_wait procedure
* unix_clean_filename Procedure: unix_clean_filename procedure
@end menu

@node call_remote procedure, check_for_board_status procedure, , Procedures For Remote Communication
@subsubheading call_remote Procedure
@findex call_remote

A standard procedure to call the appropriate @i{proc}.  This proceure
first looks for a board-specific version, then a protocol-specific
version, and finally @code{call_remote} will call
@code{standard_$proc}.

@quotation
@t{@b{call_remote} @i{type} @i{proc} @i{dest} @i{args}}
@end quotation

@table @asis
@item @code{proc}
@item @code{dest}
@item @code{args}
@end table

@node check_for_board_status procedure, file_on_build procedure, call_remote procedure, Procedures For Remote Communication
@subsubheading check_for_board_status Procedure
@findex check_for_board_status

This procedure inspected the named variable within the calling
procedure for the expected output from the status wrapper.  A
non-negative value is returned if it exists.  Otherwise, it returns
-1.  The output from the status wrapper is removed from the variable.

@quotation
@t{@b{check_for_board_status} @i{variable}}
@end quotation

@table @asis
@item @code{variable}
The name of the variable to check in the calling procedure.  Be sure
to pass the name of the variable (@code{var}) and not the value of the
variable (@code{$var}).
@end table

@node file_on_build procedure, file_on_host procedure, check_for_board_status procedure, Procedures For Remote Communication
@subsubheading file_on_build Procedure
@findex file_on_build

@quotation
@t{@b{file_on_build} @i{op} @i{file} @i{args}}
@end quotation

@table @asis
@item @code{op}
@item @code{file}
@item @code{args}
@end table

@node file_on_host procedure, local_exec procedure, file_on_build procedure, Procedures For Remote Communication
@subsubheading file_on_host Procedure
@findex file_on_host

@quotation
@t{@b{file_on_host} @i{op} @i{file} @i{args}}
@end quotation

@table @asis
@item @code{op}
@item @code{file}
@item @code{args}
@end table

@node local_exec procedure, remote_binary procedure, file_on_host procedure, Procedures For Remote Communication
@subsubheading local_exec Procedure
@findex local_exec

Run the specified command on the local machine, redirecting input from
file @code{inp} (if non-empty), redirecting output to file @code{outp}
(if non-empty), and waiting @code{timeout} seconds for the command to
complete before killing it.  A two-element list is returned: the exit
status of the command and any output produced by the command.  If
output is redirected, this may or may not be empty.  If output is
redirected, both stdout and stderr will appear in the specified file.

@quotation
@t{@b{local_exec} @i{commandline} @i{inp} @i{outp} @i{timeout}}
@end quotation

@table @asis
@item @code{inp}
Redirect input into the input filename if not set to @code{""}.

@item @code{outp}
Redirect output into the output filename if not set to @code{""}.

@item @code{timeout}
Timeout in seconds.

@end table

@node remote_binary procedure, remote_close procedure, local_exec procedure, Procedures For Remote Communication
@subsubheading remote_binary Procedure
@findex remote_binary

This procedure sets the connection into @i{binary} mode.  That is,
there is no processing of input characters.

@quotation
@t{@b{remote_binary} @i{host}}
@end quotation

@table @asis
@item @code{host}
The host on which to set a binary connection.
@end table

@node remote_close procedure, remote_download procedure, remote_binary procedure, Procedures For Remote Communication
@subsubheading remote_close Procedure
@findex remote_close

@quotation
@t{@b{remote_close} @i{shellid}}
@end quotation

@table @asis

@item @code{shellid}
This is the value returned by a call to @code{remote_open}.  This
closes the connection to the target so resources can be used by
others.  This parameter can be left off if the @code{fileid} field in
the @code{target_info} array is set.
@end table

@node remote_download procedure, remote_exec procedure, remote_close procedure, Procedures For Remote Communication
@subsubheading remote_download Procedure
@findex remote_download

Download a file to a destination machine.  This procedure returns
either an empty string (indicating failure) or the name of the file on
the destination macine.

@quotation
@t{@b{remote_download} @i{dest} @i{file} @i{args}}
@end quotation

@table @asis
@item @code{dest}
Destination machine name.

@item @code{file}
Filename.

@item @code{args}
If the optional destination filename is specified, that filename will
be used on the destination machine.
@end table

@node remote_exec procedure, remote_expect procedure, remote_download procedure, Procedures For Remote Communication
@subsubheading remote_exec Procedure
@findex remote_exec

Execute the supplied program on a remote host.  A two-element list is
returned.  The first element is the exit status of the program or -1
if execution failed.  The second element is any output produced by the
program.  This may be an empty string if output from the program was
redirected.

@quotation
@t{  @b{remote_exec} @i{hostname} @i{program}
?@i{options}? ?@i{input}? ?@i{output}? ?@i{timeout}?}
@end quotation

@table @asis
@item @code{hostname}
Name of the host to execute the command on.

@item @code{program}
Command to execute.

@item @code{options}
Arguments to pass to the program.

@item @code{input}
Input filename to feed to standard input of the command.

@item @code{output}
Output filename where the output from the command should be written.

@item @code{timeout}
Timeout value in seconds.

@end table

All of the optional positional arguments accept an empty string as a
neutral value.

@node remote_expect procedure, remote_file procedure, remote_exec procedure, Procedures For Remote Communication
@subsubheading remote_expect Procedure
@findex remote_expect

@quotation
@t{@b{remote_expect} @i{board} @i{timeout} @i{args}}
@end quotation

@table @asis
@item @code{board}
@item @code{timeout}
@item @code{args}
@end table

@node remote_file procedure, remote_ld procedure, remote_expect procedure, Procedures For Remote Communication
@subsubheading remote_file Procedure
@findex remote_file

@quotation
@t{@b{remote_file} @i{dest} @i{args}}
@end quotation

@table @asis

@item @code{dest}

@item @code{args}
@end table

@node remote_ld procedure, remote_load procedure, remote_file procedure, Procedures For Remote Communication
@subsubheading remote_ld Procedure
@findex remote_ld

@quotation
@t{@b{remote_ld} @i{dest} @i{prog}}
@end quotation

@table @asis
@item @code{dest}
@item @code{prog}
@end table

@node remote_load procedure, remote_open procedure, remote_ld procedure, Procedures For Remote Communication
@subsubheading remote_load Procedure
@findex remote_load

@quotation
@t{@b{remote_load} @i{dest} @i{prog} @i{args}}
@end quotation

@table @asis
@item @code{dest}
@item @code{prog}
@item @code{args}
@end table

@node remote_open procedure, remote_pop_conn procedure, remote_load procedure, Procedures For Remote Communication
@subsubheading remote_open Procedure
@findex remote_open

Open connection to a remote host or target.  This requires the
@code{target_info} array be filled in with the proper information to
work.  It returns the spawn id of the process that is the connection.

@quotation
@t{@b{remote_open} @i{type}}
@end quotation
@table @asis

@item @code{type}
This is passed @code{host} or @code{target}.  Host or target refers to
whether it is a connection to a remote target, or a remote host.  This
opens the connection to the desired target or host using the default
values in the configuration system.  It returns that @code{spawn_id}
of the process that manages the connection.  This value can be used in
Expect or @code{exp_send} statements, or passed to other procedures
that need the connection process's id.  This also sets the
@code{fileid} field in the @code{target_info} array.
@end table

@node remote_pop_conn procedure, remote_push_conn procedure, remote_open procedure, Procedures For Remote Communication
@subsubheading remote_pop_conn Procedure
@findex remote_pop_conn

Pop a previously-pushed connection from the stack.  You should have
closed the current connection before calling this procedure.  Returns
@code{pass} or @code{fail}.

@quotation
@t{@b{remote_pop_conn} @i{host}}
@end quotation

@table @asis
@item @code{host}
@end table

@node remote_push_conn procedure, remote_raw_binary procedure, remote_pop_conn procedure, Procedures For Remote Communication
@subsubheading remote_push_conn Procedure
@findex remote_push_conn

Pushes the current connection onto a stack.  Returns @code{pass} or
@code{fail}.

@quotation
@t{@b{remote_push_conn} @i{host}}
@end quotation

@table @asis
@item @code{host}
@end table

@node remote_raw_binary procedure, remote_raw_close procedure, remote_push_conn procedure, Procedures For Remote Communication
@subsubheading remote_raw_binary Procedure
@findex remote_raw_binary

@quotation
@t{@b{remote_raw_binary} @i{host}}
@end quotation

@table @asis
@item @code{host}
@end table

@node remote_raw_close procedure, remote_raw_file procedure, remote_raw_binary procedure, Procedures For Remote Communication
@subsubheading remote_raw_close Procedure
@findex remote_raw_close

@quotation
@t{@b{remote_raw_close} @i{host}}
@end quotation

@table @asis
@item @code{host}
@end table

@node remote_raw_file procedure, remote_raw_ld procedure, remote_raw_close procedure, Procedures For Remote Communication
@subsubheading remote_raw_file Procedure
@findex remote_raw_file

@quotation
@t{@b{remote_raw_file} @i{dest} @i{args}}
@end quotation

@table @asis
@item @code{dest}

@item @code{args}
@end table

@node remote_raw_ld procedure, remote_raw_load procedure, remote_raw_file procedure, Procedures For Remote Communication
@subsubheading remote_raw_ld Procedure
@findex remote_raw_ld

@quotation
@t{@b{remote_raw_ld} @i{dest} @i{prog}}
@end quotation

@table @asis
@item @code{dest}
@item @code{prog}
@end table

@node remote_raw_load procedure, remote_raw_open procedure, remote_raw_ld procedure, Procedures For Remote Communication
@subsubheading remote_raw_load Procedure
@findex remote_raw_load

@quotation
@t{@b{remote_raw_load} @i{dest} @i{prog} @i{args}}
@end quotation

@table @asis
@item @code{dest}
@item @code{prog}
@item @code{args}
@end table

@node remote_raw_open procedure, remote_raw_send procedure, remote_raw_load procedure, Procedures For Remote Communication
@subsubheading remote_raw_open Procedure
@findex remote_raw_open

@quotation
@t{@b{remote_raw_open} @i{args}}
@end quotation

@table @asis
@item @code{args}
@end table

@node remote_raw_send procedure, remote_raw_spawn procedure, remote_raw_open procedure, Procedures For Remote Communication
@subsubheading remote_raw_send Procedure
@findex remote_raw_send

@quotation

@t{@b{remote_raw_send} @i{dest} @i{string}}
@end quotation

@table @asis
@item @code{dest}
@item @code{string}
@end table

@node remote_raw_spawn procedure, remote_raw_transmit procedure, remote_raw_send procedure, Procedures For Remote Communication
@subsubheading remote_raw_spawn Procedure
@findex remote_raw_spawn

@quotation
@t{@b{remote_raw_spawn} @i{dest} @i{commandline}}
@end quotation

@table @asis
@item @code{dest}
@item @code{commandline}
@end table

@node remote_raw_transmit procedure, remote_raw_wait procedure, remote_raw_spawn procedure, Procedures For Remote Communication
@subsubheading remote_raw_transmit Procedure
@findex remote_raw_transmit

@quotation
@t{@b{remote_raw_transmit} @i{dest} @i{file}}
@end quotation

@table @asis
@item @code{dest}
@item @code{file}
@end table

@node remote_raw_wait procedure, remote_reboot procedure, remote_raw_transmit procedure, Procedures For Remote Communication
@subsubheading remote_raw_wait Procedure
@findex remote_raw_wait

@quotation
@t{@b{remote_raw_wait} @i{dest} @i{timeout}}
@end quotation

@table @asis
@item @code{dest}
@item @code{timeout}
@end table

@node remote_reboot procedure, remote_send procedure, remote_raw_wait procedure, Procedures For Remote Communication
@subsubheading remote_reboot Procedure
@findex remote_reboot

Reboot the host.  The return value of this procedure depends on the
actual implementation of reboot that will be used, in practice it is
expected that @code{remote_reboot} returns @b{1} on success and @b{0}
on failure.

@quotation
@t{@b{remote_reboot} @i{host}}
@end quotation

@table @asis
@item @code{host}
@end table

@node remote_send procedure, remote_spawn procedure, remote_reboot procedure, Procedures For Remote Communication
@subsubheading remote_send Procedure
@findex remote_send

@quotation
@t{@b{remote_send} @i{dest} @i{string}}
@end quotation

@table @asis
@item @code{dest}
@item @code{string}
@end table

@node remote_spawn procedure, remote_swap_conn procedure, remote_send procedure, Procedures For Remote Communication
@subsubheading remote_spawn Procedure
@findex remote_spawn

Start a command on the destination.  By default it is not possible to
redirect I/O.  If the command is successfully started, a positive
spawn ID is returned.  If the spawn fails, a negative value will be
returned.  Once the command has started, you can interact with it
using @code{remote_expect} and @code{remote_wait} procedures.

@quotation
@t{@b{remote_spawn} @i{dest} @i{commandline} @i{args}}
@end quotation

@table @asis
@item @code{dest}
The destination.

@item @code{commandline}
The command to execute.

@item @code{args}
If the optional keyword @code{readonly} is specified, input to the
command may be redirected.
@end table

@node remote_swap_conn procedure, remote_transmit procedure, remote_spawn procedure, Procedures For Remote Communication
@subsubheading remote_swap_conn Procedure
@findex remote_swap_conn

Swap the current connection with the topmost one on the stack.
Returns @code{pass} or @code{fail}.

@quotation
@t{@b{remote_swap_conn} @i{host}}
@end quotation

@table @asis
@item @code{}
@end table

@node remote_transmit procedure, remote_upload procedure, remote_swap_conn procedure, Procedures For Remote Communication
@subsubheading remote_transmit Procedure
@findex remote_transmit

@quotation
@t{@b{remote_transmit} @i{dest} @i{file}}
@end quotation

@table @asis
@item @code{dest}
@item @code{file}
@end table

@node remote_upload procedure, remote_wait procedure, remote_transmit procedure, Procedures For Remote Communication
@subsubheading remote_upload Procedure
@findex remote_upload

@quotation
@t{@b{remote_upload} @i{dest} @i{srcfile} @i{arg}}
@end quotation

@table @asis
@item @code{dest}
@item @code{srcfile}
@item @code{arg}
@end table

@node remote_wait procedure, standard_close procedure, remote_upload procedure, Procedures For Remote Communication
@subsubheading remote_wait Procedure
@findex remote_wait

Wait for the last spawned command on the destination to complete.  A
list of two values is returned: the exit status (-1 if the program
timed out) and any output produced by the command.

@quotation
@t{@b{remote_wait} @i{dest} @i{timeout}}
@end quotation

@table @asis
@item @code{dest}
The destination board.

@item @code{timeout}
The timeout in seconds.
@end table

@node standard_close procedure, standard_download procedure, remote_wait procedure, Procedures For Remote Communication
@subsubheading standard_close Procedure
@findex standard_close

This procedure closes a connection.

@quotation
@t{@b{standard_close} @i{host}}
@end quotation

@table @asis
@item @code{host}
The host to close the connection to.
@end table

@node standard_download procedure, standard_exec procedure, standard_close procedure, Procedures For Remote Communication
@subsubheading standard_download Procedure
@findex standard_download

Downloads a file to a destination.  It returns either the empty string
(indicating failure) or the name of the file on the destination.

@quotation
@t{@b{standard_download} @i{dest} @i{file} @i{destfile}}
@end quotation

@table @asis
@item @code{dest}
Destination board.

@item @code{file}
The name of the file to download.

@item @code{destfile}
If the optional @i{destile} is specified, that filename will be used
on the destination board.
@end table

@node standard_exec procedure, standard_file procedure, standard_download procedure, Procedures For Remote Communication
@subsubheading standard_exec Procedure
@findex standard_exec

@quotation
@t{@b{standard_exec} @i{hostname} @i{args}}
@end quotation

@table @asis
@item @code{hostname}
@item @code{args}
@end table

@node standard_file procedure, standard_load procedure, standard_exec procedure, Procedures For Remote Communication
@subsubheading standard_file Procedure
@findex standard_file

@quotation
@t{@b{standard_file} @i{dest} @i{op} @i{args}}
@end quotation

@table @asis
@item @code{}
@end table

@node standard_load procedure, standard_reboot procedure, standard_file procedure, Procedures For Remote Communication
@subsubheading standard_load Procedure
@findex standard_load

@quotation
@t{@b{standard_load} @i{dest} @i{prog} @i{args}}
@end quotation

@table @asis
@item @code{dest}
@item @code{prog}
@item @code{args}
@end table

@node standard_reboot procedure, standard_send procedure, standard_load procedure, Procedures For Remote Communication
@subsubheading standard_reboot Procedure
@findex standard_reboot

It looks like that this procedure is never called, instead
@code{$@{board@}_reboot} defined in @file{base-config.exp} will be
used because it has higher priority and @file{base-config.exp} is
always imported by @code{runtest}.

@quotation
@t{@b{standard_reboot} @i{host}}
@end quotation

@table @asis
@item @code{host}
@end table

@node standard_send procedure, standard_spawn procedure, standard_reboot procedure, Procedures For Remote Communication
@subsubheading standard_send Procedure
@findex standard_send

@quotation
@t{@b{standard_send} @i{dest} @i{string}}
@end quotation

@table @asis
@item @code{dest}
@item @code{string}
@end table

@node standard_spawn procedure, standard_transmit procedure, standard_send procedure, Procedures For Remote Communication
@subsubheading standard_spawn Procedure
@findex standard_spawn

@quotation
@t{@b{standard_spawn} @i{dest} @i{commandline}}
@end quotation

@table @asis
@item @code{dest}
@item @code{commandline}
@end table

@node standard_transmit procedure, standard_upload procedure, standard_spawn procedure, Procedures For Remote Communication
@subsubheading standard_transmit Procedure
@findex standard_transmit

The default transmit procedure if none other exists.  This feeds the
file directly into the connection.

@quotation
@t{@b{standard_transmit} @i{dest} @i{file}}
@end quotation

@table @asis
@item @code{dest}

@item @code{file}
File to transmit.
@end table

@node standard_upload procedure, standard_wait procedure, standard_transmit procedure, Procedures For Remote Communication
@subsubheading standard_upload Procedure
@findex standard_upload

@quotation
@t{@b{standard_upload} @i{dest srcfile destfile}}
@end quotation

@table @asis
@item @code{dest}
@item @code{srcfile}
@item @code{destfile}
@end table

@node standard_wait procedure, unix_clean_filename procedure, standard_upload procedure, Procedures For Remote Communication
@subsubheading standard_wait Procedure
@findex standard_wait

@quotation
@t{@b{standard_wait} @i{dest} @i{timeout}}
@end quotation

@table @asis
@item @code{dest}
@item @code{timeout}
@end table

@node unix_clean_filename procedure, , standard_wait procedure, Procedures For Remote Communication
@subsubheading unix_clean_filename Procedure
@findex unix_clean_filename

This procedure returns an absolute version of the filename argument
with @samp{.} and @samp{..} removed.

@quotation
@t{@b{unix_clean_filename} @i{dest} @i{file}}
@end quotation

@table @asis
@item @code{dest}
@item @code{file}
The filename.
@end table

@node connprocs, Procedures For Target Boards, Procedures For Remote Communication, Built-in Procedures
@section Procedures For Using Utilities to Connect

@menu
* kermit_open Procedure: kermit_open procedure
* kermit_command Procedure: kermit_command procedure
* kermit_send Procedure: kermit_send procedure
* kermit_transmit Procedure: kermit_transmit procedure
* telnet_open Procedure: telnet_open procedure
* telnet_binary Procedure: telnet_binary procedure
* tip_open Procedure: tip_open procedure
* rlogin_open Procedure: rlogin_open procedure
* rlogin_spawn Procedure: rlogin_spawn procedure
* rsh_open Procedure: rsh_open procedure
* rsh_download Procedure: rsh_download procedure
* rsh_upload Procedure: rsh_upload procedure
* rsh_exec Procedure: rsh_exec procedure
* ssh_close Procedure: ssh_close procedure
* ssh_exec Procedure: ssh_exec procedure
* ssh_download Procedure: ssh_download procedure
* ssh_upload Procedure: ssh_upload procedure
* ftp_open Procedure: ftp_open procedure
* ftp_upload Procedure: ftp_upload procedure
* ftp_download Procedure: ftp_download procedure
* ftp_close Procedure: ftp_close procedure
* tip_download Procedure: tip_download procedure
@end menu

@node kermit_open procedure, kermit_command procedure, connprocs, connprocs
@subsubheading kermit_open Procedure
@findex kermit_open

@quotation
@t{@b{kermit_open} @i{dest} @i{args}}
@end quotation

@table @asis
@item @code{dest}
@item @code{args}
@end table

@node kermit_command procedure, kermit_send procedure, kermit_open procedure, connprocs
@subsubheading kermit_command Procedure
@findex kermit_command

@quotation
@t{@b{kermit_command} @i{dest} @i{args}}
@end quotation

@table @asis
@item @code{dest}
@item @code{args}
@end table

@node kermit_send procedure, kermit_transmit procedure, kermit_command procedure, connprocs
@subsubheading kermit_send Procedure
@findex kermit_send

@quotation
@t{@b{kermit_send} @i{dest string args}}
@end quotation

@table @asis
@item @code{dest}
@item @code{string}
@item @code{args}
@end table

@node kermit_transmit procedure, telnet_open procedure, kermit_send procedure, connprocs
@subsubheading kermit_transmit Procedure
@findex kermit_transmit

@quotation
@t{@b{kermit_transmit} @i{dest} @i{file} @i{args}}
@end quotation

@table @asis
@item @code{dest}
@item @code{file}
@item @code{args}
@end table

@node telnet_open procedure, telnet_binary procedure, kermit_transmit procedure, connprocs
@subsubheading telnet_open Procedure
@findex telnet_open

This procedure opens a connection to a remote host using TELNET.  This
procedure sets the @code{fileid} field in the @code{board_info} array
and returns the spawn id (or -1 for error).

@quotation
@t{@b{telnet_open} @i{hostname} @i{args}}
@end quotation

@table @asis
@item @code{hostname}
The host to connect to with TELNET.

@item @code{args}
A list of options.  Currently the only supported option is @code{raw}.
@end table

@node telnet_binary procedure, tip_open procedure, telnet_open procedure, connprocs
@subsubheading telnet_binary Procedure
@findex telnet_binary

Puts an existing TELNET connection into binary mode.

@quotation
@t{@b{telnet_binary} @i{hostname}}
@end quotation

@table @asis
@item @code{hostname}
Hostname for the connection.
@end table

@node tip_open procedure, rlogin_open procedure, telnet_binary procedure, connprocs
@subsubheading tip_open Procedure
@findex tip_open

Connect to a host using @code{tip(1)}.  This procedure sets the board
@code{fileid} field with the @code{spawn_id} on success and,
otherwise, returns -1.

@quotation
@t{@b{tip_open} @i{hostname}}
@end quotation

@table @asis
@item @code{hostname}
Hostname to connect to.
@end table

@node rlogin_open procedure, rlogin_spawn procedure, tip_open procedure, connprocs
@subsubheading rlogin_open Procedure
@findex rlogin_open

@quotation
@t{@b{rlogin_open} @i{arg}}
@end quotation

@table @asis
@item @code{arg}
@end table

@node rlogin_spawn procedure, rsh_open procedure, rlogin_open procedure, connprocs
@subsubheading rlogin_spawn Procedure
@findex rlogin_spawn

@quotation
@t{@b{rlogin_spawn} @i{dest} @i{cmdline}}
@end quotation

@table @asis
@item @code{dest}
@item @code{cmdline}
@end table

@node rsh_open procedure, rsh_download procedure, rlogin_spawn procedure, connprocs
@subsubheading rsh_open Procedure
@findex rsh_open

@quotation
@t{@b{rsh_open} @i{hostname}}
@end quotation

@table @asis
@item @code{hostname}
@end table

@node rsh_download procedure, rsh_upload procedure, rsh_open procedure, connprocs
@subsubheading rsh_download Procedure
@findex rsh_download

@quotation
@t{@b{rsh_download} @i{desthost} @i{srcfile} @i{destfile}}
@end quotation

@table @asis
@item @code{desthost}
@item @code{srcfile}
@item @code{destfile}
@end table

@node rsh_upload procedure, rsh_exec procedure, rsh_download procedure, connprocs
@subsubheading rsh_upload Procedure
@findex rsh_upload

@quotation
@t{@b{rsh_upload} @i{desthost} @i{srcfile} @i{destfile}}
@end quotation

@table @asis
@item @code{desthost}
@item @code{srcfile}
@item @code{destfile}
@end table

@node rsh_exec procedure, ssh_close procedure, rsh_upload procedure, connprocs
@subsubheading rsh_exec Procedure
@findex rsh_exec

@quotation
@t{@b{rsh_exec} @i{boardname} @i{cmd} @i{args}}
@end quotation

@table @asis
@item @code{boardname}
@item @code{cmd}
@item @code{args}
@end table

@node ssh_close procedure, ssh_exec procedure, rsh_exec procedure, connprocs
@subsubheading ssh_close procedure
@findex ssh_close

@quotation
@t{@b{ssh_close} @i{desthost}}
@end quotation

@table @asis
@item @code{desthost}
@end table

@node ssh_exec procedure, ssh_download procedure, ssh_close procedure, connprocs
@subsubheading ssh_exec procedure
@findex ssh_exec

@quotation
@t{@b{ssh_exec} @i{boardname} @i{program} @i{pargs} @i{inp} @i{outp}}
@end quotation

@table @asis
@item @code{boardname}
@item @code{program}
@item @code{pargs}
@item @code{inp}
@item @code{outp}
@end table

@node ssh_download procedure, ssh_upload procedure, ssh_exec procedure, connprocs
@subsubheading ssh_download procedure
@findex ssh_download

@quotation
@t{@b{ssh_download} @i{desthost} @i{srcfile} @i{destfile}}
@end quotation

@table @asis
@item @code{desthost}
@item @code{srcfile}
@item @code{destfile}
@end table

@node ssh_upload procedure, ftp_open procedure, ssh_download procedure, connprocs
@subsubheading ssh_upload procedure
@findex ssh_upload

@quotation
@t{@b{ssh_upload} @i{desthost} @i{srcfile} @i{destfile}}
@end quotation

@table @asis
@item @code{desthost}
@item @code{srcfile}
@item @code{destfile}
@end table

@node ftp_open procedure, ftp_upload procedure, ssh_upload procedure, connprocs
@subsubheading ftp_open Procedure
@findex ftp_open

Open an FTP connection.

@quotation
@t{@b{ftp_open} @i{host}}
@end quotation

@table @asis
@item @code{host}
The host to open the FTP connection to.
@end table

@node ftp_upload procedure, ftp_download procedure, ftp_open procedure, connprocs
@subsubheading ftp_upload Procedure
@findex ftp_upload

Fetches a file from a remote host using FTP.

@quotation
@t{@b{ftp_upload} @i{host} @i{remotefile} @i{localfile}}
@end quotation

@table @asis
@item @code{host}
The host to transfer the file from.

@item @code{remotefile}
The filename at the remote end.

@item @code{localfile}
The filename to store locally.

@end table

@node ftp_download procedure, ftp_close procedure, ftp_upload procedure, connprocs
@subsubheading ftp_download Procedure
@findex ftp_download

Sends a file to a remote host using FTP.

@quotation
@t{@b{ftp_download} @i{host} @i{localfile} @i{remotefile}}
@end quotation

@table @asis
@item @code{host}
The host to transfer the file from.

@item @code{localfile}
The filename on the local system.

@item @code{remotefile}
The filename at the remote end.
@end table

@node ftp_close procedure, tip_download procedure, ftp_download procedure, connprocs
@subsubheading ftp_close Procedure
@findex ftp_close

Closes the FTP connection to a host.

@quotation
@t{@b{ftp_close} @i{host}}
@end quotation

@table @asis
@item @code{host}
The host connection to close.
@end table

@node tip_download procedure, , ftp_close procedure, connprocs
@subsubheading tip_download Procedure
@findex tip_download

@quotation
@t{@b{tip_download} @i{spawnid} @i{file}}
@end quotation

@table @asis

@item @code{spawnid}
Download @code{file} to the process @code{spawnid} (the value returned
when the connection was established), using the @code{~put} command
under tip.  Most often used for single board computers that require
downloading programs in ASCII S-records.  Returns @emph{1} if an error
occurs, @emph{0} otherwise.

@item @code{file}
This is the filename to download.
@end table

@node Procedures For Target Boards, target database library file, connprocs, Built-in Procedures
@section Procedures For Target Boards

@menu
* default_link Procedure: default_link procedure
* default_target_assemble Procedure: default_target_assemble procedure
* default_target_compile Procedure: default_target_compile procedure
* pop_config Procedure: pop_config procedure
* prune_warnings Procedure: prune_warnings procedure
* push_build Procedure: push_build procedure
* push_config Procedure: push_config procedure
* reboot_target Procedure: reboot_target procedure
* target_assemble Procedure: target_assemble procedure
* target_compile Procedure: target_compile procedure
@end menu

@node default_link procedure, default_target_assemble procedure, , Procedures For Target Boards
@subsubheading default_link Procedure
@findex default_link

@quotation
@t{@b{default_link} @i{board} @i{objects} @i{destfile} @i{flags}}
@end quotation

@table @asis
@item @code{board}
@item @code{objects}
@item @code{destfile}
@item @code{flags}
@end table

@node default_target_assemble procedure, default_target_compile procedure, default_link procedure, Procedures For Target Boards
@subsubheading default_target_assemble Procedure
@findex default_target_assemble

@quotation
@t{@b{default_target_assemble} @i{source} @i{destfile} @i{flags}}
@end quotation

@table @asis
@item @code{source}
@item @code{destfile}
@item @code{flags}
@end table

@node default_target_compile procedure, pop_config procedure, default_target_assemble procedure, Procedures For Target Boards
@subsubheading default_target_compile Procedure
@findex default_target_compile

@quotation
@t{@b{default_target_compile} @i{source} @i{destfile} @i{type}
@i{options}}
@end quotation

@table @asis
@item @code{source}
@item @code{destfile}
@item @code{type}
@item @code{options}
@end table

@node pop_config procedure, prune_warnings procedure, default_target_compile procedure, Procedures For Target Boards
@subsubheading pop_config Procedure
@findex pop_config

@quotation
@t{@b{pop_config} @i{type}}
@end quotation

@table @asis
@item @code{type}
@end table

@node prune_warnings procedure, push_build procedure, pop_config procedure, Procedures For Target Boards
@subsubheading prune_warnings Procedure
@findex prune_warnings

@quotation
@t{@b{prune_warnings} @i{text}}
@end quotation

@table @asis
@item @code{text}
@end table

@node push_build procedure, push_config procedure, prune_warnings procedure, Procedures For Target Boards
@subsubheading push_build Procedure
@findex push_build

@quotation
@t{@b{push_build} @i{name}}
@end quotation

@table @asis
@item @code{name}
@end table

@node push_config procedure, reboot_target procedure, push_build procedure, Procedures For Target Boards
@subsubheading push_config Procedure
@findex push_config

@quotation
@t{@b{push_config} @i{type} @i{name}}
@end quotation

@table @asis
@item @code{type}

@item @code{name}
@end table

@node reboot_target procedure, target_assemble procedure, push_config procedure, Procedures For Target Boards
@subsubheading reboot_target Procedure
@findex reboot_target

Reboot the target.

@quotation
@t{@b{reboot_target}}
@end quotation

@node target_assemble procedure, target_compile procedure, reboot_target procedure, Procedures For Target Boards
@subsubheading target_assemble Procedure
@findex target_assemble

@quotation
@t{@b{target_assemble} @i{source destfile flags}}
@end quotation

@table @asis
@item @code{source}
@item @code{destfile}
@item @code{flags}
@end table

@node target_compile procedure, , target_assemble procedure, Procedures For Target Boards
@subsubheading target_compile Procedure
@findex target_compile

@quotation
@t{@b{target_compile} @i{source} @i{destfile} @i{type} @i{options}}
@end quotation

@table @asis
@item @code{source}
@item @code{destfile}
@item @code{type}
@item @code{options}
@end table

@node target database library file, platform dependent procedures, Procedures For Target Boards, Built-in Procedures
@section Target Database Procedures

@menu
* board_info Procedure: board_info procedure
* host_info Procedure: host_info procedure
* set_board_info Procedure: set_board_info procedure
* add_board_info Procedure: add_board_info procedure
* set_currtarget_info Procedure: set_currtarget_info procedure
* target_info Procedure: target_info procedure
* unset_board_info Procedure: unset_board_info procedure
* unset_currtarget_info Procedure: unset_currtarget_info procedure
* push_target Procedure: push_target procedure
* pop_target Procedure: pop_target procedure
* push_host Procedure: push_host procedure
* pop_host Procedure: pop_host procedure
@end menu

@node board_info procedure, host_info procedure, , target database library file
@subsubheading board_info Procedure
@findex board_info

Searches the @code{board_info} array for the specified information.

@quotation
@t{@b{board_info} @i{machine} @i{op} @i{args}}
@end quotation

@table @asis
@item @code{machine}
@item @code{op}
@item @code{args}
@end table

@node host_info procedure, set_board_info procedure, board_info procedure, target database library file
@subsubheading host_info Procedure
@findex host_info

@quotation
@t{@b{host_info} @i{op} @i{args}}
@end quotation

@table @asis
@item @code{op}
@item @code{args}
@end table

@node set_board_info procedure, add_board_info procedure, host_info procedure, target database library file
@subsubheading set_board_info Procedure
@findex set_board_info

This checks if the @code{board_info} array entry has been set already
and, if not, sets it to given value.

@quotation
@t{@b{set_board_info} @i{entry} @i{value}}
@end quotation

@table @asis
@item @code{entry}
Field of the @code{board_info} to set.

@item @code{value}
Value to set the field to.
@end table

@node add_board_info procedure, set_currtarget_info procedure, set_board_info procedure, target database library file
@subsubheading add_board_info Procedure
@findex add_board_info

This treats @code{board_info} array's field @emph{entry} as a TCL list
and adds @emph{value} at the end.

@quotation
@t{@b{add_board_info} @i{entry} @i{value}}
@end quotation

@table @asis

@item @code{entry}
The name of a @code{board_info} field to operate on.

@item @code{value}
The value to add to the field.
@end table

@node set_currtarget_info procedure, target_info procedure, add_board_info procedure, target database library file
@subsubheading set_currtarget_info Procedure
@findex set_currtarget_info

@quotation
@t{@b{set_currtarget_info} @i{entry} @i{value}}
@end quotation

@table @asis
@item @code{entry}
@item @code{value}
@end table

@node target_info procedure, unset_board_info procedure, set_currtarget_info procedure, target database library file
@subsubheading target_info Procedure
@findex target_info

@quotation
@t{@b{target_info} @i{op} @i{args}}
@end quotation

@table @asis
@item @code{op}
@item @code{args}
@end table

@node unset_board_info procedure, unset_currtarget_info procedure, target_info procedure, target database library file
@subsubheading unset_board_info Procedure
@findex unset_board_info

This checks if @code{board_info} array's field @emph{entry} has been
set and if so, then removes it.

@quotation
@t{@b{unset_board_info} @i{entry}}
@end quotation

@table @asis
@item @code{entry}
The name of a @code{board_info} field to operate on.
@end table

@node unset_currtarget_info procedure, push_target procedure, unset_board_info procedure, target database library file
@subsubheading unset_currtarget_info Procedure
@findex unset_currtarget_info

@quotation
@t{@b{unset_currtarget_info} @i{entry}}
@end quotation

@table @asis
@item @code{entry}
@end table

@node push_target procedure, pop_target procedure, unset_currtarget_info procedure, target database library file
@subsubheading push_target Procedure
@findex push_target

This makes the target named @emph{name} be the current target
connection.

@quotation
@t{@b{push_target} @i{name}}
@end quotation

@table @asis
@item @code{name}
Name of the target to make the current connection.
@end table

@node pop_target procedure, push_host procedure, push_target procedure, target database library file
@subsubheading pop_target Procedure
@findex pop_target

This unsets the current target connection.

@quotation
@t{@b{pop_target}}
@end quotation

@node push_host procedure, pop_host procedure, pop_target procedure, target database library file
@subsubheading push_host Procedure
@findex push_host

This procedure makes the host named @emph{name} be the current remote
host connection.

@quotation
@t{@b{push_host} @i{name}}
@end quotation

@table @asis
@item @code{name}
Name of the host to make the current connection.
@end table

@node pop_host procedure,  , push_host procedure, target database library file
@subsubheading pop_host Procedure
@findex pop_host

This unsets the current host connection.

@quotation
@t{@b{pop_host}}
@end quotation

@node platform dependent procedures, Utility Procedures, target database library file, Built-in Procedures
@section Platform Dependent Procedures

Each combination of target and tool requires some target-dependent
procedures.  The names of these procedures have a common form: the
tool name, followed by an underscore @emph{_}, and finally a suffix
describing the procedure's purpose.  For example, a procedure to
extract the version from GDB is called @code{gdb_version}.

@code{runtest} itself calls only two of these procedures,
@code{$@{tool@}_exit} and @code{$@{tool@}_version}; these procedures
use no arguments.

The other two procedures, @code{$@{tool@}_start} and
@code{$@{tool@}_load}, are only called by the test suites themselves
(or by testsuite-specific initialization code); they may take
arguments or not, depending on the conventions used within each
testsuite.

The usual convention for return codes from any of these procedures
(although it is not required by @code{runtest}) is to return @emph{0}
if the procedure succeeded, @emph{1} if it failed, and @emph{-1} if
there was a communication error.

@menu
* $@{tool@}_start Procedure: $@{tool@}_start procedure
* $@{tool@}_load Procedure: $@{tool@}_load procedure
* $@{tool@}_exit Procedure: $@{tool@}_exit procedure
* $@{tool@}_version Procedure: $@{tool@}_version procedure
@end menu

@node $@{tool@}_start procedure, $@{tool@}_load procedure, , platform dependent procedures
@subsubheading $@{tool@}_start Procedure
@findex $@{tool@}_start

Starts a particular tool.  For an interactive tool,
@code{$@{tool@}_start} starts and initializes the tool, leaving the
tool up and running for the test cases; an example is
@code{gdb_start}, the start function for GDB.  For a batch-oriented
tool, @code{$@{tool@}_start} is optional; the recommended convention
is to let @code{$@{tool@}_start} run the tool, leaving the output in a
variable called @code{comp_output}.  Test scripts can then analyze
@code{$comp_output} to determine the test results.  An example of this
second kind of start function is @code{gcc_start}, the start function
for GCC.

DejaGnu itself does not call @code{$@{tool@}_start}.  The
initialization module @code{$@{tool@}_init.exp} must call
@code{$@{tool@}_start} for interactive tools; for batch-oriented
tools, each individual test script calls @code{$@{tool@}_start} (or
makes other arrangements to run the tool).

@quotation
@t{@b{$@{tool@}_start}}
@end quotation

@node $@{tool@}_load procedure, $@{tool@}_exit procedure, $@{tool@}_start procedure, platform dependent procedures
@subsubheading $@{tool@}_load Procedure
@findex $@{tool@}_load

Loads something into a tool.  For an interactive tool, this conditions
the tool for a particular test case; for example, @code{gdb_load}
loads a new executable file into the debugger.  For batch-oriented
tools, @code{$@{tool@}_load} may do nothing---though, for example, the
GCC support uses @code{gcc_load} to load and run a binary on the
target environment.  Conventionally, @code{$@{tool@}_load} leaves the
output of any program it runs in a variable called
@code{$exec_output}.  Writing @code{$@{tool@}_load} can be the most
complex part of extending DejaGnu to a new tool or a new target, if it
requires much communication coding or file downloading.  Test scripts
call @code{$@{tool@}_load}.

@quotation
@t{@b{$@{tool@}_load}}
@end quotation

@node $@{tool@}_exit procedure, $@{tool@}_version procedure, $@{tool@}_load procedure, platform dependent procedures
@subsubheading $@{tool@}_exit Procedure
@findex $@{tool@}_exit

Cleans up (if necessary) before DejaGnu exits.  For interactive tools,
this usually ends the interactive session.  You can also use
@code{$@{tool@}_exit} to remove any temporary files left over from the
tests.  @code{runtest} calls @code{$@{tool@}_exit}.

@quotation
@t{@b{$@{tool@}_exit}}
@end quotation

@node $@{tool@}_version procedure, , $@{tool@}_exit procedure, platform dependent procedures
@subsubheading $@{tool@}_version Procedure
@findex $@{tool@}_version

Prints the version label and number for @code{$@{tool@}}.  This is
called by the DejaGnu procedure that prints the final summary report.
The output should consist of the full path name used for the tested
tool, and its version number.

@quotation
@t{@b{$@{tool@}_version}}
@end quotation

@node Utility Procedures, Libgloss, platform dependent procedures, Built-in Procedures
@section Utility Procedures

@menu
* getdirs Procedure: getdirs procedure
* relative_filename Procedure: relative_filename procedure
* find Procedure: find procedure
* which Procedure: which procedure
* grep Procedure: grep procedure
* prune Procedure: prune procedure
* runtest_file_p Procedure: runtest_file_p procedure
* diff Procedure: diff procedure
* setenv Procedure: setenv procedure
* unsetenv Procedure: unsetenv procedure
* getenv Procedure: getenv procedure
@end menu

@node getdirs procedure, relative_filename procedure, Utility Procedures, Utility Procedures
@subsubheading getdirs Procedure
@findex getdirs

Returns a list of all the subdirectories in a single directory that
match a glob pattern.  If no directories match the pattern, then an
empty list is returned.

This procedure is specialized as a search for tests in testsuites:
@code{getdirs} ignores directories named @samp{testsuite},
@samp{config}, or @samp{lib}, and also ignores directories associated
with a few revision control systems, specifically Git (@samp{.git}),
Subversion (@samp{.svn}), CVS (@samp{CVS}), RCS (@samp{RCS}), and SCCS
(@samp{SCCS}).  These ignored directories will not appear in the
returned list, nor will they be examined in a recursive search.

@quotation
@t{@b{getdirs} @i{-all} @i{rootdir} @i{pattern}}
@end quotation

@table @asis

@item @code{-all}
If this option is given, then subdirectories will be matched
recursively.

@item @code{rootdir}
The top level directory to start the search from.

@item @code{pattern}
The Tcl glob pattern to match.  If you do not specify @code{pattern},
@code{getdirs} uses a default pattern of @code{*}.

@end table

@node relative_filename procedure, find procedure, getdirs procedure, Utility Procedures
@subsubheading relative_filename Procedure
@findex relative_filename

Return a relative file name, given a starting point.

@quotation
@t{@b{relative_filename} @i{base} @i{destination}}
@end quotation

@table @asis

@item @code{base}
The starting point for relative file name traversal.

@item @code{destination}
The absolute file name that should be reached by appending the return
value to @i{base}.
@end table

@node find procedure, which procedure, relative_filename procedure, Utility Procedures
@subsubheading find Procedure
@findex find

Search for files whose names match a glob pattern.  Search
subdirectories recursively, starting at a particular root directory.
The result is the list of files whose names match.  Filenames in the
result include all intervening subdirectory names.  If no files match
the pattern, then an empty string is returned.

@quotation
@t{@b{find} @i{rootdir} @i{pattern}}
@end quotation

@table @asis
@item @code{rootdir}
The top level directory to start the search from.

@item @code{pattern}
A glob pattern representing the files to find.
@end table

@node which procedure, grep procedure, find procedure, Utility Procedures
@subsubheading which Procedure
@findex which

Searches the execution path for an executable file like the BSD
@code{which(1)} utility.  This procedure uses the shell environment
variable @code{PATH}.  It returns @b{0} if the binary is not in the
path or if the @code{PATH} environment variable is not set.  If the
file is in the path, this procedure returns the full path to the file.

@quotation
@t{@b{which} @i{file}}
@end quotation

@table @asis
@item @code{file}
The executable program or shell script to look for.
@end table

@node grep procedure, prune procedure, which procedure, Utility Procedures
@subsubheading grep Procedure
@findex grep

Search a named file for lines that contain a match for a regular
expression.  The result is a list of all the lines that match.  If no
lines match, the result is an empty string.  All of the Tcl regular
expression syntax is supported.

@quotation
@t{@b{grep} @i{-n} @i{filename} @i{regexp} @b{line}}
@end quotation

@table @asis
@item @code{-n}
The @code{-n} option prefixes matched lines in the result with the
line number, just like GNU @code{grep} does.  This option should be
used in preference to the @code{line} keyword documented below.

@item @code{filename}
The file to search.

@item @code{regexp}
The Unix style regular expression (as used by the @code{grep} UNIX
utility) to search for.

@item @code{line}
Use the optional keyword @code{line} to prefix matched lines in the
result with the line number.  This usage is deprecated.
@end table

@node prune procedure, runtest_file_p procedure, grep procedure, Utility Procedures
@subsubheading prune Procedure
@findex prune

This procedure is deprecated and will be removed in a future release
of DejaGnu.  If a testsuite uses this procedure, a copy of the
procedure should be made and placed in the @file{lib} directory of the
testsuite.

@node runtest_file_p procedure, diff procedure, prune procedure, Utility Procedures
@subsubheading runtest_file_p Procedure
@findex runtest_file_p

Search @emph{runtest}s for @emph{testcase} and return @b{1} if found,
@b{0} if not.  This is used by tools like compilers where each
testcase is a file.

@quotation
@t{@b{runtest_file_p} @i{runtests} @i{testcase}}
@end quotation

@table @asis
@item @code{runtests}

@code{runtests} is a list of two elements.  The second is a copy of
what was on the right side of the @code{=} if @code{foo.exp="..."} was
specified, or an empty string if no such argument is present.

@item @code{testcase}
The filename of the current testcase under consideration.
@end table

@node diff procedure, setenv procedure, runtest_file_p procedure, Utility Procedures
@subsubheading diff Procedure
@findex diff

Compares two files and returns @b{1} if they match (no differences) or
@b{0} if not.  If @code{verbose} is set, then it will print the
differences to the console.

@quotation
@t{@b{diff} @i{file1} @i{file2}}
@end quotation

@table @asis
@item @code{file1}
First file for the comparison.

@item @code{file2}
Second file for the comparison.
@end table

@node setenv procedure, unsetenv procedure, diff procedure, Utility Procedures
@subsubheading setenv Procedure
@findex setenv

Set an environment variable.

@quotation
@t{@b{setenv} @i{var} @i{val}}
@end quotation

@table @asis
@item @code{var}
The environment variable to set.

@item @code{val}
The value to set the variable to.
@end table

@node unsetenv procedure, getenv procedure, setenv procedure, Utility Procedures
@subsubheading unsetenv Procedure
@findex unsetenv

Unset an environment variable.

@quotation
@t{@b{unsetenv} @i{var} }
@end quotation

@table @asis
@item @code{var}
The environment variable to unset.
@end table

@node getenv procedure,  , unsetenv procedure, Utility Procedures
@subsubheading getenv Procedure
@findex getenv

Returns the value of the envrionment variable @emph{var} if it is
defined, otherwise an empty string is returned.

@quotation
@t{@b{getenv} @i{var} }
@end quotation

@table @asis
@item @code{var}
Environment variable to retrieve.
@end table

@node Libgloss, Debugging Procedures, Utility Procedures, Built-in Procedures
@section Libgloss, a free board support package (BSP)

Libgloss is a free board support package @dfn{BSP} commonly used with
GCC and G++ to produce a fully linked executable image for an embedded
systems.

@menu
* libgloss_link_flags Procedure: libgloss_link_flags procedure
* libgloss_include_flags Procedure: libgloss_include_flags procedure
* newlib_link_flags Procedure: newlib_link_flags procedure
* newlib_include_flags Procedure: newlib_include_flags procedure
* libio_include_flags Procedure: libio_include_flags procedure
* libio_link_flags Procedure: libio_link_flags procedure
* g++_include_flags Procedure: g++_include_flags procedure
* g++_link_flags Procedure: g++_link_flags procedure
* libstdc++_include_flags Procedure: libstdc++_include_flags procedure
* libstdc++_link_flags Procedure: libstdc++_link_flags procedure
* get_multilibs Procedure: get_multilibs procedure
* find_binutils_prog Procedure: find_binutils_prog procedure
* find_gcc Procedure: find_gcc procedure
* find_gcj Procedure: find_gcj procedure
* find_g++ Procedure: find_g++ procedure
* find_g77 Procedure: find_g77 procedure
* find_gfortran Procedure: find_gfortran procedure
* process_multilib_options Procedure: process_multilib_options procedure
* add_multilib_option Procedure: add_multilib_option procedure
* find_gas Procedure: find_gas procedure
* find_ld Procedure: find_ld procedure
* build_wrapper Procedure: build_wrapper procedure
* winsup_include_flags Procedure: winsup_include_flags procedure
* winsup_link_flags Procedure: winsup_link_flags procedure
@end menu

@node libgloss_link_flags procedure, libgloss_include_flags procedure, , Libgloss
@subsubheading libgloss_link_flags Procedure
@findex libgloss_link_flags

Finds the pieces of @code{libgloss} needed to link a set of object
files into an executable.  This usually means setting the @code{-L}
and @code{-B} paths correctly.

@quotation
@t{@b{libgloss_link_flags} @i{args} }
@end quotation

@table @asis
@item @code{args}
Ignored.
@end table

@node libgloss_include_flags procedure, newlib_link_flags procedure, libgloss_link_flags procedure, Libgloss
@subsubheading libgloss_include_flags Procedure
@findex libgloss_include_flags

This procedure always returns an empty string.  It is provided for
consistency.

@quotation
@t{@b{libgloss_include_flags} @i{args}}
@end quotation

@table @asis
@item @code{args}
Ignored.
@end table

@node newlib_link_flags procedure, newlib_include_flags procedure, libgloss_include_flags procedure, Libgloss
@subsubheading newlib_link_flags Procedure
@findex newlib_link_flags

Return the options needed to link an executable with @code{newlib}.
This usually means setting the @code{-L} and @code{-B} paths
correctly.

@quotation
@t{@b{newlib_link_flags} @i{args}}
@end quotation

@table @asis
@item @code{args}
Ignored.
@end table

@node newlib_include_flags procedure, libio_include_flags procedure, newlib_link_flags procedure, Libgloss
@subsubheading newlib_include_flags Procedure
@findex newlib_include_flags

Return the options needed to locate the @code{newlib} header files.

@quotation
@t{@b{newlib_include_flags} @i{args}}
@end quotation

@table @asis
@item @code{args}
Ignored.
@end table

@node libio_include_flags procedure, libio_link_flags procedure, newlib_include_flags procedure, Libgloss
@subsubheading libio_include_flags Procedure
@findex libio_include_flags

@quotation
@t{@b{libio_include_flags} @i{args}}
@end quotation

Return the options needed to locate the @code{libio} header files.

@table @asis
@item @code{args}
Ignored.
@end table

@node libio_link_flags procedure, g++_include_flags procedure, libio_include_flags procedure, Libgloss
@subsubheading libio_link_flags Procedure
@findex libio_link_flags

@quotation
@t{@b{libio_link_flags} @i{args}}
@end quotation

Return the options needed to link an executable with @code{libio}.
This usually means setting the @code{-L} and @code{-B} paths
correctly.

@table @asis
@item @code{args}
Ignored.
@end table

@node g++_include_flags procedure, g++_link_flags procedure, libio_link_flags procedure, Libgloss
@subsubheading g++_include_flags Procedure
@findex g++_include_flags

Return the options needed to locate the C++ stnadard library header
files.

@quotation
@t{@b{g++_include_flags} @i{args}}
@end quotation

@table @asis
@item @code{args}
Ignored.
@end table

@node g++_link_flags procedure, libstdc++_include_flags procedure, g++_include_flags procedure, Libgloss
@subsubheading g++_link_flags Procedure
@findex g++_link_flags

@quotation
@t{@b{g++_link_flags} @i{args}}
@end quotation

Return the options needed to link an executable with @code{libg++}.
This usually means setting the @code{-L} and @code{-B} paths
correctly.

@table @asis
@item @code{args}
Ignored.
@end table

@node libstdc++_include_flags procedure, libstdc++_link_flags procedure, g++_link_flags procedure, Libgloss
@subsubheading libstdc++_include_flags Procedure
@findex libstdc++_include_flags

@quotation
@t{@b{libstdc++_include_flags} @i{args}}
@end quotation

Return the options needed to locate the C++ stnadard library header
files.

@table @asis
@item @code{args}
Ignored.
@end table

@node libstdc++_link_flags procedure, get_multilibs procedure, libstdc++_include_flags procedure, Libgloss
@subsubheading libstdc++_link_flags Procedure
@findex libstdc++_link_flags

@quotation
@t{@b{libstdc++_link_flags} @i{args}}
@end quotation

@table @asis
@item @code{args}
@end table

@node get_multilibs procedure, find_binutils_prog procedure, libstdc++_link_flags procedure, Libgloss
@subsubheading get_multilibs Procedure
@findex get_multilibs

@quotation
@t{@b{get_multilibs} @i{args}}
@end quotation

@table @asis
@item @code{args}
@end table

@node find_binutils_prog procedure, find_gcc procedure, get_multilibs procedure, Libgloss
@subsubheading find_binutils_prog Procedure
@findex find_binutils_prog

@quotation
@t{@b{find_binutils_prog} @i{name}}
@end quotation

@table @asis
@item @code{name}
@end table

@node find_gcc procedure, find_gcj procedure, find_binutils_prog procedure, Libgloss
@subsubheading find_gcc Procedure
@findex find_gcc

Looks for a copy of the GNU C compiler in the build tree and in the
@code{PATH}.  This will also return the proper transformed name for a
cross-compiler if the build tree is configured for one.

@quotation
@t{@b{find_gcc}}
@end quotation

@node find_gcj procedure, find_g++ procedure, find_gcc procedure, Libgloss
@subsubheading find_gcj Procedure
@findex find_gcj

Looks for a copy of the GNU Java compiler in the build tree and in the
@code{PATH}.  This will also return the proper transformed name for a
cross-compiler if the build tree is configured for one.

@quotation
@t{@b{find_gcj}}
@end quotation

@node find_g++ procedure, find_g77 procedure, find_gcj procedure, Libgloss
@subsubheading find_g++ Procedure
@findex find_g++

Looks for a copy of the GNU C++ compiler in the build tree and in the
@code{PATH}.  This will also return the proper transformed name for a
cross-compiler if the build tree is configured for one.

@quotation
@t{@b{find_g++}}
@end quotation

@node find_g77 procedure, find_gfortran procedure, find_g++ procedure, Libgloss
@subsubheading find_g77 Procedure
@findex find_g77

Looks for a copy of the GNU Fortran 77 compiler in the build tree and
in the @code{PATH}.  This will also return the proper transformed name
for a cross-compiler if the build tree is configured for one.

@quotation
@t{@b{find_g77}}
@end quotation

@node find_gfortran procedure, process_multilib_options procedure, find_g77 procedure, Libgloss
@subsubheading find_gfortran Procedure
@findex find_gfortran

Looks for a copy of the GNU Fortran compiler in the build tree and in
the @code{PATH}.  This will also return the proper transformed name
for a cross-compiler if the build tree is configured for one.

@quotation
@t{@b{find_gfortran}}
@end quotation

@node process_multilib_options procedure, add_multilib_option procedure, find_gfortran procedure, Libgloss
@subsubheading process_multilib_options Procedure
@findex process_multilib_options

@quotation
@t{@b{process_multilib_options} @i{args}}
@end quotation

@table @asis
@item @code{args}
@end table

@node add_multilib_option procedure, find_gas procedure, process_multilib_options procedure, Libgloss
@subsubheading add_multilib_option Procedure
@findex add_multilib_option

@quotation
@t{@b{add_multilib_option} @i{args}}
@end quotation

@table @asis
@item @code{args}
@end table

@node find_gas procedure, find_ld procedure, add_multilib_option procedure, Libgloss
@subsubheading find_gas Procedure
@findex find_gas

@quotation
@t{@b{find_gas}}
@end quotation

@node find_ld procedure, build_wrapper procedure, find_gas procedure, Libgloss
@subsubheading find_ld Procedure
@findex find_ld

@quotation
@t{@b{find_ld}}
@end quotation

@node build_wrapper procedure, winsup_include_flags procedure, find_ld procedure, Libgloss
@subsubheading build_wrapper Procedure
@findex build_wrapper

@quotation
@t{@b{build_wrapper} @i{gluefile}}
@end quotation

@table @asis
@item @code{gluefile}
@end table

@node winsup_include_flags procedure, winsup_link_flags procedure, build_wrapper procedure, Libgloss
@subsubheading winsup_include_flags Procedure
@findex winsup_include_flags

@quotation
@t{@b{winsup_include_flags} @i{args}}
@end quotation

@table @asis
@item @code{args}
@end table

@node winsup_link_flags procedure, , winsup_include_flags procedure, Libgloss
@subsubheading winsup_link_flags Procedure
@findex winsup_link_flags

@quotation
@t{@b{winsup_link_flags} @i{args}}
@end quotation

@table @asis
@item @code{args}
@end table

@node Debugging Procedures, , Libgloss, Built-in Procedures
@section Procedures for debugging your scripts

@menu
* bt Procedure: bt procedure
* dumpvars Procedure: dumpvars procedure
* dumplocals Procedure: dumplocals procedure
* dumprocs Procedure: dumprocs procedure
* dumpwatch Procedure: dumpwatch procedure
* watcharray Procedure: watcharray procedure
* watchvar Procedure: watchvar procedure
* watchunset Procedure: watchunset procedure
* watchwrite Procedure: watchwrite procedure
* watchread Procedure: watchread procedure
* watchdel Procedure: watchdel procedure
* print Procedure: print procedure
* quit Procedure: quit procedure
@end menu

@node bt procedure, dumpvars procedure, Debugging Procedures, Debugging Procedures
@subsubheading bt Procedure
@findex bt

This procedure prints a backtrace using the @code{w} command from the
Tcl debugger.

@quotation
@t{@b{bt}}
@end quotation

@node dumpvars procedure, dumplocals procedure, bt procedure, Debugging Procedures
@subsubheading dumpvars Procedure
@findex dumpvars
@c abbrev: dv

This procedure prints the values of the global variables that match a
glob pattern.  Abbreviation: @kbd{dv}.

@quotation
@t{@b{dumpvars} @i{pattern}}
@end quotation

@table @asis
@item @code{pattern}
The global variables to dump.
@end table

@node dumplocals procedure, dumprocs procedure, dumpvars procedure, Debugging Procedures
@subsubheading dumplocals Procedure
@findex dumplocals
@c abbrev: dl

This procedure prints the values of local variables that match a glob
pattern.  Abbreviation: @kbd{dl}.

@quotation
@t{@b{dumplocals} @i{pattern} }
@end quotation

@table @asis
@item @code{pattern}
The local variables to dump.
@end table

@node dumprocs procedure, dumpwatch procedure, dumplocals procedure, Debugging Procedures
@subsubheading dumprocs Procedure
@findex dumprocs
@c abbrev: dp

This procedure dumps the body of all procs that match a glob pattern.
It is abbreviated as @kbd{dp}.

@quotation
@t{@b{dumprocs} @i{pattern}}
@end quotation

@table @asis
@item @code{pattern}
The proc bodies to dump.
@end table

@node dumpwatch procedure, watcharray procedure, dumprocs procedure, Debugging Procedures
@subsubheading dumpwatch Procedure
@findex dumpwatch
@c abbrev: dw

This procedure prints all of the watchpoints matching a glob pattern.
It is abbreviated as @kbd{dw}.

@quotation
@t{@b{dumpwatch} @i{pattern}}
@end quotation

@table @asis
@item @code{pattern}
The watchpoints to dump.
@end table

@node watcharray procedure, watchvar procedure, dumpwatch procedure, Debugging Procedures
@subsubheading watcharray Procedure
@findex watcharray

@quotation
@t{@b{watcharray} @i{array} @i{element} @i{type}}
@end quotation

@table @asis
@item @code{array}

@item @code{element}

@item @code{type}
The csh "glob" style pattern to look for.
@end table

@node watchvar procedure, watchunset procedure, watcharray procedure, Debugging Procedures
@subsubheading watchvar Procedure
@findex watchvar

@quotation
@t{@b{watchvar} @i{var} @i{type}}
@end quotation

@table @asis
@item @code{var}

@item @code{type}
@end table

@node watchunset procedure, watchwrite procedure, watchvar procedure, Debugging Procedures
@subsubheading watchunset Procedure
@findex watchunset
@c abbrev: wu

This breaks program execution when the variable @code{var} is unset.
Abbreviation: @kbd{wu}.

@quotation
@t{@b{watchunset} @i{pattern}}
@end quotation

@table @asis
@item @code{pattern}
@end table

@node watchwrite procedure, watchread procedure, watchunset procedure, Debugging Procedures
@subsubheading watchwrite Procedure
@findex watchwrite
@c abbrev: ww

This breaks program execution when the variable @code{var} is written.
Abbreviation: @kbd{ww}.

@quotation
@t{@b{watchwrite} @i{var}}
@end quotation

@table @asis
@item @code{var}
The variable to watch.
@end table

@node watchread procedure, watchdel procedure, watchwrite procedure, Debugging Procedures
@subsubheading watchread Procedure
@findex watchread
@c abbrev: wr

This breaks program execution when the variable @code{var} is read.
Abbreviation: @kbd{wr}.

@quotation
@t{@b{watchread} @i{var}}
@end quotation

@table @asis
@item @code{var}
The variable to watch.
@end table

@node watchdel procedure, print procedure, watchread procedure, Debugging Procedures
@subsubheading watchdel Procedure
@findex watchdel
@c abbrev: wd

This deletes a watchpoint from the watch list.  Abbreviation:
@kbd{wd}.

@quotation
@t{@b{watchdel} @i{pattern}}
@end quotation

@table @asis
@item @code{pattern}
@end table

@node print procedure, quit procedure, watchdel procedure, Debugging Procedures
@subsubheading print Procedure
@findex print

This prints the value of a variable.  Abbreviation: @kbd{p}.

@quotation
@t{@b{print} @i{var}}
@end quotation

@table @asis
@item @code{var}
The variable to print.
@end table

@node quit procedure, , print procedure, Debugging Procedures
@subsubheading quit Procedure
@findex quit

This makes @code{runtest} exit.  Abbreviation: @kbd{q}.

@quotation
@t{@b{quit}}
@end quotation

@node GNU Free Documentation License, Concept Index, Built-in Procedures, Top
@appendix GNU Free Documentation License
@include fdl.texi

@node Concept Index, Procedure Index, GNU Free Documentation License, Top
@unnumbered Concept Index
@printindex cp

@node Procedure Index, Variable Index, Concept Index, Top
@unnumbered Procedure Index
@printindex fn

@node Variable Index, , Procedure Index, Top
@unnumbered Variable Index
@printindex vr

@bye

@c  LocalWords:  subdirectory prepend prepended testsuite filename Expect's svn
@c  LocalWords:  DejaGnu CVS RCS SCCS prepending subcommands Tcl Awk Readline
@c  LocalWords:  POSIX KFAIL KPASS XFAIL XPASS hostname