public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2] ld/testsuite: don't output to /dev/null
@ 2023-02-20 14:43 Clément Chigot
  2023-02-20 17:11 ` Howard Chu
  2023-02-20 22:18 ` Alan Modra
  0 siblings, 2 replies; 4+ messages in thread
From: Clément Chigot @ 2023-02-20 14:43 UTC (permalink / raw)
  To: binutils; +Cc: amodra, Clément Chigot

Mingw doesn't have /dev/null and thus "-o /dev/null" will fail.
Currently, all the options are checked using this "-o /dev/null",
resulting in them being disabled on mingw hosts.
Fix that by outputting to a real file for all targets.

ld/ChangeLog:

	* testsuite/config/default.exp: Replace "-o /dev/null" by a
	file.
---
 ld/testsuite/config/default.exp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
index 257fd4ba985..1b568b6f8bb 100644
--- a/ld/testsuite/config/default.exp
+++ b/ld/testsuite/config/default.exp
@@ -383,6 +383,7 @@ proc compiler_supports { flag args } {
 	    append flags " [board_info [target_info name] ldflags]"
 	}
 	set fn "cs[pid].c"
+	set fno "cs[pid].exe"
 	set f [open $fn "w"]
 	if { [llength $args] > 0 } {
 	    puts $f [lindex $args 0]
@@ -391,7 +392,8 @@ proc compiler_supports { flag args } {
 	}
 	close $f
 	set rfn [remote_download host $fn]
-	set avail [run_host_cmd_yesno "$CC_FOR_TARGET" "$flags $flag $rfn -o /dev/null"]
+	set avail [run_host_cmd_yesno "$CC_FOR_TARGET" "$flags $flag $rfn -o $fno"]
+	file delete $fno
 	remote_file host delete $rfn
 	file delete $fn
 	return $avail
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ld/testsuite: don't output to /dev/null
  2023-02-20 14:43 [PATCH v2] ld/testsuite: don't output to /dev/null Clément Chigot
@ 2023-02-20 17:11 ` Howard Chu
  2023-02-20 22:22   ` Alan Modra
  2023-02-20 22:18 ` Alan Modra
  1 sibling, 1 reply; 4+ messages in thread
From: Howard Chu @ 2023-02-20 17:11 UTC (permalink / raw)
  To: Clément Chigot, binutils; +Cc: amodra

Clément Chigot via Binutils wrote:
> Mingw doesn't have /dev/null and thus "-o /dev/null" will fail.
> Currently, all the options are checked using this "-o /dev/null",
> resulting in them being disabled on mingw hosts.
> Fix that by outputting to a real file for all targets.

Unless you expect that saving the output will be useful, you could simply
set the $fno variable to "nul:" when running on a Windows OS, and leave it
set to "/dev/null" otherwise.

> 
> ld/ChangeLog:
> 
> 	* testsuite/config/default.exp: Replace "-o /dev/null" by a
> 	file.
> ---
>  ld/testsuite/config/default.exp | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
> index 257fd4ba985..1b568b6f8bb 100644
> --- a/ld/testsuite/config/default.exp
> +++ b/ld/testsuite/config/default.exp
> @@ -383,6 +383,7 @@ proc compiler_supports { flag args } {
>  	    append flags " [board_info [target_info name] ldflags]"
>  	}
>  	set fn "cs[pid].c"
> +	set fno "cs[pid].exe"
>  	set f [open $fn "w"]
>  	if { [llength $args] > 0 } {
>  	    puts $f [lindex $args 0]
> @@ -391,7 +392,8 @@ proc compiler_supports { flag args } {
>  	}
>  	close $f
>  	set rfn [remote_download host $fn]
> -	set avail [run_host_cmd_yesno "$CC_FOR_TARGET" "$flags $flag $rfn -o /dev/null"]
> +	set avail [run_host_cmd_yesno "$CC_FOR_TARGET" "$flags $flag $rfn -o $fno"]
> +	file delete $fno
>  	remote_file host delete $rfn
>  	file delete $fn
>  	return $avail
> 


-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ld/testsuite: don't output to /dev/null
  2023-02-20 14:43 [PATCH v2] ld/testsuite: don't output to /dev/null Clément Chigot
  2023-02-20 17:11 ` Howard Chu
@ 2023-02-20 22:18 ` Alan Modra
  1 sibling, 0 replies; 4+ messages in thread
From: Alan Modra @ 2023-02-20 22:18 UTC (permalink / raw)
  To: Clément Chigot; +Cc: binutils

On Mon, Feb 20, 2023 at 03:43:02PM +0100, Clément Chigot wrote:
> Mingw doesn't have /dev/null and thus "-o /dev/null" will fail.
> Currently, all the options are checked using this "-o /dev/null",
> resulting in them being disabled on mingw hosts.
> Fix that by outputting to a real file for all targets.
> 
> ld/ChangeLog:
> 
> 	* testsuite/config/default.exp: Replace "-o /dev/null" by a
> 	file.
> ---
>  ld/testsuite/config/default.exp | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
> index 257fd4ba985..1b568b6f8bb 100644
> --- a/ld/testsuite/config/default.exp
> +++ b/ld/testsuite/config/default.exp
> @@ -383,6 +383,7 @@ proc compiler_supports { flag args } {
>  	    append flags " [board_info [target_info name] ldflags]"
>  	}
>  	set fn "cs[pid].c"
> +	set fno "cs[pid].exe"
>  	set f [open $fn "w"]
>  	if { [llength $args] > 0 } {
>  	    puts $f [lindex $args 0]
> @@ -391,7 +392,8 @@ proc compiler_supports { flag args } {
>  	}
>  	close $f
>  	set rfn [remote_download host $fn]
> -	set avail [run_host_cmd_yesno "$CC_FOR_TARGET" "$flags $flag $rfn -o /dev/null"]
> +	set avail [run_host_cmd_yesno "$CC_FOR_TARGET" "$flags $flag $rfn -o $fno"]
> +	file delete $fno

I think this should be "remote_file host delete $fno", given where you
are running the compiler.  OK with that fixed.

>  	remote_file host delete $rfn
>  	file delete $fn
>  	return $avail
> -- 
> 2.25.1

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ld/testsuite: don't output to /dev/null
  2023-02-20 17:11 ` Howard Chu
@ 2023-02-20 22:22   ` Alan Modra
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2023-02-20 22:22 UTC (permalink / raw)
  To: Howard Chu; +Cc: Clément Chigot, binutils

On Mon, Feb 20, 2023 at 05:11:47PM +0000, Howard Chu wrote:
> Clément Chigot via Binutils wrote:
> > Mingw doesn't have /dev/null and thus "-o /dev/null" will fail.
> > Currently, all the options are checked using this "-o /dev/null",
> > resulting in them being disabled on mingw hosts.
> > Fix that by outputting to a real file for all targets.
> 
> Unless you expect that saving the output will be useful, you could simply
> set the $fno variable to "nul:" when running on a Windows OS, and leave it
> set to "/dev/null" otherwise.

Yes you could do that too.  I think it's slightly better to run the
same command on all hosts, as it avoids the problem of getting the
host triple checking correct.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-20 22:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-20 14:43 [PATCH v2] ld/testsuite: don't output to /dev/null Clément Chigot
2023-02-20 17:11 ` Howard Chu
2023-02-20 22:22   ` Alan Modra
2023-02-20 22:18 ` Alan Modra

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).