]> git.proxmox.com Git - ceph.git/blobdiff - 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
index fa6aadc5876abde79a20220024c39bd95ca5fc15..02b460fc5f2b1e8cf54d0d2523af7997754edecd 100644 (file)
@@ -3,24 +3,37 @@
 # for temporary directories as this is implictly tested in a lot of other cases.
 
 # TODO: Move to a separate testing-system test group.
-# TODO: Make the test not display any output on success.
-# TODO: Make sure implemented path handling is correct under Windows, Cygwin &
-#       Unix/Linux.
 
 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.expect_output_lines("*%s*" % tempfile.gettempdir(), False)
-t.expect_output_lines("*build/v2/test*")
-
-t.run_build_system(status=1, subdir="/must/fail/with/absolute/path",
-    stderr=None)
+t.fail_test(not os.path.samefile(t.stdout().rstrip("\n"), os.getcwd()))
 
-t.cleanup()
+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()