run sysconf-requiring test on systems that support it

Message ID orft0lavkg.fsf@lxoliva.fsfla.org
State New
Headers show
Series
  • run sysconf-requiring test on systems that support it
Related show

Commit Message

Alexandre Oliva March 24, 2021, 6:56 a.m.
The gcc.target/i386 test sse2-mmx-maskmovq.c requires the mmap
feature, but that's not enough for the test to be able to call
sysconf.

I've combined the target triplets used in other sysconf-calling tests,
omitting non-x86 ones, with the preexisting mmap requirement in this
test.

Regstrapped on x86_64-linux-gnu and cross-tested for x86_64-vx7r2 along
with other patches, mostly for the testsuite.  Ok to install?


for  gcc/testsuite/ChangeLog

	* gcc.target/i386/sse2-mmx-maskmovq.c: Require
	sysconf-supporting x86 target triplets.
---
 gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


-- 
Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/
   Free Software Activist         GNU Toolchain Engineer
        Vim, Vi, Voltei pro Emacs -- GNUlius Caesar

Comments

H.J. Lu via Gcc-patches March 24, 2021, 7:17 a.m. | #1
On Wed, Mar 24, 2021 at 7:56 AM Alexandre Oliva <oliva@adacore.com> wrote:
>

>

> The gcc.target/i386 test sse2-mmx-maskmovq.c requires the mmap

> feature, but that's not enough for the test to be able to call

> sysconf.

>

> I've combined the target triplets used in other sysconf-calling tests,

> omitting non-x86 ones, with the preexisting mmap requirement in this

> test.


There are several other tests in gcc.target/i386 directory that call sysconf:

pr95443-1.c:  size_t page_size = 2 * sysconf(_SC_PAGESIZE);
pr95443-2.c:  size_t page_size = 2 * sysconf(_SC_PAGESIZE);
sse2-mmx-maskmovq.c:  size_t page_size = sysconf(_SC_PAGESIZE);
strncmp-1.c:  size_t page_size = sysconf(_SC_PAGESIZE);

and they all have only:

/* { dg-do run { target mmap } } */

without any other target selectors.

Do these functions also fail, or is sse2-mmx-maskmovq.c special in some way?

Uros.

> Regstrapped on x86_64-linux-gnu and cross-tested for x86_64-vx7r2 along

> with other patches, mostly for the testsuite.  Ok to install?

>

>

> for  gcc/testsuite/ChangeLog

>

>         * gcc.target/i386/sse2-mmx-maskmovq.c: Require

>         sysconf-supporting x86 target triplets.

> ---

>  gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c |    2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

>

> diff --git a/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c b/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c

> index 037f665f1178a..ad4bbf7c76451 100644

> --- a/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c

> +++ b/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c

> @@ -1,4 +1,4 @@

> -/* { dg-do run { target mmap } } */

> +/* { dg-do run { target { { *-*-linux* *-*-gnu* *-*-darwin[912]* *-*-uclinux* } && mmap } } } */

>  /* { dg-options "-O2 -fno-strict-aliasing -msse2" } */

>  /* { dg-additional-options "-mno-mmx" { target { ! ia32 } } } */

>

>

> --

> Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/

>    Free Software Activist         GNU Toolchain Engineer

>         Vim, Vi, Voltei pro Emacs -- GNUlius Caesar
H.J. Lu via Gcc-patches March 24, 2021, 7:29 a.m. | #2
On Wed, Mar 24, 2021 at 8:17 AM Uros Bizjak <ubizjak@gmail.com> wrote:
>

> On Wed, Mar 24, 2021 at 7:56 AM Alexandre Oliva <oliva@adacore.com> wrote:

> >

> >

> > The gcc.target/i386 test sse2-mmx-maskmovq.c requires the mmap

> > feature, but that's not enough for the test to be able to call

> > sysconf.

> >

> > I've combined the target triplets used in other sysconf-calling tests,

> > omitting non-x86 ones, with the preexisting mmap requirement in this

> > test.

>

> There are several other tests in gcc.target/i386 directory that call sysconf:

>

> pr95443-1.c:  size_t page_size = 2 * sysconf(_SC_PAGESIZE);

> pr95443-2.c:  size_t page_size = 2 * sysconf(_SC_PAGESIZE);

> sse2-mmx-maskmovq.c:  size_t page_size = sysconf(_SC_PAGESIZE);

> strncmp-1.c:  size_t page_size = sysconf(_SC_PAGESIZE);

>

> and they all have only:

>

> /* { dg-do run { target mmap } } */

>

> without any other target selectors.

>

> Do these functions also fail, or is sse2-mmx-maskmovq.c special in some way?


Other than above, can you please introduce
check_effectve_target_sysconf to lib/target-supports.exp (similar to
existing check_effective_target_mmap) and use it instead of target
selectors? The testsuite is moving away from target checks to feature
tests, so bonus points if you also convert existing testcases to a new
feature test.

Uros.

> > Regstrapped on x86_64-linux-gnu and cross-tested for x86_64-vx7r2 along

> > with other patches, mostly for the testsuite.  Ok to install?

> >

> >

> > for  gcc/testsuite/ChangeLog

> >

> >         * gcc.target/i386/sse2-mmx-maskmovq.c: Require

> >         sysconf-supporting x86 target triplets.

> > ---

> >  gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c |    2 +-

> >  1 file changed, 1 insertion(+), 1 deletion(-)

> >

> > diff --git a/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c b/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c

> > index 037f665f1178a..ad4bbf7c76451 100644

> > --- a/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c

> > +++ b/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c

> > @@ -1,4 +1,4 @@

> > -/* { dg-do run { target mmap } } */

> > +/* { dg-do run { target { { *-*-linux* *-*-gnu* *-*-darwin[912]* *-*-uclinux* } && mmap } } } */

> >  /* { dg-options "-O2 -fno-strict-aliasing -msse2" } */

> >  /* { dg-additional-options "-mno-mmx" { target { ! ia32 } } } */

> >

> >

> > --

> > Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/

> >    Free Software Activist         GNU Toolchain Engineer

> >         Vim, Vi, Voltei pro Emacs -- GNUlius Caesar
Alexandre Oliva March 24, 2021, 8:45 a.m. | #3
On Mar 24, 2021, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Mar 24, 2021, Uros Bizjak <ubizjak@gmail.com> wrote:


>> There are several other tests in gcc.target/i386 directory that call sysconf:


Ooh, indeed, thanks, good catch.

The reason I didn't catch them was that the full test results analysis
that got me started at it was in a gcc-10 branch, that doesn't have
those other tests.  In the trunk, I only ran regression testing for the
patch, so I didn't notice that there were other fails, before and after,
for the same reasons.

> Other than above, can you please introduce

> check_effectve_target_sysconf to lib/target-supports.exp (similar to

> existing check_effective_target_mmap) and use it instead of target

> selectors?


I'll take care of that, and of the fails I'd missed.  Thanks!

> The testsuite is moving away from target checks to feature tests, so

> bonus points if you also convert existing testcases to a new feature

> test.


*nod*

-- 
Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/
   Free Software Activist         GNU Toolchain Engineer
        Vim, Vi, Voltei pro Emacs -- GNUlius Caesar
Alexandre Oliva March 24, 2021, 9:14 a.m. | #4
On Mar 24, 2021, Uros Bizjak <ubizjak@gmail.com> wrote:

> Other than above, can you please introduce

> check_effectve_target_sysconf to lib/target-supports.exp (similar to

> existing check_effective_target_mmap) and use it instead of target

> selectors?


Here it is.  I've tested the affected tests with it.  I'll give it a
full regstrap cycle, along with other patches.  Ok to install if it
passes?


run sysconf-requiring test on systems that support it

Some gcc.target/i386 tests requires the mmap feature, but that's not
enough for the test to be able to call sysconf.

This patch introduces a sysconf feature, analogous to mmap, and adds
it to tests in gcc.target/i386 that call sysconf.

There are other tests within gcc.dg and g++.dg that call sysconf, but
I haven't added the tag to them, because they already cover it with
target triplets.  I was a little nervous about dropping the triplets,
and saw how they implied sysconf, so I left those alone.


for  gcc/testsuite/ChangeLog

	* lib/target-supports.exp (check_effective_target_sysconf): New.
	* gcc/doc/sourcebuild.texi (syconf): Document it.
	* gcc.target/i386/pr95443-1.c: Require it.
	* gcc.target/i386/pr95443-2.c: Likewise.
	* gcc.target/i386/sse2-mmx-maskmovq.c: Likewise.
	* gcc.target/i386/strncmp-1.c: Likewise.
---
 gcc/doc/sourcebuild.texi                          |    3 +++
 gcc/testsuite/gcc.target/i386/pr95443-1.c         |    2 +-
 gcc/testsuite/gcc.target/i386/pr95443-2.c         |    2 +-
 gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c |    2 +-
 gcc/testsuite/gcc.target/i386/strncmp-1.c         |    2 +-
 gcc/testsuite/lib/target-supports.exp             |    6 ++++++
 6 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 2bc362be4495d..0104916e66031 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2450,6 +2450,9 @@ all targets.
 @item stpcpy
 Target provides @code{stpcpy} function.
 
+@item sysconf
+Target supports @code{sysconf}.
+
 @item trampolines
 Target supports trampolines.
 
diff --git a/gcc/testsuite/gcc.target/i386/pr95443-1.c b/gcc/testsuite/gcc.target/i386/pr95443-1.c
index 698dfa0218968..d846fcbda0a2e 100644
--- a/gcc/testsuite/gcc.target/i386/pr95443-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr95443-1.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target mmap } } */
+/* { dg-do run { target { sysconf && mmap } } } */
 /* { dg-options "-O2 -minline-all-stringops" } */
 
 #include <stdint.h>
diff --git a/gcc/testsuite/gcc.target/i386/pr95443-2.c b/gcc/testsuite/gcc.target/i386/pr95443-2.c
index 23bb13ab7ff11..2ab260608bc26 100644
--- a/gcc/testsuite/gcc.target/i386/pr95443-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr95443-2.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target mmap } } */
+/* { dg-do run { target { sysconf && mmap } } } */
 /* { dg-options "-O2 -minline-all-stringops" } */
 
 #include <stdint.h>
diff --git a/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c b/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c
index 037f665f1178a..87705be3f70d7 100644
--- a/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c
+++ b/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target mmap } } */
+/* { dg-do run { target { sysconf && mmap } } } */
 /* { dg-options "-O2 -fno-strict-aliasing -msse2" } */
 /* { dg-additional-options "-mno-mmx" { target { ! ia32 } } } */
 
diff --git a/gcc/testsuite/gcc.target/i386/strncmp-1.c b/gcc/testsuite/gcc.target/i386/strncmp-1.c
index 044fc5cc5fa1b..1ea3e0a57c1de 100644
--- a/gcc/testsuite/gcc.target/i386/strncmp-1.c
+++ b/gcc/testsuite/gcc.target/i386/strncmp-1.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target mmap } } */
+/* { dg-do run { target { sysconf && mmap } } } */
 /* { dg-options "-O2" } */
 
 #include <stdio.h>
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 733b6c8451851..1230d19421544 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1067,6 +1067,12 @@ proc check_effective_target_mmap {} {
     return [check_function_available "mmap"]
 }
 
+# Return 1 if the target supports sysconf, 0 otherwise.
+
+proc check_effective_target_sysconf {} {
+    return [check_function_available "sysconf"]
+}
+
 # Return 1 if the target supports dlopen, 0 otherwise.
 proc check_effective_target_dlopen {} {
     return [check_no_compiler_messages dlopen executable {


-- 
Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/
   Free Software Activist         GNU Toolchain Engineer
        Vim, Vi, Voltei pro Emacs -- GNUlius Caesar
H.J. Lu via Gcc-patches March 24, 2021, 9:31 a.m. | #5
On Wed, Mar 24, 2021 at 10:14 AM Alexandre Oliva <oliva@adacore.com> wrote:
>

> On Mar 24, 2021, Uros Bizjak <ubizjak@gmail.com> wrote:

>

> > Other than above, can you please introduce

> > check_effectve_target_sysconf to lib/target-supports.exp (similar to

> > existing check_effective_target_mmap) and use it instead of target

> > selectors?

>

> Here it is.  I've tested the affected tests with it.  I'll give it a

> full regstrap cycle, along with other patches.  Ok to install if it

> passes?


FYI, testsuite patches do not need a full bootstrap. It is pointless,
since they do not touch the compiler source.

> run sysconf-requiring test on systems that support it

>

> Some gcc.target/i386 tests requires the mmap feature, but that's not

> enough for the test to be able to call sysconf.

>

> This patch introduces a sysconf feature, analogous to mmap, and adds

> it to tests in gcc.target/i386 that call sysconf.

>

> There are other tests within gcc.dg and g++.dg that call sysconf, but

> I haven't added the tag to them, because they already cover it with

> target triplets.  I was a little nervous about dropping the triplets,

> and saw how they implied sysconf, so I left those alone.

>

>

> for  gcc/testsuite/ChangeLog

>

>         * lib/target-supports.exp (check_effective_target_sysconf): New.

>         * gcc/doc/sourcebuild.texi (syconf): Document it.

>         * gcc.target/i386/pr95443-1.c: Require it.

>         * gcc.target/i386/pr95443-2.c: Likewise.

>         * gcc.target/i386/sse2-mmx-maskmovq.c: Likewise.

>         * gcc.target/i386/strncmp-1.c: Likewise.


OK.

Thanks,
Uros.

> ---

>  gcc/doc/sourcebuild.texi                          |    3 +++

>  gcc/testsuite/gcc.target/i386/pr95443-1.c         |    2 +-

>  gcc/testsuite/gcc.target/i386/pr95443-2.c         |    2 +-

>  gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c |    2 +-

>  gcc/testsuite/gcc.target/i386/strncmp-1.c         |    2 +-

>  gcc/testsuite/lib/target-supports.exp             |    6 ++++++

>  6 files changed, 13 insertions(+), 4 deletions(-)

>

> diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi

> index 2bc362be4495d..0104916e66031 100644

> --- a/gcc/doc/sourcebuild.texi

> +++ b/gcc/doc/sourcebuild.texi

> @@ -2450,6 +2450,9 @@ all targets.

>  @item stpcpy

>  Target provides @code{stpcpy} function.

>

> +@item sysconf

> +Target supports @code{sysconf}.

> +

>  @item trampolines

>  Target supports trampolines.

>

> diff --git a/gcc/testsuite/gcc.target/i386/pr95443-1.c b/gcc/testsuite/gcc.target/i386/pr95443-1.c

> index 698dfa0218968..d846fcbda0a2e 100644

> --- a/gcc/testsuite/gcc.target/i386/pr95443-1.c

> +++ b/gcc/testsuite/gcc.target/i386/pr95443-1.c

> @@ -1,4 +1,4 @@

> -/* { dg-do run { target mmap } } */

> +/* { dg-do run { target { sysconf && mmap } } } */

>  /* { dg-options "-O2 -minline-all-stringops" } */

>

>  #include <stdint.h>

> diff --git a/gcc/testsuite/gcc.target/i386/pr95443-2.c b/gcc/testsuite/gcc.target/i386/pr95443-2.c

> index 23bb13ab7ff11..2ab260608bc26 100644

> --- a/gcc/testsuite/gcc.target/i386/pr95443-2.c

> +++ b/gcc/testsuite/gcc.target/i386/pr95443-2.c

> @@ -1,4 +1,4 @@

> -/* { dg-do run { target mmap } } */

> +/* { dg-do run { target { sysconf && mmap } } } */

>  /* { dg-options "-O2 -minline-all-stringops" } */

>

>  #include <stdint.h>

> diff --git a/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c b/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c

> index 037f665f1178a..87705be3f70d7 100644

> --- a/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c

> +++ b/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c

> @@ -1,4 +1,4 @@

> -/* { dg-do run { target mmap } } */

> +/* { dg-do run { target { sysconf && mmap } } } */

>  /* { dg-options "-O2 -fno-strict-aliasing -msse2" } */

>  /* { dg-additional-options "-mno-mmx" { target { ! ia32 } } } */

>

> diff --git a/gcc/testsuite/gcc.target/i386/strncmp-1.c b/gcc/testsuite/gcc.target/i386/strncmp-1.c

> index 044fc5cc5fa1b..1ea3e0a57c1de 100644

> --- a/gcc/testsuite/gcc.target/i386/strncmp-1.c

> +++ b/gcc/testsuite/gcc.target/i386/strncmp-1.c

> @@ -1,4 +1,4 @@

> -/* { dg-do run { target mmap } } */

> +/* { dg-do run { target { sysconf && mmap } } } */

>  /* { dg-options "-O2" } */

>

>  #include <stdio.h>

> diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp

> index 733b6c8451851..1230d19421544 100644

> --- a/gcc/testsuite/lib/target-supports.exp

> +++ b/gcc/testsuite/lib/target-supports.exp

> @@ -1067,6 +1067,12 @@ proc check_effective_target_mmap {} {

>      return [check_function_available "mmap"]

>  }

>

> +# Return 1 if the target supports sysconf, 0 otherwise.

> +

> +proc check_effective_target_sysconf {} {

> +    return [check_function_available "sysconf"]

> +}

> +

>  # Return 1 if the target supports dlopen, 0 otherwise.

>  proc check_effective_target_dlopen {} {

>      return [check_no_compiler_messages dlopen executable {

>

>

> --

> Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/

>    Free Software Activist         GNU Toolchain Engineer

>         Vim, Vi, Voltei pro Emacs -- GNUlius Caesar
Alexandre Oliva March 24, 2021, 10:23 a.m. | #6
On Mar 24, 2021, Uros Bizjak <ubizjak@gmail.com> wrote:

> FYI, testsuite patches do not need a full bootstrap.


*nod*, it was the "along with other patches" that was the key.  But
yeah, this was a patch that was extremely unlikely to introduce
fails in the testsuite, so I went ahead and put it in, after fixing
typos in the ChangeLog:

>> * gcc/doc/sourcebuild.texi (syconf): Document it.


Moved to gcc/ChangeLog, without gcc/, and added the missing s in sy+s+conf.

Thanks!

-- 
Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/
   Free Software Activist         GNU Toolchain Engineer
        Vim, Vi, Voltei pro Emacs -- GNUlius Caesar

Patch

diff --git a/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c b/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c
index 037f665f1178a..ad4bbf7c76451 100644
--- a/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c
+++ b/gcc/testsuite/gcc.target/i386/sse2-mmx-maskmovq.c
@@ -1,4 +1,4 @@ 
-/* { dg-do run { target mmap } } */
+/* { dg-do run { target { { *-*-linux* *-*-gnu* *-*-darwin[912]* *-*-uclinux* } && mmap } } } */
 /* { dg-options "-O2 -fno-strict-aliasing -msse2" } */
 /* { dg-additional-options "-mno-mmx" { target { ! ia32 } } } */