I wrote: > This set of patches makes use of streq() instead of strcmp() == 0, > in all the Gnulib tests. It's a worthy simplification, I would say.
The CI reports a link error in the "clang + ASAN + UBSAN" configuration: /usr/bin/ld: test-execute-child.o: in function `main': test-execute-child.c:(.text+0x3e3): undefined reference to `streq' /usr/bin/ld: test-execute-child.c:(.text+0x4cb): undefined reference to `streq' /usr/bin/ld: test-execute-child.c:(.text+0x5b3): undefined reference to `streq' /usr/bin/ld: test-execute-child.c:(.text+0x69b): undefined reference to `streq' /usr/bin/ld: test-execute-child.c:(.text+0x783): undefined reference to `streq' /usr/bin/ld: test-execute-child.o:test-execute-child.c:(.text+0x86b): more undefined references to `streq' follow clang: error: linker command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile:20291: test-execute-child] Error 1 This patch fixes it. 2026-03-02 Bruno Haible <[email protected]> tests: Use streq, part 5. * tests/test-execute-child.c: Revert last change. * modules/execute-tests (Depends-on): Remove streq.
>From ad4bc5cbab8411213f41493b8c82888b5ecceada Mon Sep 17 00:00:00 2001 From: Bruno Haible <[email protected]> Date: Mon, 2 Mar 2026 09:59:03 +0100 Subject: [PATCH] tests: Use streq, part 5. * tests/test-execute-child.c: Revert last change. * modules/execute-tests (Depends-on): Remove streq. --- ChangeLog | 6 ++++++ modules/execute-tests | 1 - tests/test-execute-child.c | 24 ++++++++++++------------ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ca08daa9e..16e0518d7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2026-03-02 Bruno Haible <[email protected]> + + tests: Use streq, part 5. + * tests/test-execute-child.c: Revert last change. + * modules/execute-tests (Depends-on): Remove streq. + 2026-03-01 Bruno Haible <[email protected]> stdcountof-h tests: Avoid a clang warning. diff --git a/modules/execute-tests b/modules/execute-tests index d5e459ec5a..808c3a29c3 100644 --- a/modules/execute-tests +++ b/modules/execute-tests @@ -18,7 +18,6 @@ read-file bool stdint-h unistd-h -streq memeq configure.ac: diff --git a/tests/test-execute-child.c b/tests/test-execute-child.c index b5c636ade6..4a6c4b1520 100644 --- a/tests/test-execute-child.c +++ b/tests/test-execute-child.c @@ -125,16 +125,16 @@ main (int argc, char *argv[]) case 2: /* Check argument passing. */ return !(argc == 12 - && streq (argv[2], "abc def") - && streq (argv[3], "abc\"def\"ghi") - && streq (argv[4], "xyz\"") - && streq (argv[5], "abc\\def\\ghi") - && streq (argv[6], "xyz\\") - && streq (argv[7], "???") - && streq (argv[8], "***") - && streq (argv[9], "") - && streq (argv[10], "foo") - && streq (argv[11], "")); + && strcmp (argv[2], "abc def") == 0 + && strcmp (argv[3], "abc\"def\"ghi") == 0 + && strcmp (argv[4], "xyz\"") == 0 + && strcmp (argv[5], "abc\\def\\ghi") == 0 + && strcmp (argv[6], "xyz\\") == 0 + && strcmp (argv[7], "???") == 0 + && strcmp (argv[8], "***") == 0 + && strcmp (argv[9], "") == 0 + && strcmp (argv[10], "foo") == 0 + && strcmp (argv[11], "") == 0); #if !(defined _WIN32 && !defined __CYGWIN__) case 3: /* Check SIGPIPE handling with ignore_sigpipe = false. */ @@ -192,7 +192,7 @@ main (int argc, char *argv[]) p += strlen (p); } const char *expected = (test < 16 ? "0 1 2 10 " : "0 1 2 "); - if (streq (buf, expected)) + if (strcmp (buf, expected) == 0) return 0; else { @@ -243,7 +243,7 @@ main (int argc, char *argv[]) if (getcwd (cwd, sizeof (cwd)) == NULL) return 2; #endif - return (argc == 3 && streq (argv[2], cwd) ? 0 : 3); + return (argc == 3 && strcmp (argv[2], cwd) == 0 ? 0 : 3); } default: abort (); -- 2.52.0
