Prohibit symlinks in test data dir because they get mangled by setup.py.

pull/12495/head
Jussi Pakkanen 1 year ago
parent 686963f1c2
commit 2ea284bac1
  1. 8
      run_format_tests.py
  2. 21
      run_project_tests.py
  3. 0
      test cases/common/268 install functions and follow symlinks/foo/file1
  4. 0
      test cases/common/268 install functions and follow symlinks/meson.build
  5. 0
      test cases/common/268 install functions and follow symlinks/test.json
  6. 1
      test cases/common/268 install functions and follow_symlinks/foo/link1
  7. 1
      test cases/common/268 install functions and follow_symlinks/foo/link2.h
  8. 1
      test cases/warning/9 meson.options/subprojects/no-warn/meson_options.txt
  9. 1
      test cases/warning/9 meson.options/subprojects/no-warn/meson_options.txt

@ -75,9 +75,17 @@ def check_format() -> None:
continue
check_file(root / file)
def check_symlinks():
for f in Path('test cases').glob('**/*'):
if f.is_symlink():
if 'boost symlinks' in str(f):
continue
raise SystemExit(f'Test data dir contains symlink: {f}.')
if __name__ == '__main__':
script_dir = os.path.split(__file__)[0]
if script_dir != '':
os.chdir(script_dir)
check_format()
check_symlinks()

@ -1561,6 +1561,14 @@ def print_tool_versions() -> None:
print('{0:<{2}}: {1}'.format(tool.tool, get_version(tool), max_width))
print()
tmpdir = list(Path('.').glob('**/*install functions and follow symlinks'))
print(tmpdir)
assert(len(tmpdir) == 1)
symlink_test_dir = tmpdir[0]
symlink_file1 = symlink_test_dir / 'foo/link1'
symlink_file2 = symlink_test_dir / 'foo/link2.h'
del tmpdir
def clear_transitive_files() -> None:
a = Path('test cases/common')
for d in a.glob('*subproject subdir/subprojects/subsubsub*'):
@ -1568,6 +1576,18 @@ def clear_transitive_files() -> None:
mesonlib.windows_proof_rmtree(str(d))
else:
mesonlib.windows_proof_rm(str(d))
try:
symlink_file1.unlink()
except FileNotFoundError:
pass
try:
symlink_file2.unlink()
except FileNotFoundError:
pass
def setup_symlinks() -> None:
symlink_file1.symlink_to('file1')
symlink_file2.symlink_to('file1')
if __name__ == '__main__':
if under_ci and not raw_ci_jobname:
@ -1611,6 +1631,7 @@ if __name__ == '__main__':
options.extra_args += ['--native-file', options.native_file]
clear_transitive_files()
setup_symlinks()
print('Meson build system', meson_version, 'Project Tests')
print('Using python', sys.version.split('\n')[0], f'({sys.executable!r})')

Loading…
Cancel
Save