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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
From 63b73af23efd97de34a9dde58938c5c772040974 Mon Sep 17 00:00:00 2001
From: Iain Lane <iain@orangesquash.org.uk>
Date: Fri, 19 May 2017 16:38:07 +0100
Subject: [PATCH] color: Make the testcase able to run uninstalled
Distributions might want to be able to run their tests during package
builds, for example.
Compile the schema and set GSETTINGS_SCHEMA_DIR to the build dir.
https://bugzilla.gnome.org/show_bug.cgi?id=782170
---
Makefile.am | 2 +-
plugins/color/Makefile.am | 11 ++++++++++-
plugins/color/gcm-self-test.c | 6 ++++++
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 0a32954..096c245 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,8 +2,8 @@ NULL =
SUBDIRS = \
gnome-settings-daemon \
- plugins \
data \
+ plugins \
po \
tests \
$(NULL)
diff --git a/plugins/color/Makefile.am b/plugins/color/Makefile.am
index a280ba8..35dcad4 100644
--- a/plugins/color/Makefile.am
+++ b/plugins/color/Makefile.am
@@ -30,6 +30,15 @@ gcm_self_test_LDADD = \
TESTS = gcm-self-test
+BUILT_SOURCES = gschemas.compiled
+
+CLEANFILES = gschemas.compiled
+
+gschemas.compiled: $(top_builddir)/data/org.gnome.settings-daemon.plugins.color.gschema.xml
+ $(AM_V_GEN) $(GLIB_COMPILE_SCHEMAS) --schema-file=$< --targetdir=$(builddir)
+
+all-am: gschemas.compiled
+
libexec_PROGRAMS = gsd-color
gsd_color_SOURCES = \
main.c \
@@ -80,7 +89,7 @@ EXTRA_DIST = \
test-data/Lenovo-T61-Internal.bin \
test-data/LG-L225W-External.bin
-CLEANFILES = \
+CLEANFILES += \
$(desktop_DATA)
DISTCLEANFILES = \
diff --git a/plugins/color/gcm-self-test.c b/plugins/color/gcm-self-test.c
index 83c06c5..3f00b60 100644
--- a/plugins/color/gcm-self-test.c
+++ b/plugins/color/gcm-self-test.c
@@ -281,11 +281,17 @@ gcm_test_frac_day (void)
int
main (int argc, char **argv)
{
+ char *schema_dir;
+
g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
gtk_init (&argc, &argv);
g_test_init (&argc, &argv, NULL);
+ schema_dir = g_test_build_filename (G_TEST_BUILT, "", NULL);
+ g_setenv("GSETTINGS_SCHEMA_DIR", schema_dir, TRUE);
+ g_free (schema_dir);
+
g_test_add_func ("/color/edid", gcm_test_edid_func);
g_test_add_func ("/color/sunset-sunrise", gcm_test_sunset_sunrise);
g_test_add_func ("/color/sunset-sunrise/fractional-timezone", gcm_test_sunset_sunrise_fractional_timezone);
--
2.10.2
|