[Pvfs2-cvs] commit by kunkel in pvfs2/test/common/misc: test-hint.c module.mk.in

CVS commit program cvs at parl.clemson.edu
Sat Aug 19 09:09:42 EDT 2006


Update of /projects/cvsroot/pvfs2/test/common/misc
In directory parlweb1:/tmp/cvs-serv3901/test/common/misc

Modified Files:
      Tag: kunkel-branch
	module.mk.in 
Added Files:
      Tag: kunkel-branch
	test-hint.c 
Log Message:
Added PVFS-hint, changed tests for pwrite/odirect/transactions/aio dbpf
 support to allow users to explicitly enable or disable the functionality.
In the aio implementation is a bug since somebody else modified it.


--- /dev/null	2004-06-24 14:04:38.000000000 -0400
+++ test-hint.c	2006-08-19 09:09:42.000000000 -0400
@@ -0,0 +1,81 @@
+#include <stdio.h>
+
+#include "pvfs2.h"
+#include "pvfs2-hint.h"
+
+int main(int argc, char ** argv){
+	PVFS_hint * hint = NULL;
+    int ret;
+    const char * hint_p;
+    
+    int outlength;
+    int outlength2;
+    char buffer[255];
+    memset(buffer, 0,255);
+    
+    ret = PVFS_add_hint(& hint, REQUEST_ID, "REQUEST ID BLUB");
+    if(ret < 0){
+        printf("Error add hint: %d, %s \n", -ret, strerror(-ret));
+        return 1;
+    }
+    
+    ret = PVFS_add_hint(& hint, CREATE_SET_METAFILE_NODE, "CREATE_SET_METAFILE_NODE");
+    if(ret < 0){
+        printf("Error add hint: %d, %s \n", -ret, strerror(-ret));
+        return 1;
+    }
+    
+    hint_p = PVFS_get_hint(hint, CREATE_SET_METAFILE_NODE);
+    printf("Reget hint CREATE_SET_METAFILE_NODE: %s\n", hint_p);
+    if ( hint_p == NULL){
+        return 1;
+    }
+    
+    hint_p = PVFS_get_hint(hint, REQUEST_ID);
+    printf("Reget hint REQUEST_ID: %s\n", hint_p);
+    if ( hint_p == NULL){
+        return 1;
+    }
+    
+    ret = PINT_hint_encode(hint, buffer, & outlength, 255);
+    if(ret < 0){
+        printf("Error PINT_hint_encode: %d, %s \n", -ret, strerror(-ret));
+        return 1;
+    }
+    
+    printf("Encoded length: %d\n",outlength);
+    
+    PVFS_free_hint(& hint);
+    
+    ret = PINT_hint_decode(& hint, buffer, & outlength2);
+    if(ret < 0){
+        printf("Error PINT_hint_decode: %d, %s \n", -ret, strerror(-ret));
+        return 1;
+    }
+    
+    if ( outlength2 != outlength){
+        printf("Error PINT_hint_decode length does not match length "
+            "of encode: %d encode: %d \n", outlength2, outlength);
+        return 1;        
+    }
+
+    hint_p = PVFS_get_hint(hint, REQUEST_ID);
+    printf("Reget REQUEST_ID hint after decode: %s\n", hint_p);
+    if ( hint_p == NULL){
+        return 1;
+    }
+    
+    PVFS_free_hint(& hint);   
+    
+	return 0;
+}
+
+/*
+ * Local variables:
+ *  mode: c
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ft=c ts=8 sts=4 sw=4 expandtab
+ */

Index: module.mk.in
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/common/misc/module.mk.in,v
diff -p -u -r1.4 -r1.4.16.1
--- module.mk.in	20 Dec 2005 00:08:34 -0000	1.4
+++ module.mk.in	19 Aug 2006 13:09:42 -0000	1.4.16.1
@@ -4,4 +4,5 @@ TESTSRC += \
 	$(DIR)/test-event-parser.c \
 	$(DIR)/test-event-summary.c \
         $(DIR)/test-tcache.c \
+	$(DIR)/test-hint.c \
  	$(DIR)/test-perf-counter.c



More information about the Pvfs2-cvs mailing list