This is an archive of the discontinued LLVM Phabricator instance.

[flang] Disable pipefail for tests for stdin input
ClosedPublic

Authored by DavidSpickett on Jul 27 2022, 2:37 AM.

Details

Summary

We have seen the llvm test fail every so often on our bots:
https://lab.llvm.org/buildbot/#/builders/173/builds/6711

This happens because flang-new -fc1 -S does not wait for the
pipe to finish being written to/does not read out all the content.
You can see this in the output, cat comes after flang:
+ /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/not /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/flang-new -fc1 -S - -o -
+ cat /home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/input-from-stdin-llvm.ll
error: Invalid input type - expecting a Fortran file

This means that cat gets SIGPIPE which causes it to exit with
code 141 and that's the final result due to pipefail.

flang isn't wrong to exit early (I think some modes of grep also do this)
and we only care about flang's exit code. So disable pipefail for
the stdin testing.

Diff Detail

Event Timeline

DavidSpickett created this revision.Jul 27 2022, 2:37 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
DavidSpickett requested review of this revision.Jul 27 2022, 2:37 AM
awarzynski accepted this revision.Jul 27 2022, 2:45 AM

LGTM, thanks!

[nit] Perhaps a short comment in the newly added lit.local.cfg as well? For example, "When reading erroneous input, the driver might exit before e.g. cat closes its output PIPE. That's an error for cat. With pipefail enabled, we have seen the tests in this directory fail because of that, but we don't really care about the error code from cat".

Feel free to re-use, edit or to throw away!

This revision is now accepted and ready to land.Jul 27 2022, 2:45 AM

Add a comment to the local cfg.

This revision was automatically updated to reflect the committed changes.