File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -209,6 +209,29 @@ Environment Variables
209
209
to use color diagnostic outputs from the compiler.
210
210
Also see `color_diagnostics `.
211
211
212
+ Writing Tests
213
+ -------------
214
+
215
+ When writing tests for the libc++ test suite, you should follow a few guidelines.
216
+ This will ensure that your tests can run on a wide variety of hardware and under
217
+ a wide variety of configurations. We have several unusual configurations such as
218
+ building the tests on one host but running them on a different host, which add a
219
+ few requirements to the test suite. Here's some stuff you should know:
220
+
221
+ - All tests are run in a temporary directory that is unique to that test and
222
+ cleaned up after the test is done.
223
+ - When a test needs data files as inputs, these data files can be saved in the
224
+ repository (when reasonable) and referrenced by the test as
225
+ ``// FILE_DEPENDENCIES: <path-to-dependencies> ``. Copies of these files or
226
+ directories will be made available to the test in the temporary directory
227
+ where it is run.
228
+ - You should never hardcode a path from the build-host in a test, because that
229
+ path will not necessarily be available on the host where the tests are run.
230
+ - You should try to reduce the runtime dependencies of each test to the minimum.
231
+ For example, requiring Python to run a test is bad, since Python is not
232
+ necessarily available on all devices we may want to run the tests on (even
233
+ though supporting Python is probably trivial for the build-host).
234
+
212
235
Benchmarks
213
236
==========
214
237
You can’t perform that action at this time.
0 commit comments