[PATCH] D53576: [llvm-objdump] Add alias option `--full-contents` for `-s` (PR39404)

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 24 02:33:13 PDT 2018


jhenderson added a comment.

Thanks for the test. It's a good start, but there are several issues with it:

  1. Don't rely on pre-canned binaries that are for other not-really-related tests. You would be better off using yaml2obj to create a test input, specific to this test. This makes it clearer what is important to the test, and leads to a less fragile test, because modifying the other test won't break this test. Take a look at test/tools/llvm-objcopy/basic-copy.test for a good example of how to create the test input at test-time.
1. Assuming you are using yaml2obj, you will probably need to put comment markers at the start of each CHECK, like the RUN lines.
2. You need to call FileCheck to actually run the CHECKs in your file.
3. You might want to pipe the output of the two llvm-objdump calls to a file, and then compare them to show that both options produce the same output (FileCheck will only check the things you check, and not the things you don't check).
4. "CHECK: " with no output after it does not do anything. If you are really interested in the blank line, you should use CHECK-EMPTY.
5. Use "CHECK-NEXT:" to check that the next line is actually on the next line of the output. "CHECK:" simply checks that the pattern is somewhere later in the file than teh previous one.

Here's an incomplete example of what you might want to do:

  # RUN: yaml2obj %s > %t
  # RUN: llvm-objdump --full-contents %t > %t.out1
  # RUN: llvm-objdump -s %t > %t.out2
  # RUN: cmp %t.out1 %t.out2
  # RUN: FileCheck %s --input-file=%t.out1
  
  # CHECK: some stuff
  # CHECK-NEXT: some more stuff
  ## etc
  
  !ELF
  FileHeader:
  ## the rest of the yaml here.


https://reviews.llvm.org/D53576





More information about the llvm-commits mailing list