# Running tests with xvfb-run

**URL:** <https://discourse.vtk.org/t/running-tests-with-xvfb-run/7597>\
**Category:** Development\
**Tags:** proposal\
**Created:** [January 7, 2022, 11:05am UTC](https://discourse.vtk.org/t/running-tests-with-xvfb-run/7597 "2022-01-07T11:05:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RafaelPalomar](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rafaelpalomar/32/4524_2.png) [@RafaelPalomar](https://discourse.vtk.org/u/RafaelPalomar)\
**Post date:** [January 7, 2022, 11:05am UTC](https://discourse.vtk.org/t/running-tests-with-xvfb-run/7597/1 "2022-01-07T11:05:03Z")

</div>

Hello,

**PROBLEM:**

I’m trying to run VTK testing through `xvfb-run ctest` and many of the tests ([complete list of failed tests](https://pastebin.com/F8EqBXKg)) end up failing with `***Exception: Numerical` errors.

I’ve been digging into the problem and found that most (probably all) cases follow the same pattern:

```auto
Program terminated with signal SIGFPE, Arithmetic exception.
#0 0x00007f333676a376 in lp_build_tgsi_info (tokens=<optimized out>, info=0x564c4e7ddd60)
    at ../mesa-21.2.6/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c:592
b592 if (value < 0.0f || value > 1.0f) {
[Current thread is 1 (Thread 0x7f3337144fc0 (LWP 171475))]
(gdb) backtrace
#0 0x00007f333676a376 in lp_build_tgsi_info (tokens=<optimized out>, info=0x564c4e7ddd60)
    at ../mesa-21.2.6/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c:592
[...]
#15 0x00007f3337009320 in glXCreateContextAttribsARB (dpy=0x564c4e83a4d0, config=0x564c4e8768b0,
    share_context=0x0, direct=1, attrib_list=0x7ffc552f2560) at ../mesa-21.2.6/src/glx/create_context.c:100
#16 0x00007f333d895d4f in glXCreateContextAttribsARB (dpy=0x564c4e83a4d0, config=0x564c4e8768b0, share_list=0x0,
    direct=1, attrib_list=0x7ffc552f2560) at ../libglvnd-v1.3.4/src/GLX/libglx.c:305
#17 0x00007f333e526efc in vtkXOpenGLRenderWindow::CreateAWindow (this=0x564c4e71c2d0)

```

On window creation code in mesa raises a SIGFPE ([complete backtrace](https://pastebin.com/Gx8L8iyR)). Researching a little more on the issue I found [a related issue in the mesa project](https://gitlab.freedesktop.org/mesa/mesa/-/issues/3096) stating that:

> it’s a really bad idea calling into mesa code with changed fpe environment so that signalling NaNs get triggered (this can easily hit crashes in other places as well). The real fix would be to change the calling code (wherever the fpe env change comes from) to not do that.

**PROPOSED SOLUTION:**

Based on the aforementioned mesa issue I have found that a call to `vtkFloatingPointExceptions::Disable()` before creation of render windows, does not trigger the errors and make the tests pass. Furthermore, some tests seem to already include `vtkFloatingPointExceptions::Disable()` (e.g., [TestGPURayCastIsosurface.cxx:22](https://github.com/Kitware/VTK/blob/cef3c1806bf206caa1473b162347c821061c4970/Rendering/VolumeOpenGL2/Testing/Cxx/TestGPURayCastIsosurface.cxx#L22)) maybe for similar reasons.

If this would be an acceptable approach I could prepare a PR for this.

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)\
**Post date:** [January 7, 2022, 12:43pm UTC](https://discourse.vtk.org/t/running-tests-with-xvfb-run/7597/2 "2022-01-07T12:43:36Z")

</div>

I suspect that more tests need `DISABLE_FLOATING_POINT_EXCEPTIONS` passed into the test declarations. See existing usage in `Rendering/RayTracing/Testing/Cxx/CMakeLists.txt` for how to apply it to a test.

---

<div class="post-metadata">

**Author:** ![RafaelPalomar](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rafaelpalomar/32/4524_2.png) [@RafaelPalomar](https://discourse.vtk.org/u/RafaelPalomar)\
**Post date:** [January 8, 2022, 12:05pm UTC](https://discourse.vtk.org/t/running-tests-with-xvfb-run/7597/3 "2022-01-08T12:05:59Z")

</div>

Thank you @ben.boeckel for the quick reply. Here is a PR addressing this issue: [https://gitlab.kitware.com/vtk/vtk/-/merge\_requests/8799](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/8799)
