mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-17 04:08:07 +02:00
acd/tests: skip NAcd tests under valgrind
Under valgrind, we cannot create an NAcd instance.
--10916-- WARNING: unhandled amd64-linux syscall: 321
--10916-- You may be able to write your own handler.
--10916-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--10916-- Nevertheless we consider this a bug. Please report
--10916-- it at http://valgrind.org/support/bug_reports.html.
This limitation already poses a problem, because running NetworkManager
under valgrind might fail. However, for tests it doesn't matter and we
can just skip them.
This commit is contained in:
parent
37c6cafb84
commit
343b99f891
2 changed files with 53 additions and 2 deletions
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "n-acd/src/n-acd.h"
|
||||
|
||||
#include "devices/nm-acd-manager.h"
|
||||
#include "platform/tests/test-common.h"
|
||||
|
||||
|
|
@ -31,6 +33,46 @@
|
|||
#define ADDR3 0x03030303
|
||||
#define ADDR4 0x04040404
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
_skip_acd_test_check (void)
|
||||
{
|
||||
NAcd *acd;
|
||||
NAcdConfig *config;
|
||||
const guint8 hwaddr[ETH_ALEN] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
|
||||
int r;
|
||||
static int skip = -1;
|
||||
|
||||
if (skip == -1) {
|
||||
r = n_acd_config_new (&config);
|
||||
g_assert (r == 0);
|
||||
|
||||
n_acd_config_set_ifindex (config, 1);
|
||||
n_acd_config_set_transport (config, N_ACD_TRANSPORT_ETHERNET);
|
||||
n_acd_config_set_mac (config, hwaddr, sizeof (hwaddr));
|
||||
|
||||
r = n_acd_new (&acd, config);
|
||||
n_acd_config_free (config);
|
||||
if (r == 0)
|
||||
n_acd_unref (acd);
|
||||
|
||||
skip = (r != 0);
|
||||
}
|
||||
return skip;
|
||||
}
|
||||
|
||||
#define _skip_acd_test() \
|
||||
({ \
|
||||
gboolean _skip = _skip_acd_test_check (); \
|
||||
\
|
||||
if (_skip) \
|
||||
g_test_skip ("Cannot create NAcd. Running under valgind?"); \
|
||||
_skip; \
|
||||
})
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
int ifindex0;
|
||||
int ifindex1;
|
||||
|
|
@ -79,6 +121,9 @@ test_acd_common (test_fixture *fixture, TestInfo *info)
|
|||
.user_data_destroy = (GDestroyNotify) g_main_loop_unref,
|
||||
};
|
||||
|
||||
if (_skip_acd_test ())
|
||||
return;
|
||||
|
||||
/* first, try with a short waittime. We hope that this is long enough
|
||||
* to successfully complete the test. Only if that's not the case, we
|
||||
* assume the computer is currently busy (high load) and we retry with
|
||||
|
|
@ -156,6 +201,9 @@ test_acd_announce (test_fixture *fixture, gconstpointer user_data)
|
|||
NMAcdManager *manager;
|
||||
GMainLoop *loop;
|
||||
|
||||
if (_skip_acd_test ())
|
||||
return;
|
||||
|
||||
manager = nm_acd_manager_new (fixture->ifindex0,
|
||||
fixture->hwaddr0,
|
||||
fixture->hwaddr0_len,
|
||||
|
|
|
|||
|
|
@ -294,8 +294,11 @@ fi
|
|||
if [ $HAS_ERRORS -eq 0 ]; then
|
||||
# valgrind doesn't support setns syscall and spams the logfile.
|
||||
# hack around it...
|
||||
if [ "$TEST_NAME" = 'test-link-linux' -a -z "$(sed -e '/^--[0-9]\+-- WARNING: unhandled .* syscall: /,/^--[0-9]\+-- it at http.*\.$/d' "$LOGFILE")" ]; then
|
||||
HAS_ERRORS=1
|
||||
if [ "$TEST_NAME" = 'test-link-linux' -o \
|
||||
"$TEST_NAME" = 'test-acd' ]; then
|
||||
if [ -z "$(sed -e '/^--[0-9]\+-- WARNING: unhandled .* syscall: /,/^--[0-9]\+-- it at http.*\.$/d' "$LOGFILE")" ]; then
|
||||
HAS_ERRORS=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue