diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-02-04 00:07:55 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-02-18 02:38:54 +0530 |
commit | 8e366976177d9b0bf1753d06fb09c6659d3c435f (patch) | |
tree | c39a9393dfa7558039e50a18aaf6de6a1c81a2b2 | |
parent | 2eef18b16352f6626d6f3fd2e715497c485355dc (diff) | |
download | meson-8e366976177d9b0bf1753d06fb09c6659d3c435f.zip meson-8e366976177d9b0bf1753d06fb09c6659d3c435f.tar.gz meson-8e366976177d9b0bf1753d06fb09c6659d3c435f.tar.bz2 |
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.
-rwxr-xr-x | run_unittests.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/run_unittests.py b/run_unittests.py index e93d984..e0b96f1 100755 --- a/run_unittests.py +++ b/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') |