redo-log: add automated tests, and fix some path bugs revealed by them.

When a log for X was saying it wanted to refer to Y, we used a relative
path, but it was sometimes relative to the wrong starting location, so
redo-log couldn't find it later.

Two examples:

 - if default.o.do is handling builds for a/b/x.o, and default.o.do
   does 'redo a/b/x.h', the log for x.o should refer to ./x.h, not
   a/b/x.h.

 - if foo.do is handling builds for foo, and it does
   "cd a/b && redo x", the log for foo should refer to a/b/x, not just
   x.
This commit is contained in:
Avery Pennarun 2018-11-19 17:09:40 -05:00
commit 4edb6f78e0
10 changed files with 125 additions and 20 deletions

View file

@ -37,6 +37,7 @@ REDO_RE = re.compile(r'@@REDO:([^@]+)@@ (.*)$')
class PrettyLog(object):
def __init__(self, file):
self.topdir = os.getcwd()
self.file = file
def _pretty(self, pid, color, s):