@@ -106,11 +106,42 @@ end-to-end or SYCL-CTS tests.
106
106
107
107
- [check-sycl](/sycl/test) target contains 2 types of tests: LIT tests and
108
108
unit tests. LIT tests make compile-time checks of DPC++ headers, e.g. device
109
- code IR verification, static_assert tests. Unit tests check DPC++ runtime
109
+ code IR verification, ` static_assert` tests. Unit tests check DPC++ runtime
110
110
behavior and do not perform any device code compilation, instead relying on
111
111
redefining plugin API with [PiMock](/sycl/unittests/helpers/PiMock.hpp) when
112
112
necessary.
113
113
114
+ When adding new test to `check-sycl`, please consider the following:
115
+
116
+ - if you only need to check that compilation succeeds, please use
117
+ [`-fsyntax-only`](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fsyntax-only)
118
+ compiler flag for such tests: it instructs the compiler to launch reduced
119
+ set of commands and produce no output (no need to add `-o %t.out`).
120
+
121
+ - if you are only interested in checking device or host compilation, please use
122
+ corresponding flags to reduce the scope of test and therefore speed it up.
123
+ To launch only device compilation, use `-fsycl-device-only` compiler flag; to
124
+ launch only host compilation, use `%fsycl-host-only` substitution.
125
+
126
+ - tests which want to check generated device code (either in LLVM IR or SPIR-V
127
+ form) should be placed under [check_device_code](/sycl/test/check_device_code)
128
+ folder.
129
+
130
+ - if compiler invocation in your LIT test produces an output file, please make
131
+ sure to redirect it into a temporary file using `-o` option and
132
+ [`%t`](https://llvm.org/docs/CommandGuide/lit.html#substitutions)
133
+ substitution. This is needed to avoid possible race conditions when two LIT
134
+ tests attempt to write into the same file.
135
+
136
+ - if you need to check some runtime behavior please add unit test instead of
137
+ LIT test. Unit tests are built with regular C++ compiler which is used to
138
+ build the project and therefore they are not affected by `clang++` being slow
139
+ when the project is built in Debug mode. As another side effect of using
140
+ standard C++ compiler, device side compilation is skipped entirely, making
141
+ them quicker to compile. And finally, unit tests are written with
142
+ [googletest](https://google.github.io/googletest/primer.html) framework,
143
+ which allows to use plenty of useful assertions and other helpers.
144
+
114
145
### DPC++ end-to-end (E2E) tests
115
146
116
147
These tests are extension to
0 commit comments