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>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
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 *