@@ -14,23 +14,38 @@ still be sure that we haven't accidentally removed a necessary `#include`.
14
14
meaning that any warnings coming out of them may be turned into errors and will
15
15
affect test results. This is considered as an extra feature of the suite.
16
16
17
+ ** One more note:** due to templated nature of SYCL headers, not every code path
18
+ may be instantiated by a mere ` #include ` and therefore not every dependency will
19
+ be highlighted by a simple test. To overcome this, there is an ability to write
20
+ dedicated tests for certain headers which are more exhaustive than a simple
21
+ ` #include ` , see more details below.
22
+
17
23
## Implementation
18
24
19
25
There was a couple of iterations on the suite design and its current shape
20
26
features the following:
21
- - each header in ` build/include/sycl ` is checked as a separate test
22
- - each such test is generated on the fly dynamically during LIT discovery phase
27
+ - each header in ` build/include/sycl ` is checked as a separate test, unless:
28
+ - it doesn't exists in ` source/include/sycl ` , meaning that it is likely
29
+ removed from the codebase, but still resides in ` build/ ` directory
30
+ - ** TODO:** we also have some auto-generated headers which could be skipped
31
+ this way, we need to consider a mechanism to handle them as well
32
+ - ** TODO:** presence of outdated headers in ` build ` directory should also be
33
+ detected, or otherwise it can lead to compilation issues being hidden in
34
+ local setup
35
+ - each such test is generated on the fly dynamically during LIT discovery phase,
36
+ unless:
37
+ - there is a special/dedicated test for a header, more details below
23
38
24
39
That is done to allow for massive parallelism and keep those tests small and
25
40
quick.
26
41
27
- Absolute most of the magic is happenning within
42
+ Absolute most of the magic is happening within
28
43
[ ` sycl/test/format.py ` ] ( /sycl/test/format.py ) : we define a custom test format in
29
44
there which overrides standard discovery and test execution rules.
30
45
31
46
## How to use and maintain
32
47
33
- Those tests are part of ` check-sycl ` target and you can pass a regexp acepted
48
+ Those tests are part of ` check-sycl ` target and you can pass a regexp accepted
34
49
by Python's ` re ` package as ` SYCL_HEADERS_FILTER ` parameter to LIT to filter
35
50
which headers you would like to see checked (only those that match the passed
36
51
regexp will be used to generate tests).
@@ -47,11 +62,38 @@ Documentation for Python's regexp can be found [here][python-3-re].
47
62
48
63
[ python-3-re ] : https://docs.python.org/3/library/re.html#regular-expression-syntax
49
64
50
- Since there are no dedicated files for each test , ` XFAIL ` ing them using regular
51
- method is impossible, but it is still supported. To do so, open
65
+ Since there are no dedicated files for auto-generated tests , ` XFAIL ` ing them
66
+ using regular method is impossible, but it is still supported. To do so, open
52
67
[ the local config] ( /sycl/test/self-contained-headers/lit.local.cfg ) and modify
53
68
list of files which should be treated as expected to fail.
54
69
70
+ ### Special tests
71
+
72
+ As noted above, to truly ensure that SYCL headers are self-contained, we need
73
+ not only include them, but also use them
74
+ (read: instantiate all classes and methods).
75
+
76
+ To support that, for every SYCL header we have in ` source/include/sycl ` the tool
77
+ first checks if there is a corresponding test file in
78
+ ` source/test/self-contained-headers ` and if so, it is used instead of an
79
+ auto-generated one.
80
+
81
+ Those special tests should be named and located in certain place to be detected,
82
+ or otherwise they will be ignored. For a header
83
+ ` source/include/sycl/path/to/header.hpp ` its special test should be placed under
84
+ ` source/test/sycl/self-contained-headers/sycl/path/to/header.hpp.cpp ` .
85
+
86
+ Note a few things: directory structure should exactly match, the filename should
87
+ be the same as the header file name, but with ` .cpp ` extension added on top of
88
+ it.
89
+
90
+ Those special tests will be treated as any other regular Sh-based tests, i.e.
91
+ you should write your regular ` RUN ` lines in there. It is expected that those
92
+ tests will run a compilation under ` -fsyntax-only ` mode and verify absence of
93
+ any compilation errors or warnings through ` -Xclang -verify ` mechanism.
94
+
95
+ Special tests can be ` XFAIL ` -ed using a regular LIT mechanism.
96
+
55
97
## Known issues and quirks
56
98
57
99
### To launch the suite directly, use ` LIT_FILTER ` env variable
@@ -70,14 +112,7 @@ Instead, the following approach should be used:
70
112
LIT_FILTER='self-contained-headers' llvm-lit sycl/test
71
113
```
72
114
73
- ### Old legacy files in build/ area are still checked
74
-
75
- The custom discovery script uses ` build/include/sycl/ ` folder contents to
76
- generate tests for each header it finds there. It means that if some header was
77
- removed from the codebase, it may still be present in ` build ` folder unless
78
- some cleanup is performed.
79
-
80
- ### No OS-specific ` XFAIL ` mechanism is implemented
115
+ ### No OS-specific ` XFAIL ` mechanism is implemented for auto-generated tests
81
116
82
117
` XFAIL ` mechanism mentioned in "How to use and maintain" section does not
83
118
support marking a test as expected to fail only in certain environment, which
0 commit comments