From: Colin Patrick McCabe Date: Wed, 25 May 2011 22:55:22 +0000 (-0700) Subject: ceph-pybind-test: test embedded NULLs in data X-Git-Tag: v0.29~27^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4cae0ea8d09b1a853d4bb48e6a3afc762df7ae70;p=ceph.git ceph-pybind-test: test embedded NULLs in data Test embedded nulls in rados data. Fix a bug in rados.Object.__str__ Signed-off-by: Colin McCabe --- diff --git a/src/pybind/rados.py b/src/pybind/rados.py index b4d663aab91c..d391d5f094b8 100755 --- a/src/pybind/rados.py +++ b/src/pybind/rados.py @@ -502,7 +502,7 @@ class Object(object): self.state = "exists" def __str__(self): - return "rados.Object(ioctx=%s,key=%s)" % (str(self.ioctx), self.key.value) + return "rados.Object(ioctx=%s,key=%s)" % (str(self.ioctx), self.key) def require_object_exists(self): if self.state != "exists": diff --git a/src/test/ceph-pybind-test.py b/src/test/ceph-pybind-test.py index a358868d878e..c6096e890ec6 100755 --- a/src/test/ceph-pybind-test.py +++ b/src/test/ceph-pybind-test.py @@ -60,6 +60,12 @@ got %s" % def_str) for obj in foo3_ioctx.list_objects(): print str(obj) +foo3_ioctx.write_full("ghi", "g\0h\0i") +ghi_str = foo3_ioctx.read("ghi") +if (ghi_str != "g\0h\0i"): + raise RuntimeError("error reading object ghi: expected value g\\0h\\0\i, \ +got %s" % (ghi_str)) + # do some things with extended attributes foo3_ioctx.set_xattr("abc", "a", "1") foo3_ioctx.set_xattr("def", "b", "2")