[PATCH] D43501: [lit] Implement 'cat' command for internal shell

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 9 15:17:03 PST 2018


rnk requested changes to this revision.
rnk added a comment.
This revision now requires changes to proceed.

I applied this locally and found two issues in the LLVM test suite. First, we have to open files in binary mode. That's easy to fix:

  diff --git a/llvm/utils/lit/lit/builtin_commands/cat.py b/llvm/utils/lit/lit/builtin_commands/cat.py
  index ef239612555..b0bbd369552 100644
  --- a/llvm/utils/lit/lit/builtin_commands/cat.py
  +++ b/llvm/utils/lit/lit/builtin_commands/cat.py
  @@ -10,7 +10,7 @@ def main(argv):
  
       for filename in filenames:
           try:
  -            fileToCat = open(filename,"r")
  +            fileToCat = open(filename, "rb")
               sys.stdout.write(fileToCat.read())
               sys.stdout.flush()
               fileToCat.close()

Second, we actually use the `-v` flag for cat in llvm/test/Object/archive-format.test. It looks like:

  If an archive has an object with no symbols, the linker and some other
  tools on some versions of Solaris will abort operations if there is no
  symbol table.  Create such an object, put it into an archive, and check to
  see that there is an empty symbol table.
  RUN: mkdir -p %t
  RUN: yaml2obj %S/Inputs/solaris-nosymbols.yaml > %t/foo.o
  RUN: llvm-ar rs %t/foo.a %t/foo.o
  RUN: cat -v %t/foo.a | FileCheck -strict-whitespace --check-prefix=SOLARIS %s
  SOLARIS:      !<arch>
  SOLARIS-NEXT: /               0           0     0     0       8         `
  SOLARIS-NEXT: ^@^@^@^@^@^@^@^@foo.o/

We could mark the test `REQUIRES: shell`, but our goal here is to reduce those, not increase them.


https://reviews.llvm.org/D43501





More information about the llvm-commits mailing list