[folks] tests: Allow pkg-config calls to be overridden by environment variables
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] tests: Allow pkg-config calls to be overridden by environment variables
- Date: Fri, 23 Jan 2015 14:07:00 +0000 (UTC)
commit 324f8687f1bc547b87600d1ccf845065e6fad117
Author: Philip Withnall <philip withnall collabora co uk>
Date: Fri Jan 23 12:42:18 2015 +0000
tests: Allow pkg-config calls to be overridden by environment variables
When running installed tests, the pkg-config files for our dependencies
might not be available, so the runtime pkg-config calls will fail and
hence the tests will fail.
Allow overriding the pkg-config calls with environment variables which
will be set in the .test files for the installed tests.
https://bugzilla.gnome.org/show_bug.cgi?id=743398
tests/lib/eds/test-case.vala | 21 ++++++++++++++++++---
tests/lib/tracker/test-case.vala | 21 ++++++++++++++++++---
2 files changed, 36 insertions(+), 6 deletions(-)
---
diff --git a/tests/lib/eds/test-case.vala b/tests/lib/eds/test-case.vala
index ed190ea..e52a135 100644
--- a/tests/lib/eds/test-case.vala
+++ b/tests/lib/eds/test-case.vala
@@ -69,9 +69,16 @@ public class EdsTest.TestCase : Folks.TestCase
return transient;
}
- public override void private_bus_up ()
+ private string _get_eds_libexecdir ()
{
- base.private_bus_up ();
+ /* Try the environment variable first, since when running installed
+ * tests we can’t depend on pkg-config being available. */
+ var env = Environment.get_variable ("FOLKS_TEST_EDS_LIBEXECDIR");
+
+ if (env != null && env != "")
+ {
+ return env;
+ }
/* Find out the libexec directory to use. */
int exit_status = -1;
@@ -95,7 +102,15 @@ public class EdsTest.TestCase : Folks.TestCase
error ("Error getting libexecdir from pkg-config: %s", e1.message);
}
- var libexec = capture_stdout.strip ();
+ return capture_stdout.strip ();
+ }
+
+ public override void private_bus_up ()
+ {
+ base.private_bus_up ();
+
+ /* Find out the libexec directory to use. */
+ var libexec = this._get_eds_libexecdir ();
/* Create service files for the Evolution binaries. */
const string sources_services[] =
diff --git a/tests/lib/tracker/test-case.vala b/tests/lib/tracker/test-case.vala
index 0e4a252..6b51e67 100644
--- a/tests/lib/tracker/test-case.vala
+++ b/tests/lib/tracker/test-case.vala
@@ -53,9 +53,16 @@ public class TrackerTest.TestCase : Folks.TestCase
Environment.set_variable ("FOLKS_PRIMARY_STORE", "tracker", true);
}
- public override void private_bus_up ()
+ private string _get_tracker_libexecdir ()
{
- base.private_bus_up ();
+ /* Try the environment variable first, since when running installed
+ * tests we can’t depend on pkg-config being available. */
+ var env = Environment.get_variable ("FOLKS_TEST_TRACKER_LIBEXECDIR");
+
+ if (env != null && env != "")
+ {
+ return env;
+ }
/* Find out the libexec directory to use. */
int exit_status = -1;
@@ -82,7 +89,15 @@ public class TrackerTest.TestCase : Folks.TestCase
/* FIXME: There really should be a libexec variable in the pkg-config
* file. */
- var libexec = capture_stdout.strip () + "/libexec";
+ return capture_stdout.strip () + "/libexec";
+ }
+
+ public override void private_bus_up ()
+ {
+ base.private_bus_up ();
+
+ /* Find out the libexec directory to use. */
+ var libexec = this._get_tracker_libexecdir ();
/* Create service files for the Tracker binaries. */
var service_file_name =
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]