diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2021-10-30 18:54:04 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2021-10-31 19:22:36 +0530 |
commit | 04ae1cfb7999e25f476f84572ff0ad853629346c (patch) | |
tree | 16e9c8f4b1a473f28b5f54a050196f8c6f4394ec /unittests/baseplatformtests.py | |
parent | 2046593825d03c348fb09430e38145d92d9d6b94 (diff) | |
download | meson-04ae1cfb7999e25f476f84572ff0ad853629346c.zip meson-04ae1cfb7999e25f476f84572ff0ad853629346c.tar.gz meson-04ae1cfb7999e25f476f84572ff0ad853629346c.tar.bz2 |
Fix cygwin test failure due to shortpath usage
Two tests are failing on Cygwin because the argument is passed as
a long-path and the Path is ending up as a short-path:
AllPlatformTests.test_run_target_files_path
Traceback (most recent call last):
File "/cygdrive/d/a/meson/meson/test cases/common/51 run target/check-env.py", line 22, in <module>
assert build_root == env_build_root
AssertionError
SubprojectsCommandTests.test_purge
> self.assertEqual(deleting(out), sorted([
str(self.subprojects_dir / 'redirect.wrap'),
str(self.subprojects_dir / 'sub_file'),
str(self.subprojects_dir / 'sub_git'),
]))
E AssertionError: Lists differ: ['/cygdrive/c/Users/runneradmin/AppData/Local/Temp/tmpeaa2a49[205 chars]git'] != ['/cygdrive/c/Users/RUNNER~1/AppData/Local/Temp/tmpeaa2a49z/s[196 chars]git']
[...]
['/cygdrive/c/Users/runneradmin/AppData/Local/Temp/tmpeaa2a49z/src/subprojects/redirect.wrap',
^^^^^^^^^^^
['/cygdrive/c/Users/RUNNER~1/AppData/Local/Temp/tmpeaa2a49z/src/subprojects/redirect.wrap',
^^^^^^^^
The fix is to not use the tempdir for all tests, but only for tests
that check the mode.
Diffstat (limited to 'unittests/baseplatformtests.py')
-rw-r--r-- | unittests/baseplatformtests.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/unittests/baseplatformtests.py b/unittests/baseplatformtests.py index 9371395..bd2f902 100644 --- a/unittests/baseplatformtests.py +++ b/unittests/baseplatformtests.py @@ -100,14 +100,21 @@ class BasePlatformTests(TestCase): self.builddirs.append(self.builddir) def new_builddir(self): - if not is_cygwin(): - # Keep builddirs inside the source tree so that virus scanners - # don't complain - newdir = tempfile.mkdtemp(dir=os.getcwd()) - else: - # But not on Cygwin because that breaks the umask tests. See: - # https://github.com/mesonbuild/meson/pull/5546#issuecomment-509666523 - newdir = tempfile.mkdtemp() + # Keep builddirs inside the source tree so that virus scanners + # don't complain + newdir = tempfile.mkdtemp(dir=os.getcwd()) + # In case the directory is inside a symlinked directory, find the real + # path otherwise we might not find the srcdir from inside the builddir. + newdir = os.path.realpath(newdir) + self.change_builddir(newdir) + + def new_builddir_in_tempdir(self): + # Can't keep the builddir inside the source tree for the umask tests: + # https://github.com/mesonbuild/meson/pull/5546#issuecomment-509666523 + # And we can't do this for all tests because it causes the path to be + # a short-path which breaks other tests: + # https://github.com/mesonbuild/meson/pull/9497 + newdir = 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. newdir = os.path.realpath(newdir) |