summaryrefslogtreecommitdiffstats
path: root/src/boost/tools/build/test/abs_workdir.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /src/boost/tools/build/test/abs_workdir.py
parentInitial commit. (diff)
downloadceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz
ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/tools/build/test/abs_workdir.py')
-rw-r--r--src/boost/tools/build/test/abs_workdir.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/boost/tools/build/test/abs_workdir.py b/src/boost/tools/build/test/abs_workdir.py
new file mode 100644
index 000000000..02b460fc5
--- /dev/null
+++ b/src/boost/tools/build/test/abs_workdir.py
@@ -0,0 +1,39 @@
+# Niklaus Giger, 2005-03-15
+# Testing whether we may run a test in absolute directories. There are no tests
+# for temporary directories as this is implictly tested in a lot of other cases.
+
+# TODO: Move to a separate testing-system test group.
+
+import BoostBuild
+import os
+import tempfile
+
+# Python 2.7 does not implement os.path.samefile on Windows
+import ntpath
+if not hasattr(ntpath, "samefile"):
+ def samefile(f1, f2):
+ try:
+ from os.path.nt import _getfinalpathname
+ return os.path._getfinalpathname(f1) == os.path._getfinalpathname(f2)
+ except (NotImplementedError, ImportError):
+ return os.path.abspath(f1) == os.path.abspath(f2)
+
+ ntpath.samefile = samefile
+
+t = BoostBuild.Tester(["-ffile.jam"], workdir=os.getcwd(), pass_d0=False,
+ pass_toolset=False)
+
+t.write("file.jam", "EXIT [ PWD ] : 0 ;")
+
+t.run_build_system()
+t.fail_test(not os.path.samefile(t.stdout().rstrip("\n"), os.getcwd()))
+
+try:
+ t.run_build_system(status=123, subdir="/must/fail/with/absolute/path",
+ stderr=None)
+except ValueError as e:
+ assert "subdir" in str(e), e
+else:
+ raise ValueError("exception expected")
+finally:
+ t.cleanup()