math: Add a no-mathvec flag for sin (-0.0)
[glibc.git] / nss / tst-nss-gai-hv2-canonname.c
blobd5f10c07d6a9077325cee56c9920b845052e3c68
1 /* Test NSS query path for plugins that only implement gethostbyname2
2 (#30843).
3 Copyright The GNU Toolchain Authors.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
20 #include <nss.h>
21 #include <netdb.h>
22 #include <stdlib.h>
23 #include <string.h>
24 #include <support/check.h>
25 #include <support/xstdio.h>
26 #include "nss/tst-nss-gai-hv2-canonname.h"
28 #define PREPARE do_prepare
30 static void do_prepare (int a, char **av)
32 FILE *hosts = xfopen ("/etc/hosts", "w");
33 for (unsigned i = 2; i < 255; i++)
35 fprintf (hosts, "ff01::ff02:ff03:%u:2\ttest.example.com\n", i);
36 fprintf (hosts, "192.168.0.%u\ttest.example.com\n", i);
38 xfclose (hosts);
41 static int
42 do_test (void)
44 __nss_configure_lookup ("hosts", "test_gai_hv2_canonname");
46 struct addrinfo hints = {};
47 struct addrinfo *result = NULL;
49 hints.ai_family = AF_INET6;
50 hints.ai_flags = AI_ALL | AI_V4MAPPED | AI_CANONNAME;
52 int ret = getaddrinfo (QUERYNAME, NULL, &hints, &result);
54 if (ret != 0)
55 FAIL_EXIT1 ("getaddrinfo failed: %s\n", gai_strerror (ret));
57 TEST_COMPARE_STRING (result->ai_canonname, QUERYNAME);
59 freeaddrinfo(result);
60 return 0;
63 #include <support/test-driver.c>