Bug 927143 - Reject srcdir == objdir build configurations; r=glandium

This commit is contained in:
Gregory Szorc 2013-10-18 09:25:53 -07:00
Родитель 8674df19f6
Коммит 7badc78081
2 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -184,6 +184,11 @@ class MozbuildObject(ProcessExecutionMixin):
if topobjdir:
topobjdir = os.path.normpath(topobjdir)
if topsrcdir == topobjdir:
raise BadEnvironmentException('The object directory appears '
'to be the same as your source directory (%s). This build '
'configuration is not supported.' % topsrcdir)
# If we can't resolve topobjdir, oh well. The constructor will figure
# it out via config.guess.
return cls(topsrcdir, None, None, topobjdir=topobjdir)

Просмотреть файл

@ -18,6 +18,7 @@ from mozunit import main
from mach.logging import LoggingManager
from mozbuild.base import (
BadEnvironmentException,
MachCommandBase,
MozbuildObject,
PathArgument,
@ -212,6 +213,26 @@ class TestMozbuildObject(unittest.TestCase):
finally:
shutil.rmtree(d)
@unittest.skip('Failing on buildbot.')
def test_objdir_is_srcdir_rejected(self):
"""Ensure the srcdir configurations are rejected."""
d = os.path.realpath(tempfile.mkdtemp())
try:
# The easiest way to do this is to create a mozinfo.json with data
# that will never happen.
mozinfo = os.path.join(d, 'mozinfo.json')
with open(mozinfo, 'wt') as fh:
json.dump({'topsrcdir': d}, fh)
os.chdir(d)
with self.assertRaises(BadEnvironmentException):
MozbuildObject.from_environment(detect_virtualenv_mozinfo=False)
finally:
shutil.rmtree(d)
def test_config_guess(self):
# It's difficult to test for exact values from the output of
# config.guess because they vary depending on platform.