gas: scfi: fix failing test on Solaris2

Message ID 20240202232542.2282432-1-indu.bhagat@oracle.com
State New
Headers
Series gas: scfi: fix failing test on Solaris2 |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Testing passed

Commit Message

Indu Bhagat Feb. 2, 2024, 11:25 p.m. UTC
  It has been observed that the run of scfi-unsupported-1 test with --x32
arg on a Solaris2 x86_64 system fails:

Executing on host: sh -c {../as-new  --x32 --scfi=experimental <...>/scfi-unsupported-1.s 2>&1}  /dev/null dump.out (timeout = 300)
spawn [open ...]
Assembler messages:
Fatal error: no compiled in support for 32bit x86_64
regexp_diff match failure
regexp "^Fatal error: SCFI is not supported for this ABI$"
line   "Fatal error: no compiled in support for 32bit x86_64"
FAIL: x86_64 scfi-unsupported-1

Fix the above by adding a check for --x32 support before running the
test.

gas/testsuite/
	* gas/scfi/x86_64/scfi-x86-64.exp: Add gas_x32_check and
	conditionalize the execution of scfi-unsupported-1 on it.
---
 gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
  

Comments

Jan Beulich Feb. 5, 2024, 7:32 a.m. UTC | #1
On 03.02.2024 00:25, Indu Bhagat wrote:
> It has been observed that the run of scfi-unsupported-1 test with --x32
> arg on a Solaris2 x86_64 system fails:
> 
> Executing on host: sh -c {../as-new  --x32 --scfi=experimental <...>/scfi-unsupported-1.s 2>&1}  /dev/null dump.out (timeout = 300)
> spawn [open ...]
> Assembler messages:
> Fatal error: no compiled in support for 32bit x86_64
> regexp_diff match failure
> regexp "^Fatal error: SCFI is not supported for this ABI$"
> line   "Fatal error: no compiled in support for 32bit x86_64"
> FAIL: x86_64 scfi-unsupported-1
> 
> Fix the above by adding a check for --x32 support before running the
> test.

While okay as-is for the purpose at hand, I still have two questions:

> --- a/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp
> +++ b/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp
> @@ -14,6 +14,14 @@
>  # along with this program; if not, write to the Free Software
>  # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
>  
> +proc gas_x32_check { } {
> +    global NM
> +    global NMFLAGS
> +
> +    set status [gas_host_run "$NM $NMFLAGS --help" ""]
> +    return [regexp "targets:.*elf32-x86-64" [lindex $status 1]];
> +}
> +
>  if { ![is_elf_format] } then {
>      return
>  }
> @@ -40,8 +48,11 @@ if  { ([istarget "x86_64-*-*"] && ![istarget "x86_64-*-linux*-gnux32"]) } then {
>      run_list_test "scfi-fp-diag-2" "--scfi=experimental"
>      run_list_test "scfi-diag-2" "--scfi=experimental"
>  
> +    if { [gas_x32_check] } then {
> +	run_list_test "scfi-unsupported-1" "--x32 --scfi=experimental"
> +    }
>      run_list_test "scfi-unsupported-1" "--32 --scfi=experimental"

Did it occur to you that this would better also be wrapped in a similar
check, seeing that gas/i386/x86-64.exp also uses such a conditional?

> -    run_list_test "scfi-unsupported-1" "--x32 --scfi=experimental"

While minor, I'm also curious about the reason for this re-ordering.

Jan
  
Indu Bhagat Feb. 5, 2024, 10:39 p.m. UTC | #2
On 2/4/24 23:32, Jan Beulich wrote:
> On 03.02.2024 00:25, Indu Bhagat wrote:
>> It has been observed that the run of scfi-unsupported-1 test with --x32
>> arg on a Solaris2 x86_64 system fails:
>>
>> Executing on host: sh -c {../as-new  --x32 --scfi=experimental <...>/scfi-unsupported-1.s 2>&1}  /dev/null dump.out (timeout = 300)
>> spawn [open ...]
>> Assembler messages:
>> Fatal error: no compiled in support for 32bit x86_64
>> regexp_diff match failure
>> regexp "^Fatal error: SCFI is not supported for this ABI$"
>> line   "Fatal error: no compiled in support for 32bit x86_64"
>> FAIL: x86_64 scfi-unsupported-1
>>
>> Fix the above by adding a check for --x32 support before running the
>> test.
> 
> While okay as-is for the purpose at hand, I still have two questions:
> 
>> --- a/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp
>> +++ b/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp
>> @@ -14,6 +14,14 @@
>>   # along with this program; if not, write to the Free Software
>>   # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
>>   
>> +proc gas_x32_check { } {
>> +    global NM
>> +    global NMFLAGS
>> +
>> +    set status [gas_host_run "$NM $NMFLAGS --help" ""]
>> +    return [regexp "targets:.*elf32-x86-64" [lindex $status 1]];
>> +}
>> +
>>   if { ![is_elf_format] } then {
>>       return
>>   }
>> @@ -40,8 +48,11 @@ if  { ([istarget "x86_64-*-*"] && ![istarget "x86_64-*-linux*-gnux32"]) } then {
>>       run_list_test "scfi-fp-diag-2" "--scfi=experimental"
>>       run_list_test "scfi-diag-2" "--scfi=experimental"
>>   
>> +    if { [gas_x32_check] } then {
>> +	run_list_test "scfi-unsupported-1" "--x32 --scfi=experimental"
>> +    }
>>       run_list_test "scfi-unsupported-1" "--32 --scfi=experimental"
> 
> Did it occur to you that this would better also be wrapped in a similar
> check, seeing that gas/i386/x86-64.exp also uses such a conditional?
> 

I saw that, but I couldn't see why gas_32_check would fail if [istarget 
"x86_64-*-*"] is true.

IIUC, BFD64 must be defined for the case when "if [istarget 
"x86_64-*-*"] is true".  So seeing the stubs in gas/config/tc-i386.c, I 
concluded that --32 should be supported at this point in the 
scfi-x86-64.exp. Looks like I am missing something ?

>> -    run_list_test "scfi-unsupported-1" "--x32 --scfi=experimental"
> 
> While minor, I'm also curious about the reason for this re-ordering.
> 

Purely aesthetic reasons; I thought I'd rather keep the other non-x32 
tests piled together.
  
Jan Beulich Feb. 6, 2024, 8:30 a.m. UTC | #3
On 05.02.2024 23:39, Indu Bhagat wrote:
> On 2/4/24 23:32, Jan Beulich wrote:
>> On 03.02.2024 00:25, Indu Bhagat wrote:
>>> It has been observed that the run of scfi-unsupported-1 test with --x32
>>> arg on a Solaris2 x86_64 system fails:
>>>
>>> Executing on host: sh -c {../as-new  --x32 --scfi=experimental <...>/scfi-unsupported-1.s 2>&1}  /dev/null dump.out (timeout = 300)
>>> spawn [open ...]
>>> Assembler messages:
>>> Fatal error: no compiled in support for 32bit x86_64
>>> regexp_diff match failure
>>> regexp "^Fatal error: SCFI is not supported for this ABI$"
>>> line   "Fatal error: no compiled in support for 32bit x86_64"
>>> FAIL: x86_64 scfi-unsupported-1
>>>
>>> Fix the above by adding a check for --x32 support before running the
>>> test.
>>
>> While okay as-is for the purpose at hand, I still have two questions:
>>
>>> --- a/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp
>>> +++ b/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp
>>> @@ -14,6 +14,14 @@
>>>   # along with this program; if not, write to the Free Software
>>>   # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
>>>   
>>> +proc gas_x32_check { } {
>>> +    global NM
>>> +    global NMFLAGS
>>> +
>>> +    set status [gas_host_run "$NM $NMFLAGS --help" ""]
>>> +    return [regexp "targets:.*elf32-x86-64" [lindex $status 1]];
>>> +}
>>> +
>>>   if { ![is_elf_format] } then {
>>>       return
>>>   }
>>> @@ -40,8 +48,11 @@ if  { ([istarget "x86_64-*-*"] && ![istarget "x86_64-*-linux*-gnux32"]) } then {
>>>       run_list_test "scfi-fp-diag-2" "--scfi=experimental"
>>>       run_list_test "scfi-diag-2" "--scfi=experimental"
>>>   
>>> +    if { [gas_x32_check] } then {
>>> +	run_list_test "scfi-unsupported-1" "--x32 --scfi=experimental"
>>> +    }
>>>       run_list_test "scfi-unsupported-1" "--32 --scfi=experimental"
>>
>> Did it occur to you that this would better also be wrapped in a similar
>> check, seeing that gas/i386/x86-64.exp also uses such a conditional?
> 
> I saw that, but I couldn't see why gas_32_check would fail if [istarget 
> "x86_64-*-*"] is true.
> 
> IIUC, BFD64 must be defined for the case when "if [istarget 
> "x86_64-*-*"] is true".  So seeing the stubs in gas/config/tc-i386.c, I 
> concluded that --32 should be supported at this point in the 
> scfi-x86-64.exp. Looks like I am missing something ?

While BFD64 is a prereq to building 64-bit code, it says nothing about
the supported object formats in a particular build. Conceivably there
might be builds which support only 64-bit ELF, at which point use of
--32 would fail just like what was observed with --x32.

Jan
  

Patch

diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp b/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp
index 9c76974fefe..415c82e5c85 100644
--- a/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp
+++ b/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp
@@ -14,6 +14,14 @@ 
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
 
+proc gas_x32_check { } {
+    global NM
+    global NMFLAGS
+
+    set status [gas_host_run "$NM $NMFLAGS --help" ""]
+    return [regexp "targets:.*elf32-x86-64" [lindex $status 1]];
+}
+
 if { ![is_elf_format] } then {
     return
 }
@@ -40,8 +48,11 @@  if  { ([istarget "x86_64-*-*"] && ![istarget "x86_64-*-linux*-gnux32"]) } then {
     run_list_test "scfi-fp-diag-2" "--scfi=experimental"
     run_list_test "scfi-diag-2" "--scfi=experimental"
 
+    if { [gas_x32_check] } then {
+	run_list_test "scfi-unsupported-1" "--x32 --scfi=experimental"
+    }
     run_list_test "scfi-unsupported-1" "--32 --scfi=experimental"
-    run_list_test "scfi-unsupported-1" "--x32 --scfi=experimental"
+
     run_list_test "scfi-unsupported-insn-1" "--scfi=experimental"
     run_list_test "scfi-unsupported-2" "--scfi=experimental"
     run_list_test "scfi-unsupported-3" "--scfi=experimental"