Commit 54f95f496f58e1cce7a6af1925adf61eb5d44591

Daniel Stone 2013-03-18T21:02:35

test: Add flags argument to test_get_context() Allowing overriding of environment suppression, at first. Signed-off-by: Daniel Stone <daniel@fooishbar.org>

diff --git a/test/bench-key-proc.c b/test/bench-key-proc.c
index 241c217..e345092 100644
--- a/test/bench-key-proc.c
+++ b/test/bench-key-proc.c
@@ -58,7 +58,7 @@ main(void)
     struct xkb_state *state;
     struct timespec start, stop, elapsed;
 
-    ctx = test_get_context();
+    ctx = test_get_context(0);
     assert(ctx);
 
     keymap = test_compile_rules(ctx, "evdev", "pc104", "us,ru,il,de",
diff --git a/test/common.c b/test/common.c
index 400d872..df79272 100644
--- a/test/common.c
+++ b/test/common.c
@@ -183,7 +183,7 @@ test_read_file(const char *path_rel)
 }
 
 struct xkb_context *
-test_get_context(void)
+test_get_context(enum test_context_flags test_flags)
 {
     struct xkb_context *ctx = xkb_context_new(XKB_CONTEXT_NO_DEFAULT_INCLUDES);
 
diff --git a/test/context.c b/test/context.c
index e151dd0..63813f1 100644
--- a/test/context.c
+++ b/test/context.c
@@ -29,7 +29,7 @@
 int
 main(void)
 {
-    struct xkb_context *context = test_get_context();
+    struct xkb_context *context = test_get_context(0);
 
     assert(context);
 
diff --git a/test/filecomp.c b/test/filecomp.c
index eafe568..0e41dea 100644
--- a/test/filecomp.c
+++ b/test/filecomp.c
@@ -38,7 +38,7 @@ test_file(struct xkb_context *ctx, const char *path_rel)
 int
 main(void)
 {
-    struct xkb_context *ctx = test_get_context();
+    struct xkb_context *ctx = test_get_context(0);
 
     assert(test_file(ctx, "keymaps/basic.xkb"));
     assert(test_file(ctx, "keymaps/comprehensive-plus-geom.xkb"));
diff --git a/test/interactive.c b/test/interactive.c
index 789f932..f90f6eb 100644
--- a/test/interactive.c
+++ b/test/interactive.c
@@ -497,7 +497,7 @@ main(int argc, char *argv[])
         }
     }
 
-    ctx = test_get_context();
+    ctx = test_get_context(0);
     if (!ctx) {
         ret = -1;
         fprintf(stderr, "Couldn't create xkb context\n");
diff --git a/test/keyseq.c b/test/keyseq.c
index 461a439..57ea496 100644
--- a/test/keyseq.c
+++ b/test/keyseq.c
@@ -28,7 +28,7 @@
 int
 main(void)
 {
-    struct xkb_context *ctx = test_get_context();
+    struct xkb_context *ctx = test_get_context(0);
     struct xkb_keymap *keymap;
 
     assert(ctx);
diff --git a/test/print-compiled-keymap.c b/test/print-compiled-keymap.c
index 0e14205..7e57fdd 100644
--- a/test/print-compiled-keymap.c
+++ b/test/print-compiled-keymap.c
@@ -71,7 +71,7 @@ main(int argc, char *argv[])
         }
     }
 
-    ctx = test_get_context();
+    ctx = test_get_context(0);
     if (!ctx) {
         fprintf(stderr, "Couldn't create xkb context\n");
         goto err_out;
diff --git a/test/rmlvo-to-kccgst.c b/test/rmlvo-to-kccgst.c
index 3443614..bba2bde 100644
--- a/test/rmlvo-to-kccgst.c
+++ b/test/rmlvo-to-kccgst.c
@@ -68,7 +68,7 @@ main(int argc, char *argv[])
     if (isempty(rmlvo.layout))
         rmlvo.layout = DEFAULT_XKB_LAYOUT;
 
-    ctx = test_get_context();
+    ctx = test_get_context(0);
     if (!ctx) {
         fprintf(stderr, "Failed to get xkb context\n");
         return 1;
diff --git a/test/rules-file.c b/test/rules-file.c
index b3b3b6c..da14e3a 100644
--- a/test/rules-file.c
+++ b/test/rules-file.c
@@ -132,7 +132,7 @@ main(int argc, char *argv[])
 {
     struct xkb_context *ctx;
 
-    ctx = test_get_context();
+    ctx = test_get_context(0);
     assert(ctx);
 
     if (argc > 1 && streq(argv[1], "bench")) {
diff --git a/test/rulescomp.c b/test/rulescomp.c
index 55113f6..dfe4084 100644
--- a/test/rulescomp.c
+++ b/test/rulescomp.c
@@ -93,7 +93,7 @@ benchmark(struct xkb_context *context)
 
 int main(int argc, char *argv[])
 {
-    struct xkb_context *ctx = test_get_context();
+    struct xkb_context *ctx = test_get_context(0);
 
     assert(ctx);
 
diff --git a/test/state.c b/test/state.c
index 83a8f45..34da201 100644
--- a/test/state.c
+++ b/test/state.c
@@ -334,7 +334,7 @@ test_consume(struct xkb_keymap *keymap)
 int
 main(void)
 {
-    struct xkb_context *context = test_get_context();
+    struct xkb_context *context = test_get_context(0);
     struct xkb_keymap *keymap;
 
     assert(context);
diff --git a/test/stringcomp.c b/test/stringcomp.c
index ab5bbef..3aefba9 100644
--- a/test/stringcomp.c
+++ b/test/stringcomp.c
@@ -32,7 +32,7 @@
 int
 main(int argc, char *argv[])
 {
-    struct xkb_context *ctx = test_get_context();
+    struct xkb_context *ctx = test_get_context(0);
     struct xkb_keymap *keymap;
     char *original, *dump;
 
diff --git a/test/test.h b/test/test.h
index a72d6aa..b90bdd9 100644
--- a/test/test.h
+++ b/test/test.h
@@ -52,8 +52,12 @@ test_get_path(const char *path_rel);
 char *
 test_read_file(const char *path_rel);
 
+enum test_context_flags {
+    CONTEXT_NO_FLAG = 0,
+};
+
 struct xkb_context *
-test_get_context(void);
+test_get_context(enum test_context_flags flags);
 
 struct xkb_keymap *
 test_compile_file(struct xkb_context *context, const char *path_rel);