diff options
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/config/meson.build | 7 | ||||
| -rw-r--r-- | src/tests/config/nm-test-device.c | 20 | ||||
| -rw-r--r-- | src/tests/config/nm-test-device.h | 20 | ||||
| -rw-r--r-- | src/tests/config/test-config.c | 20 | ||||
| -rw-r--r-- | src/tests/meson.build | 20 | ||||
| -rw-r--r-- | src/tests/test-core-with-expect.c | 19 | ||||
| -rw-r--r-- | src/tests/test-core.c | 24 | ||||
| -rw-r--r-- | src/tests/test-dcb.c | 16 | ||||
| -rw-r--r-- | src/tests/test-ip4-config.c | 16 | ||||
| -rw-r--r-- | src/tests/test-ip6-config.c | 16 | ||||
| -rw-r--r-- | src/tests/test-systemd.c | 15 | ||||
| -rw-r--r-- | src/tests/test-utils.c | 16 | ||||
| -rw-r--r-- | src/tests/test-wired-defname.c | 16 |
13 files changed, 40 insertions, 185 deletions
diff --git a/src/tests/config/meson.build b/src/tests/config/meson.build index f65f90bb..e3ebfa19 100644 --- a/src/tests/config/meson.build +++ b/src/tests/config/meson.build @@ -1,3 +1,5 @@ +test_config_dir = meson.current_source_dir() + test_unit = 'test-config' sources = files( @@ -5,12 +7,11 @@ sources = files( 'test-config.c', ) -test_config_dir = meson.current_source_dir() - exe = executable( test_unit, sources, - dependencies: test_nm_dep, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, ) test( diff --git a/src/tests/config/nm-test-device.c b/src/tests/config/nm-test-device.c index dd624b44..6e59a4aa 100644 --- a/src/tests/config/nm-test-device.c +++ b/src/tests/config/nm-test-device.c @@ -1,20 +1,6 @@ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright 2013 Red Hat, Inc. +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2013 Red Hat, Inc. */ #include "nm-default.h" diff --git a/src/tests/config/nm-test-device.h b/src/tests/config/nm-test-device.h index 586bbe6d..f10c1589 100644 --- a/src/tests/config/nm-test-device.h +++ b/src/tests/config/nm-test-device.h @@ -1,20 +1,6 @@ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright 2013 Red Hat, Inc. +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2013 Red Hat, Inc. */ #ifndef __NETWORKMANAGER_TEST_DEVICE_H__ diff --git a/src/tests/config/test-config.c b/src/tests/config/test-config.c index a5ef1431..1c28e976 100644 --- a/src/tests/config/test-config.c +++ b/src/tests/config/test-config.c @@ -1,20 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ /* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright 2013 Red Hat, Inc. - * + * Copyright (C) 2013 Red Hat, Inc. */ #include "nm-default.h" @@ -537,7 +523,7 @@ test_config_confdir (void) g_assert_cmpstr (value, ==, "VAL5"); g_free (value); - nm_config_data_log (nm_config_get_data_orig (config), ">>> TEST: ", " ", NULL); + nm_config_data_log (nm_config_get_data_orig (config), ">>> TEST: ", " ", "/test/file/name", NULL); } static void diff --git a/src/tests/meson.build b/src/tests/meson.build index b2bc13ab..ac877e18 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -14,7 +14,8 @@ foreach test_unit: test_units exe = executable( test_unit, test_unit + '.c', - dependencies: test_nm_dep, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, ) test( @@ -27,21 +28,22 @@ endforeach test_unit = 'test-systemd' -cflags = [ +c_flags = [ '-DNETWORKMANAGER_COMPILATION_TEST', '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD', ] +links = [ + libnm_systemd_core, + libnm_systemd_shared, +] + exe = executable( test_unit, test_unit + '.c', - include_directories: src_inc, - dependencies: libnm_core_dep, - c_args: cflags, - link_with: [ - libnm_systemd_core, - libnm_systemd_shared, - ], + dependencies: daemon_nm_default_dep, + c_args: c_flags, + link_with: links, ) test( diff --git a/src/tests/test-core-with-expect.c b/src/tests/test-core-with-expect.c index 2d111a41..74e1043b 100644 --- a/src/tests/test-core-with-expect.c +++ b/src/tests/test-core-with-expect.c @@ -1,20 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ /* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * Copyright (C) 2014 Red Hat, Inc. - * */ #include "nm-default.h" @@ -58,10 +44,13 @@ test_nm_utils_monotonic_timestamp_as_boottime (void) g_assert_cmpint (now_boottime_2, >=, now_boottime); g_assert_cmpint (now_boottime_2 - now_boottime, <=, NM_UTILS_NS_PER_SECOND / 10); + g_assert_cmpint (now, ==, nm_utils_monotonic_timestamp_from_boottime (now_boottime_2, 1)); + for (timestamp_ns_per_tick = 1; timestamp_ns_per_tick <= NM_UTILS_NS_PER_SECOND; timestamp_ns_per_tick *= 10) { now_boottime_3 = nm_utils_monotonic_timestamp_as_boottime (now / timestamp_ns_per_tick, timestamp_ns_per_tick); g_assert_cmpint (now_boottime_2 / timestamp_ns_per_tick, ==, now_boottime_3); + g_assert_cmpint (now / timestamp_ns_per_tick, ==, nm_utils_monotonic_timestamp_from_boottime (now_boottime_3, timestamp_ns_per_tick)); } } } diff --git a/src/tests/test-core.c b/src/tests/test-core.c index 3eaad104..f55f3dff 100644 --- a/src/tests/test-core.c +++ b/src/tests/test-core.c @@ -1,20 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ /* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * Copyright (C) 2014 Red Hat, Inc. - * */ #include "nm-default.h" @@ -2098,10 +2084,12 @@ test_nm_utils_dhcp_client_id_systemd_node_specific (gconstpointer test_data) gs_unref_bytes GBytes *client_id = NULL; const guint8 *cid; guint32 iaid = d->iaid_ifname; + guint32 tmp; - client_id = nm_utils_dhcp_client_id_systemd_node_specific_full (legacy_unstable_byteorder, - (const guint8 *) d->ifname, - strlen (d->ifname), + tmp = nm_utils_create_dhcp_iaid (legacy_unstable_byteorder, + (const guint8 *) d->ifname, + strlen (d->ifname)); + client_id = nm_utils_dhcp_client_id_systemd_node_specific_full (tmp, (const guint8 *) &d->machine_id, sizeof (d->machine_id)); diff --git a/src/tests/test-dcb.c b/src/tests/test-dcb.c index 55206f1d..82d19cee 100644 --- a/src/tests/test-dcb.c +++ b/src/tests/test-dcb.c @@ -1,20 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ /* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * Copyright (C) 2013 Red Hat, Inc. - * */ #include "nm-default.h" diff --git a/src/tests/test-ip4-config.c b/src/tests/test-ip4-config.c index 5afd8670..cd7dc8d8 100644 --- a/src/tests/test-ip4-config.c +++ b/src/tests/test-ip4-config.c @@ -1,20 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ /* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * Copyright (C) 2013 - 2014 Red Hat, Inc. - * */ #include "nm-default.h" diff --git a/src/tests/test-ip6-config.c b/src/tests/test-ip6-config.c index bc212ba7..401d1eee 100644 --- a/src/tests/test-ip6-config.c +++ b/src/tests/test-ip6-config.c @@ -1,20 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ /* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * Copyright (C) 2013 Red Hat, Inc. - * */ #include "nm-default.h" diff --git a/src/tests/test-systemd.c b/src/tests/test-systemd.c index 090dd691..faed0e56 100644 --- a/src/tests/test-systemd.c +++ b/src/tests/test-systemd.c @@ -1,18 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0+ /* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * Copyright (C) 2016 Red Hat, Inc. */ diff --git a/src/tests/test-utils.c b/src/tests/test-utils.c index f3eb66ef..0c94e2d0 100644 --- a/src/tests/test-utils.c +++ b/src/tests/test-utils.c @@ -1,20 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ /* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * Copyright (C) 2015 Red Hat, Inc. - * */ #include "nm-default.h" diff --git a/src/tests/test-wired-defname.c b/src/tests/test-wired-defname.c index 27e0590b..4b557d0c 100644 --- a/src/tests/test-wired-defname.c +++ b/src/tests/test-wired-defname.c @@ -1,20 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ /* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * Copyright (C) 2010 Red Hat, Inc. - * */ #include "nm-default.h" |