Pristine Ack-5.5
[Ack-5.5.git] / emtest / READ_ME
1 This directory contains test programs for EM implementations.
2 The test programs are all part of the file "tests".
3 Each individual test program looks like:
4
5         TEST 004: test ...
6          ...            ; data declarations etc.
7         MAIN nlocal
8          ...            ; part of the body of MAIN
9         PROC
10          ...            ; subroutines used by this test
11
12 The PROC part is optional, so the smallest test program looks like:
13
14         TEST 000: null test
15         MAIN 0
16
17 The keywords used by "select", like TEST, MAIN, PROC, HOL, OK and ERRLAB,
18 all consist of upper case letters and start in column one.
19 A convention for test numbers is to use 3 digit numbers, possibly left
20 padded with zero's.
21
22 A program, called "select", is provided to combine a range of tests
23 into a single test program.
24 "Select" expects a range as argument, like 0-127, or -127, or 0-.
25 Tests that have a TEST number in that range are included.
26 "Select" also expects the file from which the tests should
27 be selected as an argument.
28 If no argument is given, or only a range argument, select expects
29 the tests to slect from on standard input.
30
31 To prevent name clashes, some rules must be obeyed:
32    - data label names, procedure names and instruction label numbers
33      must be unique over all tests. A good habit is to use the
34      three digit test number as suffix.
35    - only keyword of "select" may start with uppercase letters in column
36      one, to allow for expansion in the future.
37    - because only a single 'hol' pseudo is allowed, "select" must
38      generate the 'hol' pseudo. An individual test may request
39      some 'hol' space by a special HOL line, starting in column one
40      and followed by a single number, the number of bytes needed.
41      This number must consists of digits only, no constant symbols,
42      because "select" must compute the maximum, so before the
43      preprocessor has replaced the constant symbols by their values.
44    - a similar problem is caused by the number of bytes of local
45      storage for 'main'. An individual test may specify the number
46      of bytes it needs as parameter to the MAIN line.
47      Again, the number must consist of digits only.
48
49 Test programs print a sequence of integers greater than 1.
50 This sequence is terminated by the number 1 as soon as an error is detected.
51 If all tests are performed correctedly the number 0 is printed.
52
53 To allow test programs to print integers without the full machinery of
54 conversion and i/o routines, the EM instruction 'nop' is used.
55 Each time this instruction is executed, the current line number as
56 maintained by the 'lin' instruction must be printed, followed by a
57 newline, at least during debugging.
58
59 The following abbrevation may be used in test programs:
60
61         OK      ->      lin n
62                         nop
63
64 Numbers are automatically assigned in order of static appearance.
65 As soon as an error is detected you must branch to label 1, by instructions
66 like 'bra *1' and 'zne *1'.
67 Label 1 is automatically provided in the main routine.
68 If you jump to label 1 in a subroutine, then that subroutine must
69 end with ERRLAB, like in:
70
71         PROC
72          pro $test,0
73          ...
74          bra *1
75          ...
76          ret 0
77         ERRLAB
78          end
79
80 An option to "select" is to generate 'fil' instructions whenever a
81 new test starts.
82 This is useful if 'nop' prints the 'fil' string as well as the 'lin' number.
83 This 'f' option is on by default, off if a '-f' flag is given.
84
85 The EM file generated by "select" includes "test.h".
86 "test.h" may contain definitions of the following symbols:
87         W2S:    the size of double precision integers, if implemented.
88         FS:     the size of single precision floats, if implemented.
89         F2S:    the size of double precision floats, if implemented.
90 The value of these symbols, if defined, must be the size of the object involved.
91
92 Two other symbols are used:
93         EM_PSIZE:       pointer size
94         EM_WSIZE:       word size
95 The machine dependent translation program, like 8086 and vax2, give
96 definitions of these symbols while calling the EM encode program.
97 Because these size names occur quite often, they may be abbreviated:
98         WS      ->      EM_WSIZE
99         PS      ->      EM_PSIZE
100
101 Before running the tests in the file "tests", it is wise to test
102 the necessary basic functions with some simple tests like
103
104         TEST 000: null
105         MAIN 0
106 and
107         TEST 001: ok
108         MAIN 0
109         OK
110 and
111         TEST 998: error
112         MAIN 0
113          bra *1
114 and
115         TEST 999: test lni
116         MAIN 0
117          lin 1
118          lni
119          loe 0
120          loc 2
121          bne *1
122         OK
123 The first two of these are part of "tests" as well. The last two are
124 not included in "tests" intensionally, because they would fail.
125 The last tests fails because it references the ABS block which is
126 inaccessable after an 'hol' pseudo.
127 Proceed as follows for each of these basic tests:
128  - make a file called 'basic' containing the test
129  - run select:
130         select basic >basic.e
131  - compile by
132         machine basic.e
133  - and load and run
134
135    where machine should be replaced by the name of program
136    used to compile EM programs for the current machine.