[Pvfs2-cvs] commit by mtmoore in pvfs2/test/shared: test-common.c
test-common.h
CVS commit program
cvs at parl.clemson.edu
Fri Dec 17 15:39:44 EST 2010
Update of /projects/cvsroot/pvfs2/test/shared
In directory parlweb1:/tmp/cvs-serv7288/shared
Modified Files:
Tag: cu-security-branch
test-common.c test-common.h
Log Message:
modify test-mkdir.c to avoid multiple/stale ncache problem, just call stat using pvfs2-stat.
Index: test-common.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/shared/test-common.c,v
diff -p -u -r1.8.10.4 -r1.8.10.5
--- test-common.c 12 Jul 2010 00:03:46 -0000 1.8.10.4
+++ test-common.c 17 Dec 2010 20:39:43 -0000 1.8.10.5
@@ -315,7 +315,7 @@ int stat_file(
PVFS_sysresp_getattr getattr_response;
PVFS_credential credentials;
PVFS_fs_id fs_id;
-
+
if(verbose) { printf("\tPerforming stat on [%s]\n", fileName); }
if(use_pvfs2_lib)
@@ -331,8 +331,13 @@ int stat_file(
return(TEST_COMMON_FAIL);
}
- PVFS_util_gen_credential_defaults(&credentials);
-
+ ret = PVFS_util_gen_credential_defaults(&credentials);
+ if( ret < 0 )
+ {
+ print_error("Error: could not get credentials (%d)\n", ret);
+ PVFS_perror("PVFS_util_gen_credential_defaults", ret);
+ return(TEST_COMMON_FAIL);
+ }
if(followLink)
{
ret = PVFS_sys_lookup(fs_id,
@@ -398,6 +403,55 @@ int stat_file(
}
return(TEST_COMMON_FAIL);
}
+ }
+
+ return(TEST_COMMON_SUCCESS);
+}
+
+
+/*
+ * \retval TEST_COMMON_SUCCESS Success
+ * \retval TEST_COMMON_FAIL Failure
+ */
+int stat_file2(
+ const char * fileName, /**< File Name */
+ const int followLink, /**< Determines whether to stat link or link target */
+ const int use_pvfs2_lib, /**< determines use of pvfs2 library */
+ const int verbose) /**< Turns on verbose prints if set to non-zero value */
+{
+ int ret=0;
+ char cmd[PATH_MAX] = "";
+ char szPvfsPath[PVFS_NAME_MAX] = "";
+ PVFS_sysresp_lookup lk_response;
+ PVFS_object_ref ref;
+ PVFS_sysresp_getattr getattr_response;
+ PVFS_credential credentials;
+ PVFS_fs_id fs_id;
+
+ if(verbose) { printf("\tPerforming stat on [%s]\n", fileName); }
+
+ if(use_pvfs2_lib)
+ {
+ if( verbose )
+ {
+ snprintf(cmd, sizeof(cmd), "%spvfs2-stat %s", pvfsEXELocation, fileName);
+ }
+ else
+ {
+ snprintf(cmd, sizeof(cmd), "%spvfs2-stat %s >/dev/null 2>&1", pvfsEXELocation, fileName);
+ }
+
+ ret = system(cmd);
+ if(ret < 0)
+ {
+ PVFS_perror("PVFS_sys_lookup", ret);
+ return(TEST_COMMON_FAIL);
+ }
+ }
+ else
+ {
+ print_error("Can't call this stat_file unless with use_pvfs2_lib\n");
+ return(TEST_COMMON_FAIL);
}
return(TEST_COMMON_SUCCESS);
}
Index: test-common.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/shared/test-common.h,v
diff -p -u -r1.3.46.3 -r1.3.46.4
--- test-common.h 12 Jul 2010 00:03:46 -0000 1.3.46.3
+++ test-common.h 17 Dec 2010 20:39:44 -0000 1.3.46.4
@@ -118,6 +118,11 @@ int stat_file(const char * fileName,
const int use_pvfs2_lib,
const int verbose);
+int stat_file2(const char * fileName,
+ const int followLink,
+ const int use_pvfs2_lib,
+ const int verbose);
+
int pvfs2_open(const char * fileName,
const int accessFlags,
const int mode,
More information about the Pvfs2-cvs
mailing list