[PATCH] D72357: Fix llvm-objcopy when directory contains "bar".

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 00:59:42 PST 2020


jhenderson added inline comments.


================
Comment at: llvm/test/tools/llvm-objcopy/ELF/only-section-strip-undefined.test:6
 # RUN: llvm-objcopy -j .other.section %t.o %t2.o
-# RUN: llvm-readobj --symbols %t2.o | FileCheck %s --implicit-check-not=bar
+# RUN: llvm-readobj --symbols %t2.o | FileCheck %s --implicit-check-not=barrr
 
----------------
rupprecht wrote:
> MaskRay wrote:
> > MaskRay wrote:
> > > rupprecht wrote:
> > > > MaskRay wrote:
> > > > > `--implicit-check-not='Name: bar'`
> > > > I assume the match you're getting is the first line from llvm-readobj:
> > > > 
> > > > ```
> > > > File: /Users/jlebar/path/to/something.o
> > > > Format: ELF64-x86-64
> > > > Arch: x86_64
> > > > AddressSize: 64bit
> > > > ```
> > > > 
> > > > Piping from stdin will remove that filename; can you instead try:
> > > > ```
> > > > # RUN: llvm-readobj --symbols < %t2.o | FileCheck %s --implicit-check-not=bar
> > > > ```
> > > Using `< file` input redirection may leave us in a very inconvenient situation. Maybe we should just be more careful when using `--implicit-check-not`, instead of replacing every single use of `llvm-readobj %t` with `llvm-readobj < %t`.
> > I'd like to hear @jhenderson what wants to say here.
> When you say it's inconvenient, can you clarify why?
> 
> The practice of using piping to avoid the filename present is documented here, albeit for a different tool (opt instead of llvm-readobj): http://llvm.org/docs/TestingGuide.html#fragile-tests
This isn't likely to affect too many people, but if a test redirects from stdin, it is a pain to rerun a part of it in my default natural environment, Windows PowerShell, because PowerShell doesn't support the '<' redirection command for some unknown reason.

MaskRay's suggestions in this test would seem more preferable to me therefore, and less fragile for other reasons too, I reckon: "Name: bar" is much less likely to appear anywhere in the output beyond the bit being checked. Also, "bar" is a common enough three-letter pattern to appear in another word that even shell redirection won't necessarily solve it in all cases or could prove flaky in the future if more output is added to llvm-readobj.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72357/new/

https://reviews.llvm.org/D72357





More information about the llvm-commits mailing list