[LLVMdev] hexdump in test cases?

Nick Kledzik kledzik at apple.com
Thu Oct 2 18:27:41 PDT 2014


For lld to mimic the darwin linker it needs to support an option that dumps a binary file which contains a list of the input and output files. This file is used by Xcode to dynamically update its dependency graph.

I’m a bit stumped on how to test this. Some ideas I have:

* Use REQUIRES: shell, then run hexdump and FileCheck that (is hexdump output consistent on all *nix platforms?)

* Use REQUIRES: shell, then run sed or perl to format the file with lines and opcode values and FileCheck that (is sed/perl on all platforms?)

* Since lit uses Python, it seems like I should be able to use python to transform the file into something FileCheck can process.  But I don’t know how to invoke python from a RUN: line in a cross platform way.

* Add a C tool to llvm that dumps out a dependency file in a human and FileCheck readable way.  Seems like overkill to add a directory to llvm/tools/ that contains a tool only useful for dumping a Xcode file.  Comparing the file bytes is all I really need.

* Write an llvm-hexdump tool in llvm/tools/ and use that in my test case.

Thoughts?

-Nick



More information about the llvm-dev mailing list