Skip to contentSkip to conversation

tabled: add a test for larger objects

PATCH Applied Pete Zaitcev 2 participants 3 messages Jan 5, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 tabled: add a test for larger objects

Existing tests only excercised operations with relatively small objects. It did not test pipelining of object data in sufficient degree. So, let's have a better test case for this (large-object.c).

We also change the existing basic-object.c to match.

---
 test/.gitignore     |    1 
 test/Makefile.am    |    5 -
 test/basic-object.c |   13 +-
 test/large-object.c |  197 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 209 insertions(+), 7 deletions(-)

commit 0fc948e8576b68746183013275784f5dc27b5868

Author: Master <[email protected]>
Date:   Tue Jan 5 00:08:13 2010 -0700

Add a new test for larger objects.

test/.gitignore +1 -0
index ed7f1fa..c99d4e2 100644
@@ -3,5 +3,6 @@
 basic-bucket
 basic-object
 it-works
+large-object
 wait-for-listen
 
test/Makefile.am +4 -1
index 071c69c..2e18349 100644
@@ -23,16 +23,19 @@ TESTS =				\
 	it-works		\
 	basic-bucket		\
 	basic-object		\
+	large-object		\
 	stop-daemon		\
 	clean-db
 
-check_PROGRAMS		= wait-for-listen basic-bucket basic-object it-works
+check_PROGRAMS		= basic-bucket basic-object it-works large-object \
+			  wait-for-listen
 
 TESTLDADD		= ../lib/libhttpstor.la	\
 			  ../lib/libhttputil.a	\
 			  @LIBCURL@ @GLIB_LIBS@ @CRYPTO_LIBS@ @XML_LIBS@
 basic_bucket_LDADD	= $(TESTLDADD)
 basic_object_LDADD	= $(TESTLDADD)
+large_object_LDADD	= $(TESTLDADD)
 it_works_LDADD		= $(TESTLDADD)
 
 wait_for_listen_LDADD	= ../lib/libhttputil.a
test/basic-object.c +7 -6
index 17fdd24..0761e31 100644
@@ -28,12 +28,13 @@
 
 int main(int argc, char *argv[])
 {
+	static char bucket[] = "test1";
+	static char key[] = "my first key";
 	struct httpstor_client *httpstor;
 	char accbuf[80];
 	int rc;
 	bool rcb;
 	char val[] = "my first value";
-	char key[] = "my first key";
 	size_t len = 0;
 	void *mem;
 
@@ -46,25 +47,25 @@ int main(int argc, char *argv[])
 	OK(httpstor);
 
 	/* add bucket */
-	rcb = httpstor_add_bucket(httpstor, "test1");
+	rcb = httpstor_add_bucket(httpstor, bucket);
 	OK(rcb);
 
 	/* store object */
-	rcb = httpstor_put_inline(httpstor, "test1", key, val, strlen(val), NULL);
+	rcb = httpstor_put_inline(httpstor, bucket, key, val, strlen(val), NULL);
 	OK(rcb);
 
 	/* get object */
-	mem = httpstor_get_inline(httpstor, "test1", key, false, &len);
+	mem = httpstor_get_inline(httpstor, bucket, key, false, &len);
 	OK(mem);
 	OK(len == strlen(val));
 	OK(!memcmp(val, mem, strlen(val)));
 
 	/* delete object */
-	rcb = httpstor_del(httpstor, "test1", key);
+	rcb = httpstor_del(httpstor, bucket, key);
 	OK(rcb);
 
 	/* delete bucket */
-	rcb = httpstor_del_bucket(httpstor, "test1");
+	rcb = httpstor_del_bucket(httpstor, bucket);
 	OK(rcb);
 
 	return 0;
test/large-object.c new file +197 -0

197 lines not on this page · raw message

Applied
#1 lore raw
Quoted 6 lines · Pete Zaitcev

Existing tests only excercised operations with relatively small objects. It did not test pipelining of object data in sufficient degree. So, let's have a better test case for this (large-object.c).

We also change the existing basic-object.c to match.

Quoted 8 lines
---
  test/.gitignore     |    1
  test/Makefile.am    |    5 -
  test/basic-object.c |   13 +-
  test/large-object.c |  197 ++++++++++++++++++++++++++++++++++++++++++
  4 files changed, 209 insertions(+), 7 deletions(-)

applied.

a follow-up patch that checks the checksums of the data sent/received would be nice...

#2 lore raw
Quoted 2 lines · On Tue, 05 Jan 2010 04:14:08 -0500 Jeff Garzik <[email protected]> wrote:

a follow-up patch that checks the checksums of the data sent/received would be nice...

That would require more coding than using single check bytes because a checksum can span a block boundary. But ok, you're right, I'll do it.

-- Pete