public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org
Subject: [PATCH 5/6] resolv: Make tst-resolv-qtypes a regular test
Date: Thu,  9 Jul 2026 14:48:18 -0300	[thread overview]
Message-ID: <20260709174957.670741-6-adhemerval.zanella@linaro.org> (raw)
In-Reply-To: <20260709174957.670741-1-adhemerval.zanella@linaro.org>

The record type is an opaque 16-bit value on the query path, so sweeping
all 1..65535 values sent millions of packets with no added coverage over
a representative sample.

Test a curated set instead and move it out of xtests.
---
 resolv/Makefile            |  4 +---
 resolv/tst-resolv-qtypes.c | 17 +++++++++++++++--
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/resolv/Makefile b/resolv/Makefile
index 28f6ba6c3b5..73983eb13c3 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -123,6 +123,7 @@ tests += \
   tst-resolv-noaaaa \
   tst-resolv-noaaaa-vc \
   tst-resolv-nondecimal \
+  tst-resolv-qtypes \
   tst-resolv-res_init-failure \
   tst-resolv-res_init-multi \
   tst-resolv-search \
@@ -184,9 +185,6 @@ ifeq ($(have-GLIBC_2.26)$(build-shared),yesyes)
 tests += tst-p_secstodate
 endif
 
-# This test sends millions of packets and is rather slow.
-xtests += tst-resolv-qtypes
-
 # This test has dropped packet tests and runs for a long time.
 xtests += tst-resolv-rotate
 endif # $(have-thread-library)
diff --git a/resolv/tst-resolv-qtypes.c b/resolv/tst-resolv-qtypes.c
index f2f97a334ee..69588748afe 100644
--- a/resolv/tst-resolv-qtypes.c
+++ b/resolv/tst-resolv-qtypes.c
@@ -16,6 +16,7 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <array_length.h>
 #include <resolv.h>
 #include <string.h>
 #include <support/check.h>
@@ -29,6 +30,18 @@
    over TCP instead of UDP.  */
 static volatile bool force_tcp;
 
+/* The record type is an opaque 16-bit value on the query path, so this
+   representative sample (low values, well-known and meta record types,
+   and values around the 8-bit and 16-bit boundaries) exercises the same
+   code as the full 1..65535 range at a fraction of the cost.  */
+static const int qtypes[] =
+  {
+    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+    28, 33, 35, 39, 41, 43, 46, 47, 48, 52, 99, 108, 249, 250, 251,
+    252, 253, 254, 255, 256, 257, 511, 512, 1000, 4096, 32767, 32768,
+    32769, 65534, 65535,
+  };
+
 /* Send back a fake resource record matching the QTYPE.  */
 static void
 response (const struct resolv_response_context *ctx,
@@ -133,8 +146,9 @@ test_function (const char *fname,
   for (int tcp = 0; tcp < 2; ++tcp)
     {
       force_tcp = tcp;
-      for (unsigned int type = 1; type <= 65535; ++type)
+      for (size_t i = 0; i < array_length (qtypes); ++i)
         {
+          unsigned int type = qtypes[i];
           if (test_verbose)
             printf ("info: sending QTYPE %d with %s (tcp=%d)\n",
                     type, fname, tcp);
@@ -181,5 +195,4 @@ do_test (void)
   return 0;
 }
 
-#define TIMEOUT 300
 #include <support/test-driver.c>
-- 
2.43.0


  parent reply	other threads:[~2026-07-09 17:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09 17:48 [PATCH 0/6] Move some xtests to make check Adhemerval Zanella
2026-07-09 17:48 ` [PATCH 1/6] nss: Use test resolver for tst-getaddrinfo4 Adhemerval Zanella
2026-07-10  9:16   ` Florian Weimer
2026-07-09 17:48 ` [PATCH 2/6] nss: Use test resolver for tst-getaddrinfo5 Adhemerval Zanella
2026-07-09 17:48 ` [PATCH 3/6] nss: Use test resolver for bug-erange Adhemerval Zanella
2026-07-09 17:48 ` [PATCH 4/6] sunrpc: Remove obsolete tst-getmyaddr and thrsvc xtests Adhemerval Zanella
2026-07-09 17:57   ` Sam James
2026-07-09 18:28     ` Adhemerval Zanella Netto
2026-07-10  9:19     ` Florian Weimer
2026-07-09 17:48 ` Adhemerval Zanella [this message]
2026-07-09 17:48 ` [PATCH 6/6] iconv: Replace test-iconvconfig xtest with a container test Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260709174957.670741-6-adhemerval.zanella@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).