forked from OSchip/llvm-project
[libc++] NFC: Add documentation for writing tests
This commit is contained in:
parent
a6a841e0d7
commit
90455dbe2e
|
@ -209,6 +209,29 @@ Environment Variables
|
|||
to use color diagnostic outputs from the compiler.
|
||||
Also see `color_diagnostics`.
|
||||
|
||||
Writing Tests
|
||||
-------------
|
||||
|
||||
When writing tests for the libc++ test suite, you should follow a few guidelines.
|
||||
This will ensure that your tests can run on a wide variety of hardware and under
|
||||
a wide variety of configurations. We have several unusual configurations such as
|
||||
building the tests on one host but running them on a different host, which add a
|
||||
few requirements to the test suite. Here's some stuff you should know:
|
||||
|
||||
- All tests are run in a temporary directory that is unique to that test and
|
||||
cleaned up after the test is done.
|
||||
- When a test needs data files as inputs, these data files can be saved in the
|
||||
repository (when reasonable) and referrenced by the test as
|
||||
``// FILE_DEPENDENCIES: <path-to-dependencies>``. Copies of these files or
|
||||
directories will be made available to the test in the temporary directory
|
||||
where it is run.
|
||||
- You should never hardcode a path from the build-host in a test, because that
|
||||
path will not necessarily be available on the host where the tests are run.
|
||||
- You should try to reduce the runtime dependencies of each test to the minimum.
|
||||
For example, requiring Python to run a test is bad, since Python is not
|
||||
necessarily available on all devices we may want to run the tests on (even
|
||||
though supporting Python is probably trivial for the build-host).
|
||||
|
||||
Benchmarks
|
||||
==========
|
||||
|
||||
|
|
Loading…
Reference in New Issue