summaryrefslogtreecommitdiff
path: root/cpp/test/Slice/headers/run.py
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2015-02-25 11:39:02 +0100
committerJose <jose@zeroc.com>2015-02-25 11:39:02 +0100
commite0f3bf0c78952ecc0ae8c0cb02bb33c13448d094 (patch)
tree0379cebf670b8833d056e31ed9c963e2a29146b0 /cpp/test/Slice/headers/run.py
parentFix (ICE-5833) - shorten paths when include file is not a canonical path (diff)
downloadice-e0f3bf0c78952ecc0ae8c0cb02bb33c13448d094.tar.bz2
ice-e0f3bf0c78952ecc0ae8c0cb02bb33c13448d094.tar.xz
ice-e0f3bf0c78952ecc0ae8c0cb02bb33c13448d094.zip
(ICE-5833) - related fixes:
* Update test/Slice/headers to check this * Canonical path must be only used when attempts to shorten the actual path fails.
Diffstat (limited to 'cpp/test/Slice/headers/run.py')
-rwxr-xr-xcpp/test/Slice/headers/run.py66
1 files changed, 64 insertions, 2 deletions
diff --git a/cpp/test/Slice/headers/run.py b/cpp/test/Slice/headers/run.py
index 18096f51f09..803901b61d8 100755
--- a/cpp/test/Slice/headers/run.py
+++ b/cpp/test/Slice/headers/run.py
@@ -28,7 +28,8 @@ def clean():
os.path.join("slices", "dir1", "linktoa3.ice")]:
if os.path.exists(f):
os.unlink(f)
-
+ os.system("rm -rf project1 tmp")
+
clean()
os.symlink("slices", "linktoslices")
os.symlink("dir1", os.path.join("slices", "linktodir1"))
@@ -37,6 +38,7 @@ os.symlink("dir2", os.path.join("slices", "linktodir2"))
slice2cpp = TestUtil.getSliceTranslator()
+basedir = os.path.dirname(os.path.abspath(__file__))
slicedir = os.path.join(TestUtil.getIceDir(), "slice")
os.symlink(slicedir, "iceslices")
@@ -65,7 +67,67 @@ runTest("%s -I%s -Ilinktoslices linktoslices/linktodir2/b.ice" % (slice2cpp, sli
if os.path.exists("SLICES"):
runTest("%s -IICESLICES -ISLICES SLICES/DIR2/B.ice" % (slice2cpp))
runTest("%s -IICESLICES -ILINKTOSLICES LINKTOSLICES/LINKTODIR2/B.ice" % (slice2cpp))
+
+#
+# Slice files are symlinks, include dir is a regular directory
+#
+os.system("mkdir -p project1/git/services.settings.slices")
+os.system("mkdir -p project1/src/services/settings")
+os.system("cd project1/src/services/settings && ln -s ../../../git/services.settings.slices slices")
-print("ok")
+f = open("project1/git/services.settings.slices/A.ice", "w")
+f.write("// dumy file")
+f.close()
+f = open("project1/git/services.settings.slices/B.ice", "w")
+f.write("#include <services/settings/slices/A.ice>")
+f.close()
+
+os.system("cd project1 && %s -Isrc src/services/settings/slices/B.ice" % slice2cpp)
+f = open("project1/B.h")
+
+if not re.search(re.escape('#include <services/settings/slices/A.h>'), f.read()):
+ print("failed!")
+ sys.exit(1)
+
+clean()
+
+#
+# Slice file is regular file, include dir is a symlink to a second symlink
+#
+os.system("mkdir -p tmp/Ice-x.y.z/share")
+os.system("cd tmp/Ice-x.y.z/share && ln -s %s" % TestUtil.getIceDir("slice"))
+
+
+os.system("mkdir -p project1/share")
+os.system("cd project1/share && ln -s %s/tmp/Ice-x.y.z/share/slice" % basedir)
+f = open("project1/A.ice", "w")
+f.write("#include <Ice/Identity.ice>")
+f.close()
+os.system("cd project1 && %s -Ishare/slice A.ice" % slice2cpp)
+f = open("project1/A.h")
+if not re.search(re.escape('#include <Ice/Identity.h>'), f.read()):
+ print("failed!")
+ sys.exit(1)
+
+clean()
+#
+# Typical Ice install with symlink Ice-x.y -> Ice-x.y.z
+#
+os.system("mkdir -p tmp/Ice-x.y.z/slice/Ice")
+os.system("cd tmp && ln -s Ice-x.y.z Ice-x.y")
+f = open("tmp/Ice-x.y.z/slice/Ice/Identity.ice", "w")
+f.write("// dumy file")
+
+os.system("mkdir -p project1")
+f = open("project1/A.ice", "w")
+f.write("#include <Ice/Identity.ice>")
+f.close()
+os.system("cd project1 && %s -I%s/tmp/Ice-x.y/slice A.ice" % (slice2cpp, basedir))
+f = open("project1/A.h")
+if not re.search(re.escape('#include <Ice/Identity.h>'), f.read()):
+ print("failed!")
+ sys.exit(1)
+
+print("ok")
clean()