diff options
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/config/meson.build | 2 | ||||
| -rw-r--r-- | src/tests/config/test-config.c | 6 | ||||
| -rw-r--r-- | src/tests/meson.build | 2 | ||||
| -rw-r--r-- | src/tests/test-core-with-expect.c | 16 | ||||
| -rw-r--r-- | src/tests/test-core.c | 2 | ||||
| -rw-r--r-- | src/tests/test-ip6-config.c | 2 | ||||
| -rw-r--r-- | src/tests/test-systemd.c | 2 |
7 files changed, 18 insertions, 14 deletions
diff --git a/src/tests/config/meson.build b/src/tests/config/meson.build index e3ebfa19..cfe9c615 100644 --- a/src/tests/config/meson.build +++ b/src/tests/config/meson.build @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1+ + test_config_dir = meson.current_source_dir() test_unit = 'test-config' diff --git a/src/tests/config/test-config.c b/src/tests/config/test-config.c index 1c28e976..e6c04efd 100644 --- a/src/tests/config/test-config.c +++ b/src/tests/config/test-config.c @@ -978,7 +978,7 @@ test_config_enable (void) guint match_nm_version = _nm_config_match_nm_version; char *match_env = g_strdup (_nm_config_match_env); - g_clear_pointer (&_nm_config_match_env, g_free); + nm_clear_g_free (&_nm_config_match_env); _nm_config_match_env = g_strdup ("something-else"); _nm_config_match_nm_version = nm_encode_version (1, 3, 4); @@ -992,14 +992,14 @@ test_config_enable (void) g_clear_object (&config); _nm_config_match_nm_version = nm_encode_version (1, 5, 3); - g_clear_pointer (&_nm_config_match_env, g_free); + nm_clear_g_free (&_nm_config_match_env); _nm_config_match_env = g_strdup ("test-match-env-1"); config = setup_config (NULL, TEST_DIR "/NetworkManager.conf", "", NULL, TEST_DIR "/conf.d", "", NULL); assert_config_value (nm_config_get_data_orig (config), "test-group-config-enable-1", "key1", "enabled"); g_clear_object (&config); _nm_config_match_nm_version = match_nm_version; - g_clear_pointer (&_nm_config_match_env, g_free); + nm_clear_g_free (&_nm_config_match_env); _nm_config_match_env = match_env; } diff --git a/src/tests/meson.build b/src/tests/meson.build index ac877e18..df8d1cf8 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1+ + subdir('config') test_units = [ diff --git a/src/tests/test-core-with-expect.c b/src/tests/test-core-with-expect.c index 74e1043b..555b9624 100644 --- a/src/tests/test-core-with-expect.c +++ b/src/tests/test-core-with-expect.c @@ -20,7 +20,7 @@ static void test_nm_utils_monotonic_timestamp_as_boottime (void) { - gint64 timestamp_ns_per_tick, now, now_boottime, now_boottime_2, now_boottime_3; + gint64 timestamp_nsec_per_tick, now, now_boottime, now_boottime_2, now_boottime_3; struct timespec tp; clockid_t clockid; guint i; @@ -35,22 +35,22 @@ test_nm_utils_monotonic_timestamp_as_boottime (void) if (clock_gettime (clockid, &tp) != 0) g_assert_not_reached (); - now_boottime = ( ((gint64) tp.tv_sec) * NM_UTILS_NS_PER_SECOND ) + ((gint64) tp.tv_nsec); + now_boottime = ( ((gint64) tp.tv_sec) * NM_UTILS_NSEC_PER_SEC ) + ((gint64) tp.tv_nsec); - now = nm_utils_get_monotonic_timestamp_ns (); + now = nm_utils_get_monotonic_timestamp_nsec (); now_boottime_2 = nm_utils_monotonic_timestamp_as_boottime (now, 1); g_assert_cmpint (now_boottime_2, >=, 0); 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_boottime_2 - now_boottime, <=, NM_UTILS_NSEC_PER_SEC / 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); + for (timestamp_nsec_per_tick = 1; timestamp_nsec_per_tick <= NM_UTILS_NSEC_PER_SEC; timestamp_nsec_per_tick *= 10) { + now_boottime_3 = nm_utils_monotonic_timestamp_as_boottime (now / timestamp_nsec_per_tick, timestamp_nsec_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)); + g_assert_cmpint (now_boottime_2 / timestamp_nsec_per_tick, ==, now_boottime_3); + g_assert_cmpint (now / timestamp_nsec_per_tick, ==, nm_utils_monotonic_timestamp_from_boottime (now_boottime_3, timestamp_nsec_per_tick)); } } } diff --git a/src/tests/test-core.c b/src/tests/test-core.c index 590f7c36..b90a8fac 100644 --- a/src/tests/test-core.c +++ b/src/tests/test-core.c @@ -1019,7 +1019,7 @@ _test_connection_sort_autoconnect_priority_one (NMConnection **list, gboolean sh if (shuffle) { for (i = count - 1; i > 0; i--) { j = g_rand_int (nmtst_get_rand ()) % (i + 1); - NMTST_SWAP (connections->pdata[i], connections->pdata[j]); + NM_SWAP (connections->pdata[i], connections->pdata[j]); } } diff --git a/src/tests/test-ip6-config.c b/src/tests/test-ip6-config.c index 401d1eee..efc32983 100644 --- a/src/tests/test-ip6-config.c +++ b/src/tests/test-ip6-config.c @@ -246,7 +246,7 @@ test_nm_ip6_config_addresses_sort_check (NMIP6Config *config, NMSettingIP6Config for (i = 0; i < addr_count; i++) { int j = g_rand_int_range (nmtst_get_rand (), i, addr_count); - NMTST_SWAP (idx[i], idx[j]); + NM_SWAP (idx[i], idx[j]); nm_ip6_config_add_address (copy, _nmtst_ip6_config_get_address (config, idx[i])); } diff --git a/src/tests/test-systemd.c b/src/tests/test-systemd.c index faed0e56..6425c294 100644 --- a/src/tests/test-systemd.c +++ b/src/tests/test-systemd.c @@ -27,7 +27,7 @@ _nm_utils_set_testing (NMUtilsTestFlags flags) } gint32 -nm_utils_get_monotonic_timestamp_s (void) +nm_utils_get_monotonic_timestamp_sec (void) { return 1; } |