posix: tst-glob_lstat_compat no longer needs to be an internal test

Message ID 87czwdg3n4.fsf@oldenburg.str.redhat.com
State Committed
Commit 8209c5f1f4d0546c1a798a7d34bc8348fd72ff40
Headers
Series posix: tst-glob_lstat_compat no longer needs to be an internal test |

Commit Message

Florian Weimer March 5, 2021, 12:56 p.m. UTC
  compat_symbol_reference is now available for regular tests as well.
Also avoid building and running the tests in case the pre-2.27
symbol version of glob is not available.  This avoids a spurious
UNSUPPORTED result.

---
 posix/Makefile                |  8 +++++++-
 posix/tst-glob_lstat_compat.c | 19 ++++---------------
 2 files changed, 11 insertions(+), 16 deletions(-)
  

Comments

Adhemerval Zanella Netto March 5, 2021, 1:07 p.m. UTC | #1
On 05/03/2021 09:56, Florian Weimer via Libc-alpha wrote:
> compat_symbol_reference is now available for regular tests as well.
> Also avoid building and running the tests in case the pre-2.27
> symbol version of glob is not available.  This avoids a spurious
> UNSUPPORTED result.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> 
> ---
>  posix/Makefile                |  8 +++++++-
>  posix/tst-glob_lstat_compat.c | 19 ++++---------------
>  2 files changed, 11 insertions(+), 16 deletions(-)
> 
> diff --git a/posix/Makefile b/posix/Makefile
> index 239fbb340a..2ee5bb6e1d 100644
> --- a/posix/Makefile
> +++ b/posix/Makefile
> @@ -104,9 +104,15 @@ tests		:= test-errno tstgetopt testfnm runtests runptests \
>  		   tst-glob-tilde test-ssize-max tst-spawn4 bug-regex37 \
>  		   bug-regex38 tst-regcomp-truncated tst-spawn-chdir \
>  		   tst-wordexp-nocmd
> +
> +# Test for the glob symbol version that was replaced in glibc 2.27.
> +ifeq ($(have-GLIBC_2.26)$(build-shared),yesyes)
> +tests += tst-glob_lstat_compat
> +endif
> +
>  tests-internal	:= bug-regex5 bug-regex20 bug-regex33 \
>  		   tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3 \
> -		   tst-glob_lstat_compat tst-spawn4-compat
> +		   tst-spawn4-compat
>  tests-container := bug-ga2
>  xtests		:= tst-getaddrinfo4 tst-getaddrinfo5 tst-sched_rr_get_interval
>  ifeq (yes,$(build-shared))
> diff --git a/posix/tst-glob_lstat_compat.c b/posix/tst-glob_lstat_compat.c
> index ef6f1b8c27..97ee51101b 100644
> --- a/posix/tst-glob_lstat_compat.c
> +++ b/posix/tst-glob_lstat_compat.c
> @@ -25,24 +25,22 @@
>  #include <sys/types.h>
>  #include <sys/stat.h>
>  #include <unistd.h>
> -
> +#include <stdbool.h>
>  #include <stdio.h>
>  
>  #include <shlib-compat.h>
>  #include <support/check.h>
>  #include <support/temp_file.h>
>  
> -#if TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_27)
> -
>  __typeof (glob) glob;
>  /* On alpha glob exists in version GLIBC_2_0, GLIBC_2_1, and GLIBC_2_27.
>     This test needs to access the version prior to GLIBC_2_27, which is
>     GLIBC_2_1 on alpha, GLIBC_2_0 elsewhere.  */
> -# ifdef __alpha__
> +#ifdef __alpha__
>  compat_symbol_reference (libc, glob, glob, GLIBC_2_1);
> -# else
> +#else
>  compat_symbol_reference (libc, glob, glob, GLIBC_2_0);
> -# endif
> +#endif
>  
>  /* Compat glob should not call gl_lstat since for some old binaries it
>     might be unitialized (for instance GNUmake).  Check if it is indeed
> @@ -256,13 +254,4 @@ do_test (void)
>    return 0;
>  }
>  
> -#else /* TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_27)  */
> -
> -static int
> -do_test (void)
> -{
> -  return 77;
> -}
> -#endif
> -
>  #include <support/test-driver.c>
>
  

Patch

diff --git a/posix/Makefile b/posix/Makefile
index 239fbb340a..2ee5bb6e1d 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -104,9 +104,15 @@  tests		:= test-errno tstgetopt testfnm runtests runptests \
 		   tst-glob-tilde test-ssize-max tst-spawn4 bug-regex37 \
 		   bug-regex38 tst-regcomp-truncated tst-spawn-chdir \
 		   tst-wordexp-nocmd
+
+# Test for the glob symbol version that was replaced in glibc 2.27.
+ifeq ($(have-GLIBC_2.26)$(build-shared),yesyes)
+tests += tst-glob_lstat_compat
+endif
+
 tests-internal	:= bug-regex5 bug-regex20 bug-regex33 \
 		   tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3 \
-		   tst-glob_lstat_compat tst-spawn4-compat
+		   tst-spawn4-compat
 tests-container := bug-ga2
 xtests		:= tst-getaddrinfo4 tst-getaddrinfo5 tst-sched_rr_get_interval
 ifeq (yes,$(build-shared))
diff --git a/posix/tst-glob_lstat_compat.c b/posix/tst-glob_lstat_compat.c
index ef6f1b8c27..97ee51101b 100644
--- a/posix/tst-glob_lstat_compat.c
+++ b/posix/tst-glob_lstat_compat.c
@@ -25,24 +25,22 @@ 
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
-
+#include <stdbool.h>
 #include <stdio.h>
 
 #include <shlib-compat.h>
 #include <support/check.h>
 #include <support/temp_file.h>
 
-#if TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_27)
-
 __typeof (glob) glob;
 /* On alpha glob exists in version GLIBC_2_0, GLIBC_2_1, and GLIBC_2_27.
    This test needs to access the version prior to GLIBC_2_27, which is
    GLIBC_2_1 on alpha, GLIBC_2_0 elsewhere.  */
-# ifdef __alpha__
+#ifdef __alpha__
 compat_symbol_reference (libc, glob, glob, GLIBC_2_1);
-# else
+#else
 compat_symbol_reference (libc, glob, glob, GLIBC_2_0);
-# endif
+#endif
 
 /* Compat glob should not call gl_lstat since for some old binaries it
    might be unitialized (for instance GNUmake).  Check if it is indeed
@@ -256,13 +254,4 @@  do_test (void)
   return 0;
 }
 
-#else /* TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_27)  */
-
-static int
-do_test (void)
-{
-  return 77;
-}
-#endif
-
 #include <support/test-driver.c>