Commit 964b2a40239454e1c1e56b88a6aff27cdaa7c3be

Daniel Stone 2013-03-19T10:29:49

test: Suppress RMLVO environment inheritance by default But add a flag to allow it for later usage. Signed-off-by: Daniel Stone <daniel@fooishbar.org>

diff --git a/test/common.c b/test/common.c
index df79272..2ed23cf 100644
--- a/test/common.c
+++ b/test/common.c
@@ -185,8 +185,22 @@ test_read_file(const char *path_rel)
 struct xkb_context *
 test_get_context(enum test_context_flags test_flags)
 {
-    struct xkb_context *ctx = xkb_context_new(XKB_CONTEXT_NO_DEFAULT_INCLUDES);
+    enum xkb_context_flags ctx_flags;
+    struct xkb_context *ctx;
+
+    ctx_flags = XKB_CONTEXT_NO_DEFAULT_INCLUDES;
+    if (test_flags & CONTEXT_ALLOW_ENVIRONMENT_NAMES) {
+        unsetenv("XKB_DEFAULT_RULES");
+        unsetenv("XKB_DEFAULT_MODEL");
+        unsetenv("XKB_DEFAULT_LAYOUT");
+        unsetenv("XKB_DEFAULT_VARIANT");
+        unsetenv("XKB_DEFAULT_OPTIONS");
+    }
+    else {
+        ctx_flags |= XKB_CONTEXT_NO_ENVIRONMENT_NAMES;
+    }
 
+    ctx = xkb_context_new(ctx_flags);
     if (!ctx)
         return NULL;
 
diff --git a/test/test.h b/test/test.h
index b90bdd9..d3e3f62 100644
--- a/test/test.h
+++ b/test/test.h
@@ -54,6 +54,7 @@ test_read_file(const char *path_rel);
 
 enum test_context_flags {
     CONTEXT_NO_FLAG = 0,
+    CONTEXT_ALLOW_ENVIRONMENT_NAMES = (1 << 0),
 };
 
 struct xkb_context *