This is an archive of the discontinued LLVM Phabricator instance.

Make shell redirection construct portable
ClosedPublic

Authored by krytarowski on Jul 11 2017, 2:30 PM.

Details

Summary

NetBSD shell sh(1) does not support ">& /dev/null" construct.
This is bashism. The portable and POSIX solution is to use:
"> /dev/null 2>&1".

This change fixes 22 Unexpected Failures on NetBSD/amd64
for the "check-llvm" target.

Sponsored by <The NetBSD Foundation>

Diff Detail

Repository
rL LLVM

Event Timeline

krytarowski created this revision.Jul 11 2017, 2:30 PM
joerg accepted this revision.Jul 11 2017, 2:38 PM

Strictly speaking, I think this comes from csh, but LGTM.

This revision is now accepted and ready to land.Jul 11 2017, 2:38 PM
davide added a subscriber: davide.Jul 11 2017, 2:44 PM

This is good for portability but probably needs to be specified somewhere (programmer's manual?) but I'm not sure if we have a section on how to write tests.
Also, is there a netbsd bot to catch mistakes in future? [I don't see it].

Catch another usage of >&.

This is good for portability but probably needs to be specified somewhere (programmer's manual?) but I'm not sure if we have a section on how to write tests.
Also, is there a netbsd bot to catch mistakes in future? [I don't see it].

Yes, there is a bot:
http://lab.llvm.org:8011/builders/lldb-amd64-ninja-netbsd8

At the moment it validates proper build in LLVM+Clang+LLDB, it will be extended for execution of tests in future.
There are still over 200 failures in LLVM to go, few in Clang, many in LLDB.

rnk accepted this revision.Jul 11 2017, 3:06 PM
rnk added a subscriber: rnk.

Eventually when we standardize on the lit test runner, this will not be an issue. LLVM can choose what shell syntax it wants to use without worrying about the system shell.

krytarowski closed this revision.Jul 12 2017, 6:25 AM