]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-nss-hosts: treat negative host lookup as slow 31445/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 22 Feb 2024 10:35:07 +0000 (11:35 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 22 Feb 2024 10:37:17 +0000 (11:37 +0100)
The negative lookup can be quite slow. On my local network, skipping
this test saves about half of the runtime of test-nss-hosts.

src/test/test-nss-hosts.c

index 7758f0adc988b5ab267f176f7282f37edc740a9e..72a9c6454c600212ac5e9fb279e6eeb6e7fcf7f6 100644 (file)
@@ -451,7 +451,11 @@ static int parse_argv(int argc, char **argv,
         } else {
                 _cleanup_free_ char *hostname = NULL;
                 assert_se(hostname = gethostname_malloc());
-                assert_se(names = strv_new("localhost", "_gateway", "_outbound", "foo_no_such_host", hostname));
+                assert_se(names = strv_new("localhost",
+                                           "_gateway",
+                                           "_outbound",
+                                           hostname,
+                                           slow_tests_enabled() ? "foo_no_such_host" : NULL));
 
                 n = make_addresses(&addrs);
                 assert_se(n >= 0);