summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Wright <fw@fwright.net>2018-09-27 15:55:45 -0700
committerFred Wright <fw@fwright.net>2018-09-27 15:58:15 -0700
commit661f9ab1f56c8c365018e06e48bb3126809e89c7 (patch)
tree6e5235e91f5c5e7fbb40cce74e1b506ba4ba72b2
parent8364908d0a3b922643c2f64bfeed3a26ed3a9552 (diff)
downloadgpsd-661f9ab1f56c8c365018e06e48bb3126809e89c7.tar.gz
Adds test for xgps dependencies.
This adds a new test_xgps_deps.py, which duplicates the imports needed by xgps and xgpsspeed, as a quick way to verify that the proper prerequisites are in place. It avoids the imports that require (and connect to) an available X11 server. TESTED: Ran successfully with proper dependencies, and verified failure with either cairo or gobject3 removed.
-rw-r--r--SConstruct10
-rwxr-xr-xtest_xgps_deps.py19
2 files changed, 29 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct
index c606b86f..034f8957 100644
--- a/SConstruct
+++ b/SConstruct
@@ -2179,6 +2179,16 @@ method_regress = UtilityWithHerald(
'method-regress', [test_packet], [
'$SRCDIR/test_packet -c >/dev/null', ])
+# Test the xgps/xgpsspeed dependencies
+if not env['python'] or not env['xgps']:
+ test_xgps_deps = None
+else:
+ test_xgps_deps = UtilityWithHerald(
+ 'Testing xgps/xgpsspeed dependencies (since xgps=yes)...',
+ 'test-xgps-deps', [], [
+ '$PYTHON $SRCDIR/test_xgps_deps.py',
+ ])
+
# Run a valgrind audit on the daemon - not in normal tests
valgrind_audit = Utility('valgrind-audit', [
'$SRCDIR/valgrind-audit.py', python_built_extensions, gpsd],
diff --git a/test_xgps_deps.py b/test_xgps_deps.py
new file mode 100755
index 00000000..d6138328
--- /dev/null
+++ b/test_xgps_deps.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+from __future__ import print_function
+
+import sys
+
+import cairo
+
+import gi
+try:
+ gi.require_version('Gtk', '3.0')
+except (AttributeError, ValueError):
+ # Explain the reason for the exception, then reraise
+ print('*** Need PyGObject V3 or later, and Gtk3 ***', file=sys.stderr)
+ raise
+from gi.repository import GObject # pylint: disable=wrong-import-position
+# Skip the imports that require X11
+### from gi.repository import Gtk # pylint: disable=wrong-import-position
+### from gi.repository import Gdk # pylint: disable=wrong-import-position
+### from gi.repository import Pango # pylint: disable=wrong-import-position