Bug 493959

Summary: s390x: regtest failure for none/tests/s390x/op00
Product: [Developer tools] valgrind Reporter: Florian Krohm <flo2030>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: normal CC: arnez
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: patch to filter out "Illegal instruction" messages
updated patch

Description Florian Krohm 2024-10-02 11:20:29 UTC
Created attachment 174310 [details]
patch to filter out "Illegal instruction" messages

The none/tests/s390x/op00 testcases fails with an extra line in the stderr output:

Illegal instruction (core dumped)

This message does not come from valgrind but from the shell
which in my case is GNU bash, version 5.1.16(1)-release

It appears that there is already machinery for filtering out other
such messages from abnormal termination. The attached patch adds to that.

I ran  find . -name '*.exp' -exec grep -H 'Illegal instruction' {} \;
in the root of the source tree and there were no matches. So this 
patch should not affect regression testing on other platforms.
Comment 1 Andreas Arnez 2024-10-02 13:32:54 UTC
(In reply to Florian Krohm from comment #0)
> Created attachment 174310 [details]
> patch to filter out "Illegal instruction" messages
This looks reasonable to me, considering the list of filters already established.
I'm not sure why it's necessary though.
> This message does not come from valgrind but from the shell
> which in my case is GNU bash, version 5.1.16(1)-release
Bart Van Assche's comment from March 2008 in `filter_stderr_basic.in' states that "older" bash versions print abnormal termination messages, and that "newer" versions "redirect such messages properly". From that perspective, 5.1.16 should be much newer than necessary. Is it clear what's going wrong here?
On the other hand, perhaps it's not worth spending too much time to investigate, so I'm fine with the patch above.
Comment 2 Florian Krohm 2024-10-02 21:39:59 UTC
I poked a bit more and I think this is the story:

vg_regtest executes a test like so (around line 547):

mysystem(....... , "$prog $args > $name.stdout.out 2> $name.stderr.out");

where mysystem is just a wrapper around perl's "system" function.

https://perldoc.perl.org/functions/system says that the function argument (= the command 
to be executed) is passed to /bin/sh.

On my machine /bin/sh is a symlink to /bin/dash which writes "Illegal instruction ...." to stderr.
However, if /bin/sh is a symlink to /bin/bash then "Illegal instruction ..." will NOT be written to stderr.
Hence it cannot be redirected to .stderr.out

To conclude: whether or not this test fails is a matter of what shell is being used. 
So we need to keep this filtering machinery around and should adjust Bart's' comment.
Comment 3 Florian Krohm 2024-10-17 14:36:14 UTC
Created attachment 174941 [details]
updated patch

Updated patch including NEWS entry and adjusted comment.
Comment 4 Andreas Arnez 2024-10-29 15:49:33 UTC
(In reply to Florian Krohm from comment #3)
> Created attachment 174941 [details]
> updated patch
Pushed as commit 74d85edfbdcac7c5c9cbbb2460005d5c4dac4447.