Skip to content

Commit 358dbc9

Browse files
committed
gitest.py: make suspectopt a function argument
A global variable isn't the clearest way to pass data to a function: normally, arguments are used for this purpose.
1 parent 90c0eac commit 358dbc9

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

test/gitest.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ def ginit():
132132
print ("time after create initial gufi tree sec %s" % (mysec[0]))
133133

134134
# this is where incremental of a gufi is done in addition we do a gufi_query of the incrementally updated gufi tree for comparison
135-
def gincr():
136-
global suspectopt
135+
def gincr(suspectopt):
137136
mytime=str(time.mktime(time.localtime()))
138137
mysec=mytime.partition(".")
139138
os.system('echo %s > incrtime' % (mysec[0]))
@@ -304,8 +303,7 @@ def test_1():
304303
time.sleep(1)
305304

306305
# do incremental update of gufi tree
307-
suspectopt="-A 3"
308-
gincr()
306+
gincr("-A 3")
309307

310308
test_finish(testn)
311309

@@ -319,8 +317,7 @@ def test_2():
319317
# wait until incremental time
320318
time.sleep(1)
321319
# do incremental update of gufi tree
322-
suspectopt="-A 3"
323-
gincr()
320+
gincr("-A 3")
324321

325322
test_finish(testn)
326323

@@ -337,8 +334,7 @@ def test_3():
337334
# wait until incremental time
338335
time.sleep(1)
339336
# do incremental update of gufi tree
340-
suspectopt="-A 3"
341-
gincr()
337+
gincr("-A 3")
342338

343339
test_finish(testn)
344340

@@ -358,8 +354,7 @@ def test_4():
358354
# wait until incremental time
359355
time.sleep(1)
360356
# do incremental update of gufi tree
361-
suspectopt="-A 3"
362-
gincr()
357+
gincr("-A 3")
363358

364359
test_finish(testn)
365360

@@ -382,8 +377,7 @@ def test_5():
382377
# wait until incremental time
383378
time.sleep(1)
384379
# do incremental update of gufi tree
385-
suspectopt="-A 3"
386-
gincr()
380+
gincr("-A 3")
387381

388382
test_finish(testn)
389383

@@ -406,13 +400,11 @@ def test_6():
406400
mksus="echo %s f >> %s/suspects" % (mstat.st_ino,top)
407401
os.system(mksus)
408402
# now that we have a suspect file we tell bfwreaddirplus2db to use that for file suspects (stat dirs but use suspect file for files/links
409-
suspectopt="-A 2 -W %s/suspects " % (top)
410-
gincr()
403+
gincr("-A 2 -W %s/suspects " % (top))
411404

412405
test_finish(testn)
413406

414407
if __name__ == "__main__":
415-
suspectopt=" "
416408
test_1()
417409
test_2()
418410
test_3()

0 commit comments

Comments
 (0)