]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind: install ceph-pybind-test on debug builds
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 6 Apr 2011 00:45:11 +0000 (17:45 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 6 Apr 2011 00:45:11 +0000 (17:45 -0700)
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/Makefile.am
src/test/ceph-pybind-test.py [new file with mode: 0755]
src/test/pybind-test.py [deleted file]

index 173d3320da5aa46109928542548658c37cc420e5..524c5acf606656b296be112062158b8bfbef9bad 100644 (file)
@@ -711,6 +711,10 @@ dist-hook:
 
 python_PYTHON = pybind/rados.py
 
+if WITH_DEBUG
+bin_SCRIPTS += test/ceph-pybind-test.py
+endif
+
 # headers... and everything else we want to include in a 'make dist' 
 # that autotools doesn't magically identify.
 noinst_HEADERS = \
diff --git a/src/test/ceph-pybind-test.py b/src/test/ceph-pybind-test.py
new file mode 100755 (executable)
index 0000000..812d057
--- /dev/null
@@ -0,0 +1,77 @@
+#!/usr/bin/python
+
+import rados
+
+r = rados.Rados()
+r.conf_read_file();
+r.connect()
+v = r.version()
+print "rados version %s" % str(v)
+
+try:
+    auid = 100
+    r.create_pool("foo1", auid)
+    print "created pool foo1 with auid %d" % auid
+    r.delete_pool("foo1")
+    print "deleted pool foo1"
+except rados.ObjectExists:
+    print "pool foo1 already exists"
+
+try:
+    r.create_pool("foo2")
+    print "created pool foo2"
+except rados.ObjectExists:
+    print "pool foo2 already exists"
+if r.pool_exists("foo2") != True:
+    raise RuntimeError("we just created pool 'foo2', but it doesn't exist?")
+print "opening pool foo2"
+foo2_ioctx = r.open_ioctx("foo2")
+# give this pool to the anonymous AUID
+foo2_ioctx.change_auid(rados.ANONYMOUS_AUID)
+# well, actually, we want it back.
+foo2_ioctx.change_auid(rados.ADMIN_AUID)
+foo2_ioctx.close()
+# now delete
+print "deleting pool foo2"
+r.delete_pool("foo2")
+
+# create a pool and some objects
+try:
+    r.create_pool("foo3")
+except rados.ObjectExists:
+    pass
+foo3_ioctx = r.open_ioctx("foo3")
+foo3_ioctx.write("abc", "abc")
+foo3_ioctx.write("def", "def")
+abc_str = foo3_ioctx.read("abc")
+if (abc_str != "abc"):
+    raise RuntimeError("error reading object abc: expected value abc, \
+got %s" % abc_str)
+# write_full replaces the whole 'def' object
+foo3_ioctx.write_full("def", "d")
+def_str = foo3_ioctx.read("def")
+if (def_str != "d"):
+    raise RuntimeError("error reading object def: expected value d, \
+got %s" % def_str)
+
+for obj in foo3_ioctx.list_objects():
+    print str(obj)
+
+# create some snapshots and do stuff with them
+print "creating snap bjork"
+foo3_ioctx.create_snap("bjork")
+print "creating snap aardvark"
+foo3_ioctx.create_snap("aardvark")
+print "creating snap carnuba"
+foo3_ioctx.create_snap("carnuba")
+print "listing snaps..."
+for snap in foo3_ioctx.list_snaps():
+    print str(snap)
+
+print "removing snap bjork"
+foo3_ioctx.remove_snap("bjork")
+foo3_ioctx.close()
+
+# remove foo3
+print "deleting foo3"
+r.delete_pool("foo3")
diff --git a/src/test/pybind-test.py b/src/test/pybind-test.py
deleted file mode 100755 (executable)
index 812d057..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/python
-
-import rados
-
-r = rados.Rados()
-r.conf_read_file();
-r.connect()
-v = r.version()
-print "rados version %s" % str(v)
-
-try:
-    auid = 100
-    r.create_pool("foo1", auid)
-    print "created pool foo1 with auid %d" % auid
-    r.delete_pool("foo1")
-    print "deleted pool foo1"
-except rados.ObjectExists:
-    print "pool foo1 already exists"
-
-try:
-    r.create_pool("foo2")
-    print "created pool foo2"
-except rados.ObjectExists:
-    print "pool foo2 already exists"
-if r.pool_exists("foo2") != True:
-    raise RuntimeError("we just created pool 'foo2', but it doesn't exist?")
-print "opening pool foo2"
-foo2_ioctx = r.open_ioctx("foo2")
-# give this pool to the anonymous AUID
-foo2_ioctx.change_auid(rados.ANONYMOUS_AUID)
-# well, actually, we want it back.
-foo2_ioctx.change_auid(rados.ADMIN_AUID)
-foo2_ioctx.close()
-# now delete
-print "deleting pool foo2"
-r.delete_pool("foo2")
-
-# create a pool and some objects
-try:
-    r.create_pool("foo3")
-except rados.ObjectExists:
-    pass
-foo3_ioctx = r.open_ioctx("foo3")
-foo3_ioctx.write("abc", "abc")
-foo3_ioctx.write("def", "def")
-abc_str = foo3_ioctx.read("abc")
-if (abc_str != "abc"):
-    raise RuntimeError("error reading object abc: expected value abc, \
-got %s" % abc_str)
-# write_full replaces the whole 'def' object
-foo3_ioctx.write_full("def", "d")
-def_str = foo3_ioctx.read("def")
-if (def_str != "d"):
-    raise RuntimeError("error reading object def: expected value d, \
-got %s" % def_str)
-
-for obj in foo3_ioctx.list_objects():
-    print str(obj)
-
-# create some snapshots and do stuff with them
-print "creating snap bjork"
-foo3_ioctx.create_snap("bjork")
-print "creating snap aardvark"
-foo3_ioctx.create_snap("aardvark")
-print "creating snap carnuba"
-foo3_ioctx.create_snap("carnuba")
-print "listing snaps..."
-for snap in foo3_ioctx.list_snaps():
-    print str(snap)
-
-print "removing snap bjork"
-foo3_ioctx.remove_snap("bjork")
-foo3_ioctx.close()
-
-# remove foo3
-print "deleting foo3"
-r.delete_pool("foo3")