def main(): if sys.argv[1:]: sync = sys.argv[1] + ' ' + TESTCOMMENT else: print 'Usage: ./testsync.py path/sync.py' exit(1) for cnt in xrange(1000): assert 0==os.system(sync) assert save({'cnt':cnt,'hname':gethostname()},time.time(),PATH) c2 = read_c2(PATH) #debug print cnt print c2 print print [x for x in c2 if thishost(x)] if len([x for x in c2 if thishost(x)])!=cnt+1: print 'Bug! Bug! Bug!' randomsleep(60,120)
def main(): if sys.argv[1:]: sync = sys.argv[1] + ' ' + TESTCOMMENT else: print 'Usage: ./testsync.py path/sync.py' exit(1) for cnt in xrange(1000): assert 0==os.system(sync) assert save({'cnt':cnt,'hname':gethostname()},time.time(),PATH) c2 = read_c2(PATH) #debug print cnt print c2 print print [x for x in c2 if thishost(x)] if len([x for x in c2 if thishost(x)])!=cnt+1: print 'Bug! Bug! Bug!' randomsleep(60,120) def thishost(x): ''' return True if x obj war inserted by this host ''' for k,v in x: if k=='hname' and v==gethostname(): return 1 return 0 if __name__=="__main__": main()