summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2014-10-30 14:40:47 +0100
committerLubomir Rintel <lkundrak@v3.sk>2014-10-30 14:40:47 +0100
commit48b4f6f8307addb821aea0db22c3a4801cf7a336 (patch)
tree9b1fc8f89eb13787079efa991f99d286b5475b63
parentf4f3f4d69b6ff89b5ec7cb9b2ca3758c149f15f5 (diff)
parent9db55be9a1ba5b680867611889c5585616f95f38 (diff)
downloadNetworkManager-48b4f6f8307addb821aea0db22c3a4801cf7a336.tar.gz
Merge branch 'lr/rpm-make-check'
https://bugzilla.gnome.org/show_bug.cgi?id=739127
-rw-r--r--callouts/tests/Makefile.am4
-rw-r--r--contrib/fedora/rpm/NetworkManager.spec7
-rwxr-xr-xlibnm-glib/tests/libnm-glib-test-launch.sh8
-rw-r--r--libnm/nm-object.c6
-rwxr-xr-xlibnm/tests/libnm-test-launch.sh8
-rw-r--r--libnm/tests/test-nm-client.c2
-rw-r--r--src/NetworkManagerUtils.c37
-rw-r--r--src/settings/plugins/ibft/tests/Makefile.am4
-rw-r--r--src/settings/plugins/ifnet/tests/Makefile.am4
-rw-r--r--src/settings/plugins/ifupdown/tests/Makefile.am4
-rw-r--r--src/tests/test-general-with-expect.c1
11 files changed, 63 insertions, 22 deletions
diff --git a/callouts/tests/Makefile.am b/callouts/tests/Makefile.am
index a1f301ac31..f8fd82b7ea 100644
--- a/callouts/tests/Makefile.am
+++ b/callouts/tests/Makefile.am
@@ -30,10 +30,10 @@ test_dispatcher_envp_LDADD = \
TESTS = test-dispatcher-envp
+endif
+
EXTRA_DIST= \
dispatcher-old-down \
dispatcher-old-up \
dispatcher-old-vpn-down \
dispatcher-old-vpn-up
-
-endif
diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec
index e78a94a3d7..20d1a43a0a 100644
--- a/contrib/fedora/rpm/NetworkManager.spec
+++ b/contrib/fedora/rpm/NetworkManager.spec
@@ -166,6 +166,9 @@ BuildRequires: ModemManager-glib-devel >= 1.0
%if 0%{?with_nmtui}
BuildRequires: newt-devel
%endif
+BuildRequires: /usr/bin/dbus-launch
+BuildRequires: pygobject3-base
+BuildRequires: dbus-python
%description
@@ -469,6 +472,10 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/conf.d
%{__rm} -rf $RPM_BUILD_ROOT
+%check
+make check
+
+
%post
%systemd_post NetworkManager.service NetworkManager-wait-online.service NetworkManager-dispatcher.service
diff --git a/libnm-glib/tests/libnm-glib-test-launch.sh b/libnm-glib/tests/libnm-glib-test-launch.sh
index 1db656ad06..42d9fbe26d 100755
--- a/libnm-glib/tests/libnm-glib-test-launch.sh
+++ b/libnm-glib/tests/libnm-glib-test-launch.sh
@@ -1,7 +1,9 @@
#!/bin/sh
+# Spawn DBus if there's none
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
- exec dbus-launch --exit-with-session "$@"
-else
- exec "$@"
+ eval `dbus-launch --sh-syntax`
+ trap "kill $DBUS_SESSION_BUS_PID" EXIT
fi
+
+"$@"
diff --git a/libnm/nm-object.c b/libnm/nm-object.c
index c9f38756e7..f4162f8bbc 100644
--- a/libnm/nm-object.c
+++ b/libnm/nm-object.c
@@ -1591,11 +1591,17 @@ _nm_object_reload_properties_async (NMObject *object, GAsyncReadyCallback callba
gboolean
_nm_object_reload_properties_finish (NMObject *object, GAsyncResult *result, GError **error)
{
+ NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object);
GSimpleAsyncResult *simple;
g_return_val_if_fail (NM_IS_OBJECT (object), FALSE);
g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (object), _nm_object_reload_properties_async), FALSE);
+ /* NM might have disappeared meanwhile. That would cause a NoReply error to be emitted,
+ * but we don't care if property updates were disabled. */
+ if (priv->suppress_property_updates)
+ return TRUE;
+
simple = G_SIMPLE_ASYNC_RESULT (result);
if (g_simple_async_result_propagate_error (simple, error))
return FALSE;
diff --git a/libnm/tests/libnm-test-launch.sh b/libnm/tests/libnm-test-launch.sh
index 1db656ad06..42d9fbe26d 100755
--- a/libnm/tests/libnm-test-launch.sh
+++ b/libnm/tests/libnm-test-launch.sh
@@ -1,7 +1,9 @@
#!/bin/sh
+# Spawn DBus if there's none
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
- exec dbus-launch --exit-with-session "$@"
-else
- exec "$@"
+ eval `dbus-launch --sh-syntax`
+ trap "kill $DBUS_SESSION_BUS_PID" EXIT
fi
+
+"$@"
diff --git a/libnm/tests/test-nm-client.c b/libnm/tests/test-nm-client.c
index 2ae0ba3ac4..e78e85c9e5 100644
--- a/libnm/tests/test-nm-client.c
+++ b/libnm/tests/test-nm-client.c
@@ -892,6 +892,8 @@ client_devices_changed_cb (GObject *client,
devices = nm_client_get_devices (NM_CLIENT (client));
g_assert (devices != NULL);
+ if (devices->len < 2)
+ return;
g_assert_cmpint (devices->len, ==, 2);
if (NM_IS_DEVICE_VLAN (devices->pdata[0]))
diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c
index 31e82a4a7a..c02c54f427 100644
--- a/src/NetworkManagerUtils.c
+++ b/src/NetworkManagerUtils.c
@@ -1742,15 +1742,36 @@ static gint64 monotonic_timestamp_offset_sec;
static void
monotonic_timestamp_get (struct timespec *tp)
{
- static gboolean initialized = FALSE;
- int err;
-
- err = clock_gettime (CLOCK_BOOTTIME, tp);
+ static int clock_mode = 0;
+ gboolean first_time = FALSE;
+ int err = 0;
+
+ switch (clock_mode) {
+ case 0:
+ /* the clock is not yet initialized (first run) */
+ err = clock_gettime (CLOCK_BOOTTIME, tp);
+ if (err == -1 && errno == EINVAL) {
+ clock_mode = 2;
+ err = clock_gettime (CLOCK_MONOTONIC, tp);
+ } else
+ clock_mode = 1;
+ first_time = TRUE;
+ break;
+ case 1:
+ /* default, return CLOCK_BOOTTIME */
+ err = clock_gettime (CLOCK_BOOTTIME, tp);
+ break;
+ case 2:
+ /* fallback, return CLOCK_MONOTONIC. Kernels prior to 2.6.39
+ * don't support CLOCK_BOOTTIME. */
+ err = clock_gettime (CLOCK_MONOTONIC, tp);
+ break;
+ }
g_assert (err == 0); (void)err;
g_assert (tp->tv_nsec >= 0 && tp->tv_nsec < NM_UTILS_NS_PER_SECOND);
- if (G_LIKELY (initialized))
+ if (G_LIKELY (!first_time))
return;
/* Calculate an offset for the time stamp.
@@ -1767,7 +1788,6 @@ monotonic_timestamp_get (struct timespec *tp)
* wraps (~68 years).
**/
monotonic_timestamp_offset_sec = (- ((gint64) tp->tv_sec)) + 1;
- initialized = TRUE;
if (nm_logging_enabled (LOGL_DEBUG, LOGD_CORE)) {
time_t now = time (NULL);
@@ -1776,8 +1796,9 @@ monotonic_timestamp_get (struct timespec *tp)
strftime (s, sizeof (s), "%Y-%m-%d %H:%M:%S", localtime_r (&now, &tm));
nm_log_dbg (LOGD_CORE, "monotonic timestamp started counting 1.%09ld seconds ago with "
- "an offset of %lld.0 seconds to CLOCK_BOOTTIME (local time is %s)",
- tp->tv_nsec, (long long) -monotonic_timestamp_offset_sec, s);
+ "an offset of %lld.0 seconds to %s (local time is %s)",
+ tp->tv_nsec, (long long) -monotonic_timestamp_offset_sec,
+ clock_mode == 1 ? "CLOCK_BOOTTIME" : "CLOCK_MONOTONIC", s);
}
}
diff --git a/src/settings/plugins/ibft/tests/Makefile.am b/src/settings/plugins/ibft/tests/Makefile.am
index 9946d20859..dd72220a76 100644
--- a/src/settings/plugins/ibft/tests/Makefile.am
+++ b/src/settings/plugins/ibft/tests/Makefile.am
@@ -34,6 +34,8 @@ test_ibft_LDADD = \
TESTS = test-ibft
+endif
+
EXTRA_DIST = \
iscsiadm-test-dhcp \
iscsiadm-test-static \
@@ -45,5 +47,3 @@ EXTRA_DIST = \
iscsiadm-test-bad-record \
iscsiadm-test-vlan
-endif
-
diff --git a/src/settings/plugins/ifnet/tests/Makefile.am b/src/settings/plugins/ifnet/tests/Makefile.am
index a842a206ec..66409a5490 100644
--- a/src/settings/plugins/ifnet/tests/Makefile.am
+++ b/src/settings/plugins/ifnet/tests/Makefile.am
@@ -35,6 +35,8 @@ check_ifnet_LDADD = $(top_builddir)/src/libNetworkManager.la
check-local: check_ifnet
$(abs_builddir)/check_ifnet $(abs_srcdir) $(abs_builddir)
+endif
+
EXTRA_DIST = \
hostname \
net \
@@ -42,5 +44,3 @@ EXTRA_DIST = \
nm-system-settings.conf \
wpa_supplicant.conf \
test_ca_cert.pem
-
-endif
diff --git a/src/settings/plugins/ifupdown/tests/Makefile.am b/src/settings/plugins/ifupdown/tests/Makefile.am
index 14a58f87e5..24cdd95504 100644
--- a/src/settings/plugins/ifupdown/tests/Makefile.am
+++ b/src/settings/plugins/ifupdown/tests/Makefile.am
@@ -25,10 +25,10 @@ test_ifupdown_LDADD = \
TESTS = test-ifupdown
+endif
+
EXTRA_DIST = \
test1 test2 test3 test4 test5 test6 test7 test8 test9 test11 test12 \
test13 test14 test15 test16 test17-wired-static-verify-ip4 \
test18-wired-static-verify-ip6 test19-wired-static-verify-ip4-plen \
test20-source-stanza test20-source-stanza.eth0 test20-source-stanza.eth1
-
-endif
diff --git a/src/tests/test-general-with-expect.c b/src/tests/test-general-with-expect.c
index 50cc48668d..2d19cedf96 100644
--- a/src/tests/test-general-with-expect.c
+++ b/src/tests/test-general-with-expect.c
@@ -188,6 +188,7 @@ test_nm_utils_kill_child (void)
char *argv1[] = {
"sh",
"-c",
+ "trap \"sleep 0.3; exit 10\" EXIT; "
"sleep 100000; exit $? #" TEST_TOKEN,
NULL,
};