summaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorTristan Partin <tristan@partin.io>2021-06-21 17:45:08 -0500
committerJussi Pakkanen <jpakkane@gmail.com>2021-07-03 13:14:20 +0300
commitf21685a83330a4bbe1e59c3641a0d24f1efe8825 (patch)
treec5a25643159ec7058283895ebf77c01d6b1f998f /run_unittests.py
parent6f3f43bb2d31797b0f3128e1664652571fe314e6 (diff)
downloadmeson-f21685a83330a4bbe1e59c3641a0d24f1efe8825.tar.gz
Delete redirected wrap files in subprojects purge
We need to store the original filename as well as whether the wrap was redirected in order to properly purge the redirected wrap.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py36
1 files changed, 33 insertions, 3 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 314060595..e8f453d2e 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -10181,6 +10181,19 @@ class SubprojectsCommandTests(BasePlatformTests):
self._git_create_local_repo('sub_git')
self._wrap_create_git('sub_git')
+ sub_file_subprojects_dir = self.subprojects_dir / 'sub_file' / 'subprojects'
+ sub_file_subprojects_dir.mkdir(exist_ok=True, parents=True)
+ real_dir = Path('sub_file') / 'subprojects' / 'real'
+
+ self._wrap_create_file(real_dir, tarball='dummy2.tar.gz')
+
+ with open(str((self.subprojects_dir / 'redirect').with_suffix('.wrap')), 'w', encoding='utf-8') as f:
+ f.write(textwrap.dedent(
+ f'''
+ [wrap-redirect]
+ filename = {real_dir}.wrap
+ '''))
+
def deleting(s: str) -> T.List[str]:
ret = []
prefix = 'Deleting '
@@ -10190,14 +10203,31 @@ class SubprojectsCommandTests(BasePlatformTests):
return sorted(ret)
out = self._subprojects_cmd(['purge'])
- self.assertEqual(deleting(out), [str(self.subprojects_dir / 'sub_file'), str(self.subprojects_dir / 'sub_git')])
+ self.assertEqual(deleting(out), sorted([
+ str(self.subprojects_dir / 'redirect.wrap'),
+ str(self.subprojects_dir / 'sub_file'),
+ str(self.subprojects_dir / 'sub_git'),
+ ]))
out = self._subprojects_cmd(['purge', '--include-cache'])
- self.assertEqual(deleting(out), [str(self.subprojects_dir / 'packagecache' / 'dummy.tar.gz'), str(self.subprojects_dir / 'sub_file'), str(self.subprojects_dir / 'sub_git')])
+ self.assertEqual(deleting(out), sorted([
+ str(self.subprojects_dir / 'sub_git'),
+ str(self.subprojects_dir / 'redirect.wrap'),
+ str(self.subprojects_dir / 'packagecache' / 'dummy.tar.gz'),
+ str(self.subprojects_dir / 'packagecache' / 'dummy2.tar.gz'),
+ str(self.subprojects_dir / 'sub_file'),
+ ]))
out = self._subprojects_cmd(['purge', '--include-cache', '--confirm'])
- self.assertEqual(deleting(out), [str(self.subprojects_dir / 'packagecache' / 'dummy.tar.gz'), str(self.subprojects_dir / 'sub_file'), str(self.subprojects_dir / 'sub_git')])
+ self.assertEqual(deleting(out), sorted([
+ str(self.subprojects_dir / 'sub_git'),
+ str(self.subprojects_dir / 'redirect.wrap'),
+ str(self.subprojects_dir / 'packagecache' / 'dummy.tar.gz'),
+ str(self.subprojects_dir / 'packagecache' / 'dummy2.tar.gz'),
+ str(self.subprojects_dir / 'sub_file'),
+ ]))
self.assertFalse(Path(self.subprojects_dir / 'packagecache' / 'dummy.tar.gz').exists())
self.assertFalse(Path(self.subprojects_dir / 'sub_file').exists())
self.assertFalse(Path(self.subprojects_dir / 'sub_git').exists())
+ self.assertFalse(Path(self.subprojects_dir / 'redirect.wrap').exists())
def _clang_at_least(compiler: 'Compiler', minver: str, apple_minver: T.Optional[str]) -> bool:
"""