# Running the SWI-Prolog unit tests from swipl

**URL:** <https://swi-prolog.discourse.group/t/running-the-swi-prolog-unit-tests-from-swipl/6028>\
**Category:** Help!\
**Created:** [December 18, 2022, 10:42am UTC](https://swi-prolog.discourse.group/t/running-the-swi-prolog-unit-tests-from-swipl/6028 "2022-12-18T10:42:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [December 18, 2022, 10:42am UTC](https://swi-prolog.discourse.group/t/running-the-swi-prolog-unit-tests-from-swipl/6028/1 "2022-12-18T10:42:53Z")

</div>

I can invoke the unit tests from the shell using

```prolog
cmake ..
ninja
ctest

```

Is it possible to invoke these tests easily from swipl, that is,

```prolog
cmake ..
ninja
src/swipl
?- ctest. % or something equivalent 

```

---

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [December 18, 2022, 11:06am UTC](https://swi-prolog.discourse.group/t/running-the-swi-prolog-unit-tests-from-swipl/6028/3 "2022-12-18T11:06:21Z")

</div>

I was actually wondering whether it is possible to run the built-in unit tests from the swipl prompt, that is, from `?-`, not from the bash `$`. Similar to `?- check_installation.`

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [December 18, 2022, 2:36pm UTC](https://swi-prolog.discourse.group/t/running-the-swi-prolog-unit-tests-from-swipl/6028/6 "2022-12-18T14:36:40Z")

</div>

> [@mgondan1](#):
>
> Similar to `?- check_installation.`

The trick is to configure using `-DINSTALL_TESTS=ON`. After that, the _installed_ version can be tested using

```
?- test_installation.

```

This is used in the Debian test cycle and is also intended to allow testing cross-compiled versions. It does imply that the installed system gets bigger.

**edit** it installs a `test` directory holding all test scripts and data. It is about 13Mb in size.
