run_unittests: Resolve the real path of the tmpdir

On macOS, the temporary directory is inside /var/folders, but /var is
a symlink to /private/var, and for some reason that messes up path
traversal when you're inside the temporary directory and the source
directory is never found, and ninja runs in a loop trying to
regenerate files that can never be regenerated.
pull/1356/head
Nirbheek Chauhan 8 years ago
parent 2eef18b163
commit 8e36697617
  1. 8
      run_unittests.py

@ -180,7 +180,9 @@ class BasePlatformTests(unittest.TestCase):
super().setUp()
src_root = os.path.dirname(__file__)
src_root = os.path.join(os.getcwd(), src_root)
self.builddir = tempfile.mkdtemp()
# In case the directory is inside a symlinked directory, find the real
# path otherwise we might not find the srcdir from inside the builddir.
self.builddir = os.path.realpath(tempfile.mkdtemp())
self.logdir = os.path.join(self.builddir, 'meson-logs')
self.prefix = '/usr'
self.libdir = os.path.join(self.prefix, 'lib')
@ -857,9 +859,9 @@ class RewriterTests(unittest.TestCase):
def setUp(self):
super().setUp()
src_root = os.path.dirname(__file__)
self.testroot = tempfile.mkdtemp()
self.testroot = os.path.realpath(tempfile.mkdtemp())
self.rewrite_command = [sys.executable, os.path.join(src_root, 'mesonrewriter.py')]
self.tmpdir = tempfile.mkdtemp()
self.tmpdir = os.path.realpath(tempfile.mkdtemp())
self.workdir = os.path.join(self.tmpdir, 'foo')
self.test_dir = os.path.join(src_root, 'test cases/rewrite')

Loading…
Cancel
Save