]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/abs_workdir.py
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / tools / build / test / abs_workdir.py
1 # Niklaus Giger, 2005-03-15
2 # Testing whether we may run a test in absolute directories. There are no tests
3 # for temporary directories as this is implictly tested in a lot of other cases.
4
5 # TODO: Move to a separate testing-system test group.
6
7 import BoostBuild
8 import os
9 import tempfile
10
11 # Python 2.7 does not implement os.path.samefile on Windows
12 import ntpath
13 if not hasattr(ntpath, "samefile"):
14 def samefile(f1, f2):
15 try:
16 from os.path.nt import _getfinalpathname
17 return os.path._getfinalpathname(f1) == os.path._getfinalpathname(f2)
18 except (NotImplementedError, ImportError):
19 return os.path.abspath(f1) == os.path.abspath(f2)
20
21 ntpath.samefile = samefile
22
23 t = BoostBuild.Tester(["-ffile.jam"], workdir=os.getcwd(), pass_d0=False,
24 pass_toolset=False)
25
26 t.write("file.jam", "EXIT [ PWD ] : 0 ;")
27
28 t.run_build_system()
29 t.fail_test(not os.path.samefile(t.stdout().rstrip("\n"), os.getcwd()))
30
31 try:
32 t.run_build_system(status=123, subdir="/must/fail/with/absolute/path",
33 stderr=None)
34 except ValueError as e:
35 assert "subdir" in str(e), e
36 else:
37 raise ValueError("exception expected")
38 finally:
39 t.cleanup()