tcsh-org / tcsh

This is a read-only mirror of the tcsh code repository.
https://www.tcsh.org/
Other
229 stars 42 forks source link

[PATCH] Fix build for qemu environments #95

Closed josefs10 closed 4 months ago

josefs10 commented 4 months ago

When building tcsh in a qemu environment, the status test fails because of a qemu print statement for ABRT signal. This patch forces an exit status and allows for successful builds in qemu environments. exit-kill-status-test.patch.txt

suominen commented 4 months ago

The patch changes the nature of the test: it no longer tests a $status value after a process exits due to ABRT signal. I'm not sure if this is important, but it might be.

Also, why is exit given two arguments? The syntax for exit is a single optional argument in a typical POSIX shell.

josefs10 commented 4 months ago

It's the use of the ABRT signal that causes qemu to throw the message which causes the test failure. I will look at the exit arguments. That may have just been copied from the other test.

suominen commented 4 months ago

The test already accommodates output that may vary (see the sed command that the patch would remove). I think we could just similarly anticipate the output from qemu and weed it out.

Maybe something like this:

diff --git a/tests/variables.at b/tests/variables.at
index c44029b..3082a26 100644
--- a/tests/variables.at
+++ b/tests/variables.at
@@ -1442,7 +1442,10 @@ if ( $status > 128 ) echo OK
 true
 echo $status
 ]])
-AT_CHECK([tcsh -f status.csh 2>&1 | sed 's/Abort *(core dumped)/Abort/'], ,
+AT_CHECK([tcsh -f status.csh 2>&1 | sed '
+  /^qemu: uncaught target signal 6 / d
+  s/Abort *(core dumped)/Abort/
+'], ,
 [0
 Abort
 OK
josefs10 commented 4 months ago

I just tested this with sbuild and a loong64 chroot and it worked! I'm good with using this instead.

suominen commented 4 months ago

Thank you for testing, @josefs10 .