[PATCH] D41776: [lit] Implement "-r" option for builtin "diff" command + a test using that.

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 11:03:17 PST 2018


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

Since a user of lit is going to expect `diff -r` to "just work", then it needs to match the semantics of what the tool `diff -r` actually does.  The patch here will print "something" and return an error code if there are differences, but it won't print the same thing as the actual `diff` utility when used with `-r`.  I think if we implement this in lit, we need to make the output look the same.  For example, a person might try to use this to verify that two directories differ only in one file.  (for example, one has an `a.txt` and another has a `b.txt`).  So they might run `diff -r` and filecheck the output against this:

  Only in d:\foo: a.txt
  Only in d:\bar: b.txt

But the code here won't print that.  In fact, if the *contents* of `a.txt` and `b.txt` are the same but just the names are different, then I think (from inspecting this patch) that the diff would actually succeed, since it just appends file contents to a buffer.

So I think if we want to implement `diff -r` here, you need to make sure it exactly matches the output of the unix tool for various inputs.


https://reviews.llvm.org/D41776





More information about the llvm-commits mailing list