mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
bug 632616 - fix symbolstore.py's handling of relative paths. r=catlee
This commit is contained in:
parent
9d8a14de80
commit
ed35e409b9
@ -98,3 +98,6 @@ endif
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
check::
|
||||
$(PYTHON) $(srcdir)/tools/unit-symbolstore.py
|
||||
|
@ -286,9 +286,9 @@ class HGFileInfo(VCSFileInfo):
|
||||
if self.revision and self.clean_root:
|
||||
if self.srcdir:
|
||||
# strip the base path off
|
||||
file = os.path.normpath(file)
|
||||
if IsInDir(file, self.srcdir):
|
||||
file = file[len(self.srcdir):]
|
||||
abs_file = os.path.abspath(file)
|
||||
if IsInDir(abs_file, self.srcdir):
|
||||
file = abs_file[len(self.srcdir):]
|
||||
if file.startswith('/') or file.startswith('\\'):
|
||||
file = file[1:]
|
||||
return "hg:%s:%s:%s" % (self.clean_root, file, self.revision)
|
||||
|
40
toolkit/crashreporter/tools/unit-symbolstore.py
Normal file
40
toolkit/crashreporter/tools/unit-symbolstore.py
Normal file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os, tempfile, unittest, shutil
|
||||
import symbolstore
|
||||
|
||||
class TestGetVCSFilename(unittest.TestCase):
|
||||
"""
|
||||
Unit tests for GetVCSFilename
|
||||
|
||||
"""
|
||||
def setUp(self):
|
||||
self.srcdir = tempfile.mkdtemp()
|
||||
# make it look vaguely like a hg repo
|
||||
os.mkdir(os.path.join(self.srcdir, ".hg"))
|
||||
# and force-feed it to the symbolstore cache
|
||||
symbolstore.HGRepoInfo.repos[self.srcdir] = \
|
||||
symbolstore.HGRepoInfo("http://example.com/repo",
|
||||
"abcd",
|
||||
'example.com/repo')
|
||||
objdir = os.path.join(self.srcdir, "obj")
|
||||
os.mkdir(objdir)
|
||||
self.oldcwd = os.getcwd()
|
||||
os.chdir(objdir)
|
||||
|
||||
def tearDown(self):
|
||||
os.chdir(self.oldcwd)
|
||||
shutil.rmtree(self.srcdir)
|
||||
|
||||
def testRelativePath(self):
|
||||
"""
|
||||
Test that a relative path doesn't get
|
||||
removed.
|
||||
|
||||
"""
|
||||
vcsfile, root = symbolstore.GetVCSFilename("../foo.h", [self.srcdir])
|
||||
vcs,location,filename,rev = vcsfile.split(":")
|
||||
self.assertEqual(filename, "foo.h")
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
Reference in New Issue
Block a user