@@ -14,23 +14,38 @@ still be sure that we haven't accidentally removed a necessary `#include`.
1414meaning that any warnings coming out of them may be turned into errors and will
1515affect test results. This is considered as an extra feature of the suite.
1616
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+
1723## Implementation
1824
1925There was a couple of iterations on the suite design and its current shape
2026features 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
2338
2439That is done to allow for massive parallelism and keep those tests small and
2540quick.
2641
27- Absolute most of the magic is happenning within
42+ Absolute most of the magic is happening within
2843[ ` sycl/test/format.py ` ] ( /sycl/test/format.py ) : we define a custom test format in
2944there which overrides standard discovery and test execution rules.
3045
3146## How to use and maintain
3247
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
3449by Python's ` re ` package as ` SYCL_HEADERS_FILTER ` parameter to LIT to filter
3550which headers you would like to see checked (only those that match the passed
3651regexp will be used to generate tests).
@@ -47,11 +62,38 @@ Documentation for Python's regexp can be found [here][python-3-re].
4762
4863[ python-3-re ] : https://docs.python.org/3/library/re.html#regular-expression-syntax
4964
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
5267[ the local config] ( /sycl/test/self-contained-headers/lit.local.cfg ) and modify
5368list of files which should be treated as expected to fail.
5469
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+
5597## Known issues and quirks
5698
5799### To launch the suite directly, use ` LIT_FILTER ` env variable
@@ -70,14 +112,7 @@ Instead, the following approach should be used:
70112LIT_FILTER='self-contained-headers' llvm-lit sycl/test
71113```
72114
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
81116
82117` XFAIL ` mechanism mentioned in "How to use and maintain" section does not
83118support marking a test as expected to fail only in certain environment, which
0 commit comments