@@ -4,36 +4,41 @@ This is the top-level directory for tests imported from
4
4
[ GCC] ( https://github.com/gcc-mirror/gcc ) . The test files are contained within
5
5
two subdirectories:
6
6
7
- - `regression`: Contains the gfortran [tests](https://github.com/gcc-mirror/gcc/tree/master/gcc/testsuite/gfortran.dg).
8
- - `torture`: Contains the gfortran [torture tests](https://github.com/gcc-mirror/gcc/tree/master/gcc/testsuite/gfortran.fortran-torture).
7
+ - ` regression ` : Contains the gfortran [ tests] ( https://github.com/gcc-mirror/gcc/tree/master/gcc/testsuite/gfortran.dg ) .
8
+ - ` torture ` : Contains the gfortran [ torture tests] ( https://github.com/gcc-mirror/gcc/tree/master/gcc/testsuite/gfortran.fortran-torture ) .
9
9
10
10
The tests in both ` regression ` (and its subdirectories) and ` torture ` can be
11
11
classified roughly as _ compile_ tests and _ execute_ tests. The _ compile_ tests
12
12
generally check the compiler's error/warning messages and, in some cases,
13
13
optimization logs. The _ execute_ tests are end-to-end tests that check the
14
14
behavior of the binary produced by the compiler.
15
15
16
- Currently, only the _ execute_ tests are supported in ` regression ` . Both
16
+ Currently, only the _ execute_ tests are supported in ` regression ` . Both
17
17
` compile ` and ` execute ` tests have been enabled in ` torture ` .
18
18
19
19
Of the supported tests, a number of tests have been disabled. There are four
20
20
categories of such tests:
21
21
22
- - *Unsupported*: These are tests that use non-standard extensions/intrinsics
23
- that are not currently supported by flang. Unless those non-standard
24
- features are supported in the future, these tests will never be enabled.
22
+ - * Unsupported* : These are tests that use non-standard extensions/intrinsics
23
+ that are not currently supported by flang. Unless those non-standard
24
+ features are supported in the future, these tests will never be enabled.
25
25
26
- - *Unimplemented*: These tests hit a "not yet implemented" assertion within
27
- flang.
26
+ - * Unimplemented* : These tests hit a "not yet implemented" assertion within
27
+ flang.
28
28
29
- - *Skipped*: These tests cause some form of compiler error. Some trigger an
30
- assertion within the compiler. Others are legal Fortran programs, but
31
- nevertheless cause a semantic error, most likely due to unimplemented
32
- features.
29
+ - * Skipped* : These tests cause some form of compiler error. Some trigger an
30
+ assertion within the compiler. Others are legal Fortran programs, but
31
+ nevertheless cause a semantic error, most likely due to unimplemented
32
+ features.
33
33
34
- - *Failing*: These tests fail at runtime - some crash on execution, others
35
- produce incorrect/unexpected output. This could be a result of a bug in the
36
- compiler/code generator or the runtime.
34
+ - * Failing* : These tests fail at test-time.
35
+
36
+ - For "execute" tests, some crash on execution, others produce
37
+ incorrect/unexpected output. This could be a result of a bug in the
38
+ compiler/code generator or the runtime.
39
+
40
+ - For "compile" tests, this could be because the compilation succeeds when it
41
+ is expected to fail, or vice versa.
37
42
38
43
Over time, the number of tests in the * unimplemented* , * skipped* , and * failing*
39
44
categories should decrease. Eventually, only the * unsupported* category should
@@ -42,8 +47,8 @@ remain.
42
47
43
48
### _ Compile_ tests ###
44
49
45
- The _ compile_ tests are "built" when the whole test suite is built at which
46
- time a compilation log is saved. At testing time, the log is checked to
50
+ The _ compile_ tests are "built" when the whole test suite is built at which
51
+ time a compilation log is saved. At testing time, the log is checked to
47
52
determine whether the test should pass or fail. If the test is expected to pass,
48
53
but the compilation log contains errors, the test will be deemed to have failed
49
54
and vice versa. The _ compile_ test are supported in ` torture ` , but not in
@@ -66,11 +71,11 @@ default.
66
71
In order to enable the disabled tests, one or more of the following options can
67
72
be passed to ` cmake ` :
68
73
69
- - `TEST_SUITE_FORTRAN_FORCE_ALL_TESTS`: Enable all disabled tests.
70
- - `TEST_SUITE_FORTRAN_FORCE_UNSUPPORTED_TESTS`: Enable only the *unsupported* tests.
71
- - `TEST_SUITE_FORTRAN_FORCE_UNIMPLEMENTED_TESTS`: Enable only the *unimplemented* tests.
72
- - `TEST_SUITE_FORTRAN_FORCE_SKIPPED_TESTS`: Enable only the *skipped* tests.
73
- - `TEST_SUITE_FORTRAN_FORCE_FAILING_TESTS`: Enable only the *failing* tests.
74
+ - ` TEST_SUITE_FORTRAN_FORCE_ALL_TESTS ` : Enable all disabled tests.
75
+ - ` TEST_SUITE_FORTRAN_FORCE_UNSUPPORTED_TESTS ` : Enable only the * unsupported* tests.
76
+ - ` TEST_SUITE_FORTRAN_FORCE_UNIMPLEMENTED_TESTS ` : Enable only the * unimplemented* tests.
77
+ - ` TEST_SUITE_FORTRAN_FORCE_SKIPPED_TESTS ` : Enable only the * skipped* tests.
78
+ - ` TEST_SUITE_FORTRAN_FORCE_FAILING_TESTS ` : Enable only the * failing* tests.
74
79
75
80
Some of the tests require the ` ISO_Fortran_binding.h ` header file. ` cmake ` will
76
81
look for this file in the ` include ` directory of the ` flang ` installation
@@ -116,3 +121,57 @@ manually periodically.
116
121
117
122
The test files in ` regression ` and ` torture ` * must not* be modified.
118
123
124
+
125
+ ### TODO's ###
126
+
127
+ If some of the items listed here are implemented, even in part, it should
128
+ allows us to make better use of the test-suite.
129
+
130
+ Several DejaGNU directives from the test files are currently ignored. In some
131
+ cases, those directives check that the language feature/optimization being
132
+ exercised by the tests is actually handled correctly. By ignoring them, we are
133
+ simply checking that ` flang ` (or the code produced by it) does not crash at
134
+ build/test time. In the case of the _ compile_ tests where this is the case, we
135
+ could have situations where the test passes because the compilation succeeded,
136
+ not because the compiler actually did the right thing - for instance, the tests
137
+ in ` gfortran/regression/vect ` check if the code was correctly vectorized. We
138
+ could pass those tests just by failing to crash - not because ` flang ` actually
139
+ vectorized the code.
140
+
141
+ It is not clear how much effort would be involved in correctly handling all the
142
+ DejaGNU directives.
143
+
144
+ ### ` dg-error ` directive ###
145
+
146
+ The ` dg-error ` directive indicates that the test should fail to compile with a
147
+ particular error. Obviously, this is a ` gfortran ` -specific error. ` flang ` may
148
+ not have a direct equivalent i.e. it may produce a more general error message
149
+ (or maybe even a more specific one if ` gfortran ` is the one with the more
150
+ general error message). For now, when a` dg-error ` is encountered, the test is
151
+ marked as ` expect-error ` . At test time, we only check if "some" error (that was
152
+ not a crash) occurred. This can cause false-negatives, particularly in the
153
+ OpenMP (and perhaps even OpenACC) tests. This is where some directives/clauses
154
+ are currently not implemented which results in a parse error (as opposed to the
155
+ triggering of a "not-yet-implemented" assertion) which is also deemed an "error",
156
+ thereby causing the test to pass.
157
+
158
+ #### ` scan-tree-dump ` directive ####
159
+
160
+ In the _ compile_ tests, the ` dg-final { scan-tree-dump* ...} ` directives are
161
+ ignored. The ` scan-tree-dump* ` checks GCC's internal tree structure to ensure
162
+ that the specific language feature/optimization the test was meant to exercise
163
+ was handled correctly (see, for example, ` regression/volatile_7.f90 ` ).
164
+
165
+ The tests instruct GCC to write out the internal representation to file and scan
166
+ the file for the presence or absence of certain text. To capture the same
167
+ behavior here, we would need to parse and translate the internal representation
168
+ of GCC to an equivalent representation in LLVM IR.
169
+
170
+ ### ` target ` directive ###
171
+
172
+ The ` target ` directive is used to restrict tests to run on certain
173
+ platforms/systems. Currently, the target directive is ignored entirely and the
174
+ tests are always run. Currently, the gfortran tests are only enabled on * nix on
175
+ x86-64 and aarch64 and ignoring the directive seems to be ok. As support for
176
+ more systems and architectures are added, these directives will need to be
177
+ handled correctly.
0 commit comments