### 7.9 Support for torture testing using multiple options

Throughout the compiler testsuite there are several directories whose tests are run multiple times, each with a different set of options. These are known as torture tests. `lib/torture-options.exp` defines procedures to set up these lists:

`torture-init`

  Initialize use of torture lists.

`set-torture-options`

  Set lists of torture options to use for tests with and without loops. Optionally combine a set of torture options with a set of other options, as is done with Objective-C runtime options.

`torture-finish`

  Finalize use of torture lists.

The `.exp` file for a set of tests that use torture options must include calls to these three procedures if:

- It calls `gcc-dg-runtest` and overrides DG_TORTURE_OPTIONS.
- It calls ${tool}`-torture` or ${tool}`-torture-execute`, where tool is `c`, `fortran`, or `objc`.
- It calls `dg-pch`.

It is not necessary for a `.exp` file that calls `gcc-dg-runtest` to call the torture procedures if the tests should use the list in DG_TORTURE_OPTIONS defined in `gcc-dg.exp`.

Most uses of torture options can override the default lists by defining TORTURE_OPTIONS or add to the default list by defining ADDITIONAL_TORTURE_OPTIONS. Define these in a `.dejagnurc` file or add them to the `site.exp` file; for example

    set ADDITIONAL_TORTURE_OPTIONS  [list \
      { -O2 -ftree-loop-linear } \
      { -O2 -fpeel-loops } ]