Mesa (main): util/xmlconfig: Make unit tests more resilient against user env settings

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Aug 21 02:15:13 UTC 2021


Module: Mesa
Branch: main
Commit: 1a6d1e93099d3ffe6483f19ad6a0174c44e8e59b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a6d1e93099d3ffe6483f19ad6a0174c44e8e59b

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Mon Aug 16 11:20:00 2021 -0700

util/xmlconfig: Make unit tests more resilient against user env settings

Before this, setting 'vblank_mode=0' in the environment would cause a
unit test to fail.

Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12477>

---

 src/util/tests/xmlconfig.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/util/tests/xmlconfig.cpp b/src/util/tests/xmlconfig.cpp
index da6bab6fc1f..d35af035d5a 100644
--- a/src/util/tests/xmlconfig.cpp
+++ b/src/util/tests/xmlconfig.cpp
@@ -40,6 +40,19 @@ protected:
 
 xmlconfig_test::xmlconfig_test()
 {
+   /* Unset variables from the envrionment to prevent user settings from
+    * impacting the tests.
+    */
+   unsetenv("glsl_zero_init");
+   unsetenv("always_have_depth_buffer");
+   unsetenv("opt");
+   unsetenv("vblank_mode");
+   unsetenv("not_present");
+   unsetenv("mesa_b_option");
+   unsetenv("mesa_s_option");
+   unsetenv("mest_test_unknown_option");
+   unsetenv("mest_drirc_option");
+
    options = {};
 }
 



More information about the mesa-commit mailing list