@@ -99,6 +99,22 @@ def make_source_tree(root):
9999 for n in files :
100100 os .system ('touch %s/d0/d0%d/d0%d%d/d0%d%d%d/f0%d%d%d%d' % (root ,i ,i ,k ,i ,k ,m ,i ,k ,m ,n ))
101101
102+
103+ def do_gufi_query_command (entries_table , output_file , gufi_index ):
104+ entries_sql = """
105+ SELECT Path(),NAME,type,inode,nlink,size,mode,uid,gid,blksize,blocks,mtime,ctime,linkname,xattr_names
106+ FROM %s;
107+ """ % entries_table
108+
109+ summary_sql = """
110+ SELECT Path(),NAME,type,inode,nlink,size,mode,uid,gid,blksize,blocks,mtime,ctime,linkname,xattr_names
111+ FROM vsummarydir;
112+ """
113+
114+ os .system ('gufi_query -n1 -x -d\' |\' -E "%s" -S "%s" -a 1 -o "%s" "%s"'
115+ % (entries_sql , summary_sql , output_file , gufi_index ))
116+
117+
102118# initialize a src tree, make a full gufi tree, do a bfq in case we want to compare with the full at initial state, make a full initial tree snap
103119def ginit ():
104120 print ("initializing a tree, full gufi tree, and full tree snap" )
@@ -118,17 +134,7 @@ def ginit():
118134
119135 # this is just for testing - make a bfq output to compare with if we want to - leave out atime as it may change
120136 os .chdir (topgt )
121- entries_sql = """
122- SELECT Path(),NAME,type,inode,nlink,size,mode,uid,gid,blksize,blocks,mtime,ctime,linkname,
123- xattr_names
124- FROM entries;
125- """
126- summary_sql = """
127- SELECT Path(),NAME,type,inode,nlink,size,mode,uid,gid,blksize,blocks,mtime,ctime,linkname,
128- xattr_names
129- FROM vsummarydir;
130- """
131- os .system ('gufi_query -n1 -x -d\' |\' -E "%s" -S "%s" -a 1 -o %s/fullbfqout %s/d0' % (entries_sql , summary_sql , top ,topgt ))
137+ do_gufi_query_command (entries_table = "entries" , output_file = "%s/fullbfqout" % top , gufi_index = "%s/d0" % topgt )
132138
133139 summary_sql = """
134140INSERT INTO readdirplus
@@ -378,15 +384,7 @@ def gincr(suspectopt):
378384 print ("update done" )
379385 os .chdir (topgt )
380386 # leave out atime
381- entries_sql = """
382- SELECT Path(),NAME,type,inode,nlink,size,mode,uid,gid,blksize,blocks,mtime,ctime,linkname,xattr_names
383- FROM entries;
384- """
385- summary_sql = """
386- SELECT Path(),NAME,type,inode,nlink,size,mode,uid,gid,blksize,blocks,mtime,ctime,linkname,xattr_names
387- FROM vsummarydir;
388- """
389- os .system ('gufi_query -n1 -x -d\' |\' -E "%s" -S "%s" -a 1 -o %s/incrbfqoutafter d0' % (entries_sql , summary_sql , top ))
387+ do_gufi_query_command (entries_table = "entries" , output_file = "%s/incrbfqoutafter" % top , gufi_index = "d0" )
390388 os .chdir (top )
391389
392390# make a full gufi tree of the src tree after mods then do a bfq of that for comparison with an incrementally updated gufi tree
@@ -395,15 +393,7 @@ def gfullafter():
395393 os .system ('gufi_dir2index -n 2 -x d0 %s' % (fa ))
396394 os .chdir (topfullafter )
397395 #leave out atime
398- entries_sql = """
399- SELECT Path(),NAME,type,inode,nlink,size,mode,uid,gid,blksize,blocks,mtime,ctime,linkname,xattr_names
400- FROM vrpentries;
401- """
402- summary_sql = """
403- SELECT Path(),NAME,type,inode,nlink,size,mode,uid,gid,blksize,blocks,mtime,ctime,linkname,xattr_names
404- FROM vsummarydir;
405- """
406- os .system ('gufi_query -n1 -x -d\' |\' -E "%s" -S "%s" -a 1 -o %s/fullbfqoutafter d0' % (entries_sql , summary_sql , top ))
396+ do_gufi_query_command (entries_table = "vrpentries" , output_file = "%s/fullbfqoutafter" % top , gufi_index = "d0" )
407397 os .chdir (top )
408398
409399def test_prep (name ):
0 commit comments