diff mbox series

options.exp: unsupport tests that depend on missing language

Message ID ortut4zqbr.fsf@lxoliva.fsfla.org
State New
Headers show
Series options.exp: unsupport tests that depend on missing language | expand

Commit Message

Alexandre Oliva Dec. 2, 2020, 6:15 a.m. UTC
There's a help.exp test that checks that the help message for
-Wabsolute-value mentions it's available in C and ObjC, when compiling
a C++ program.

However, if GCC is built with the C++ language disabled, the
.cc file is compiled as C, and the message [available in C...] becomes
[disabled] instead, because that's the default for the flag in C.

I suppose it might also be possible to disable the C language, and
then the multitude of help.exp tests that name c as the source
language will fail.

This patch avoids these fails: it detects the message "compiler not
installed" in the compiler output, and bails out as "unsupported".

Regstrapped on x86_64-linux-gnu; also tested with a cross compiler to
arm-eabi with C++ disabled.  Ok to install?


for  gcc/testsuite/ChangeLog

	* lib/options.exp (check_for_options_with_filter): Detect
	unavailable compiler for the selected language, and bail out
	as unsupported.
---
 gcc/testsuite/lib/options.exp |    5 +++++
 1 file changed, 5 insertions(+)

Comments

Jeff Law Dec. 2, 2020, 6:30 p.m. UTC | #1
On 12/1/20 11:15 PM, Alexandre Oliva wrote:
> There's a help.exp test that checks that the help message for
> -Wabsolute-value mentions it's available in C and ObjC, when compiling
> a C++ program.
>
> However, if GCC is built with the C++ language disabled, the
> .cc file is compiled as C, and the message [available in C...] becomes
> [disabled] instead, because that's the default for the flag in C.
>
> I suppose it might also be possible to disable the C language, and
> then the multitude of help.exp tests that name c as the source
> language will fail.
>
> This patch avoids these fails: it detects the message "compiler not
> installed" in the compiler output, and bails out as "unsupported".
>
> Regstrapped on x86_64-linux-gnu; also tested with a cross compiler to
> arm-eabi with C++ disabled.  Ok to install?
>
>
> for  gcc/testsuite/ChangeLog
>
> 	* lib/options.exp (check_for_options_with_filter): Detect
> 	unavailable compiler for the selected language, and bail out
> 	as unsupported.
OK
jeff
diff mbox series

Patch

diff --git a/gcc/testsuite/lib/options.exp b/gcc/testsuite/lib/options.exp
index c7f7316943e41..7700144fd440b 100644
--- a/gcc/testsuite/lib/options.exp
+++ b/gcc/testsuite/lib/options.exp
@@ -59,6 +59,11 @@  proc check_for_options_with_filter { language gcc_options exclude \
     set gcc_output [gcc_target_compile $srcfname $filebase.x executable $gcc_options]
     remote_file build delete $srcfname $filebase.x $filebase.gcno
 
+    if {[regexp -- "compiler not installed on this system" $gcc_output]} {
+	unsupported "$test: $language compiler not available"
+	return
+    }
+
     if { $exclude != "" } {
 	set lines [split $gcc_output "\n"]
 	set gcc_output ""