[gnome-shell] tests: fix up typelib include paths



commit 0907f030b4ec060794b89b3b243836db3b3e2110
Author: Dan Winship <danw gnome org>
Date:   Wed May 18 14:52:27 2011 -0400

    tests: fix up typelib include paths
    
    The js modules have so many imports back and forth that it's pretty
    much guaranteed that if you import even one of them, you'll end up
    importing all of them, including ui.status.bluetooth and
    ui.status.network. So fix up the typelib include paths the same way
    gnome-shell-jhbuild does, so we can find everything.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=650298

 src/run-js-test.c    |   11 +++++++++--
 tests/Makefile.am    |    1 +
 tests/run-test.sh.in |    2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/run-js-test.c b/src/run-js-test.c
index 41fb37c..c89d26f 100644
--- a/src/run-js-test.c
+++ b/src/run-js-test.c
@@ -32,18 +32,17 @@
 
 #include <clutter/x11/clutter-x11.h>
 #include <gdk/gdkx.h>
+#include <girepository.h>
 #include <gjs/gjs.h>
 #include <gtk/gtk.h>
 
 #include "shell-global.h"
 #include "shell-global-private.h"
 
-static char **include_path = NULL;
 static char *command = NULL;
 
 static GOptionEntry entries[] = {
   { "command", 'c', 0, G_OPTION_ARG_STRING, &command, "Program passed in as a string", "COMMAND" },
-  { "include-path", 'I', 0, G_OPTION_ARG_STRING_ARRAY, &include_path, "Add the directory DIR to the list of directories to search for js files.", "DIR" },
   { NULL }
 };
 
@@ -131,6 +130,14 @@ main(int argc, char **argv)
   clutter_stage_set_title (CLUTTER_STAGE (stage), title);
   g_free (title);
 
+#if HAVE_BLUETOOTH
+  /* The module imports are all so intertwined that if the test
+   * imports anything in js/ui, it will probably eventually end up
+   * pulling in ui/status/bluetooth.js. So we need this.
+   */
+  g_irepository_prepend_search_path (BLUETOOTH_DIR);
+#endif
+
   /* evaluate the script */
   error = NULL;
   if (!gjs_context_eval (js_context, script, len,
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 172dc99..fe3ff56 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -28,6 +28,7 @@ EXTRA_DIST += $(TEST_MISC)
 run-test.sh: run-test.sh.in
 	$(AM_V_GEN) sed \
 	    -e "s|@MUTTER_TYPELIB_DIR[ ]|$(MUTTER_TYPELIB_DIR)|" \
+	    -e "s|@JHBUILD_TYPELIBDIR[ ]|$(JHBUILD_TYPELIBDIR)|" \
 	    -e "s|@srcdir[ ]|$(srcdir)|" \
 	    $< > $@ && chmod a+x $@
 
diff --git a/tests/run-test.sh.in b/tests/run-test.sh.in
index ee1472f..0a01473 100755
--- a/tests/run-test.sh.in
+++ b/tests/run-test.sh.in
@@ -30,7 +30,7 @@ builddir=`cd $builddir && pwd`
 srcdir=$builddir/@srcdir@
 srcdir=`cd $srcdir && pwd`
 
-GI_TYPELIB_PATH="@MUTTER_TYPELIB_DIR@:$builddir/../src"
+GI_TYPELIB_PATH="$GI_TYPELIB_PATH${GI_TYPELIB_PATH:+:} MUTTER_TYPELIB_DIR@:@JHBUILD_TYPELIBDIR@:$builddir/../src"
 GJS_PATH="$srcdir:$srcdir/../js"
 GJS_DEBUG_OUTPUT=stderr
 $verbose || GJS_DEBUG_TOPICS="JS ERROR;JS LOG"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]