diff mbox

[testsuite] Skip gcc.dg/lto/pr60449_0.c for mips*-*-elf* targets.

Message ID A614194ED15B4844BC4C9FB7F21FCD92704562D8@hhmail02.hh.imgtec.org
State New
Headers show

Commit Message

Toma Tabacu March 1, 2017, 4:15 p.m. UTC
Hi Rainer,

Thank you for the feedback.

As you suggested, I have added a check_gettimeofday_available proc in
target-supports.exp and a dg-require-gettimeofday proc in target-supports-dg.exp
which check for gettimeofday using the existing check_function_available proc.

The test still runs and passes on mips-mti-linux-gnu, which has support for
gettimeofday, but it is now skipped for mips-mti-elf, which doesn't support it
(in my configuration, at least).

I have also removed the dg-skip-if for AVR from the test (haven't tested it on
AVR, though).

What do you think ?

Catherine, would this interfere with the MIPS ELF targets which do support
gettimeofday ?

Regards,
Toma

gcc/testsuite/

	* gcc.dg/lto/pr60449_0.c: Add dg-require-gettimeofday. Remove
	dg-skip-if for AVR.
	* lib/target-supports-dg.exp (dg-require-gettimeofday): New function.
	* lib/target-supports.exp (check_gettimeofday_available): Likewise.

Comments

Rainer Orth March 2, 2017, 8:46 a.m. UTC | #1
Hi Toma,

> As you suggested, I have added a check_gettimeofday_available proc in
> target-supports.exp and a dg-require-gettimeofday proc in target-supports-dg.exp
> which check for gettimeofday using the existing check_function_available proc.

that's not what I suggested (or at least meant to suggest): having
gettimeofday as an effective-target keyword (like setrlimit, mmap, and
others) is the way to go, just your previous implementation of
check_effective_target_gettimeofday was problematic/unreliable.

If you go this route, there's no need to modify target-supports-dg.exp
at all.

Besides: I forget to mention that new effective-target keywords need to
be documented in sourcebuild.texi.

Sorry for the confusion.

	Rainer
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.dg/lto/pr60449_0.c b/gcc/testsuite/gcc.dg/lto/pr60449_0.c
index 5b878a6..2d3a900 100644
--- a/gcc/testsuite/gcc.dg/lto/pr60449_0.c
+++ b/gcc/testsuite/gcc.dg/lto/pr60449_0.c
@@ -1,5 +1,5 @@ 
 /* { dg-lto-do link } */
-/* { dg-skip-if "Needs gettimeofday" { "avr-*-*" } } */
+/* { dg-require-gettimeofday "" } */
 
 extern int printf (const char *__restrict __format, ...);
 typedef long int __time_t;
diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp
index 6400d64..41369aa 100644
--- a/gcc/testsuite/lib/target-supports-dg.exp
+++ b/gcc/testsuite/lib/target-supports-dg.exp
@@ -236,6 +236,15 @@  proc dg-require-mkfifo { args } {
     }
 }
 
+# If this target does not have gettimeofday, skip this test.
+
+proc dg-require-gettimeofday { args } {
+    if { ![check_gettimeofday_available] } {
+	upvar dg-do-what dg-do-what
+        set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+    }
+}
+
 # If this target does not use __cxa_atexit, skip this test.
 
 proc dg-require-cxa-atexit { args } {
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 2766af4..9794383 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2287,6 +2287,12 @@  proc check_mkfifo_available {} {
     return [check_function_available "mkfifo"]
 }
 
+# Returns true iff "gettimeofday" is available on the target system.
+
+proc check_gettimeofday_available {} {
+    return [check_function_available "gettimeofday"]
+}
+
 # Returns true iff "__cxa_atexit" is used on the target system.
 
 proc check_cxa_atexit_available { } {