# Running ROOT tests

**URL:** <https://root-forum.cern.ch/t/running-root-tests/37177>\
**Category:** Howto\
**Created:** [December 12, 2019, 12:40pm UTC](https://root-forum.cern.ch/t/running-root-tests/37177 "2019-12-12T12:40:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [December 12, 2019, 12:40pm UTC](https://root-forum.cern.ch/t/running-root-tests/37177/1 "2019-12-12T12:40:38Z")

</div>

We run the ROOT tests using [ctest](http://www.cmake.org/cmake/help/latest/manual/ctest.1.html) driver. All tests are defined within the CTest framework. The following tests categories exists:

- ROOT basic tests delivered in: `$ROOTSYS/test`
- ROOT tutorials delivered in: `$ROOTSYS/tutorials`
- ROOTTEST tests that can be, until ROOT version 6.36, downloaded from ; [roottest](https://root.cern.ch/gitweb?p=roottest.git) repository). `git clone http://root.cern.ch/git/roottest.git` and for more recent versions, delivered in: `$ROOTSYS/roottest`

## Running tests from the build directory (CMake)

Testing is not enabled by default when configuring the ROOT build. Enabling is done by the option `testing` and the option `roottest` to add the ROOTTEST tests to the test suit. The basic instructions are:

```auto
$ mkdir <builddir>
$ cd <builddir>
$ cmake -Dtesting=ON -Droottest=ON <root-sources-dir>
$ cmake --build
$ ctest -j8

```

You can select a subset of tests by using the `-R <regexpr>` and see the test output by adding `-V` to the ctest command. See the complete set of options of [ctest](http://www.cmake.org/cmake/help/latest/manual/ctest.1.html)

## Running tests using an existing installation produced by CMake

It is assumed that you have the proper ROOT environment setup ( with `source <installdir>/bin/thisroot.sh` )

### Running the basic ROOT tests

```auto
$ mkdir runtests
$ cd runtests
$ cmake $ROOTSYS/test
$ make # to build the test libraries and executables
$ ctest -j8

```

### Running the ROOTTEST tests

Until ROOT 6.36, we need to checkout the ROOTTEST repository, create a build area and configure with cmake.

```auto
$ git clone http://root.cern.ch/git/roottest.git
$ mkdir runtests
$ cd runtests
$ cmake ../roottest
$ ctest -j8

```
