#
# SPDX-License-Identifier: AGPL-3.0
+from __future__ import print_function
+from __future__ import absolute_import
from multiprocessing import Process
import os
import subprocess
import sys
-import prof
+from . import prof
def fn(n):
return "file%i" % n
def createfiles(d, n):
for j in xrange(1, 5):
- print "Starting small file %s %i, %i" % (d, n, j)
+ print("Starting small file %s %i, %i" % (d, n, j))
if d:
os.mkdir(d)
ld = os.listdir('.')
if d not in ld:
- print "ERROR %s missing" % d
+ print("ERROR %s missing" % d)
os.chdir(d)
for i in xrange(n, n+10):
ld = os.listdir('.')
for i in xrange(n, n+10):
if fn(i) not in ld:
- print "ERROR %s missing" % fn(i)
+ print("ERROR %s missing" % fn(i))
for i in xrange(n, n+10):
with open(fn(i), "r") as f:
if f.read() != fn(i):
- print "ERROR %s doesn't have expected contents" % fn(i)
+ print("ERROR %s doesn't have expected contents" % fn(i))
for i in xrange(n, n+10):
os.remove(fn(i))
ld = os.listdir('.')
for i in xrange(n, n+10):
if fn(i) in ld:
- print "ERROR %s should have been removed" % fn(i)
+ print("ERROR %s should have been removed" % fn(i))
if d:
os.chdir('..')
os.rmdir(d)
ld = os.listdir('.')
if d in ld:
- print "ERROR %s should have been removed" % d
+ print("ERROR %s should have been removed" % d)
def createbigfile(d, n):
for j in xrange(1, 5):
- print "Starting big file %s %i, %i" % (d, n, j)
+ print("Starting big file %s %i, %i" % (d, n, j))
i = n
if d:
os.mkdir(d)
ld = os.listdir('.')
if d not in ld:
- print "ERROR %s missing" % d
+ print("ERROR %s missing" % d)
os.chdir(d)
with open(fn(i), "w") as f:
ld = os.listdir('.')
if fn(i) not in ld:
- print "ERROR %s missing" % fn(i)
+ print("ERROR %s missing" % fn(i))
with open(fn(i), "r") as f:
for j in xrange(0, 1000):
expect = (str(j) + fn(i)) * 10000
if f.read(len(expect)) != expect:
- print "ERROR %s doesn't have expected contents" % fn(i)
+ print("ERROR %s doesn't have expected contents" % fn(i))
os.remove(fn(i))
ld = os.listdir('.')
if fn(i) in ld:
- print "ERROR %s should have been removed" % fn(i)
+ print("ERROR %s should have been removed" % fn(i))
if d:
os.chdir('..')
os.rmdir(d)
ld = os.listdir('.')
if d in ld:
- print "ERROR %s should have been removed" % d
+ print("ERROR %s should have been removed" % d)
def do_ls():
with open("/dev/null", "w") as nul:
p.join()
if os.listdir('.'):
- print "ERROR there are left over files in the directory"
+ print("ERROR there are left over files in the directory")
if __name__ == '__main__':
if os.listdir('.'):
- print "ERROR starting directory is not empty"
+ print("ERROR starting directory is not empty")
sys.exit()
- print "Single directory small files"
+ print("Single directory small files")
with prof.CountTime():
runit(createfiles, False)
- print "Separate directories small files"
+ print("Separate directories small files")
with prof.CountTime():
runit(createfiles, True)
- print "Single directory large files"
+ print("Single directory large files")
with prof.CountTime():
runit(createbigfile, False)
- print "Separate directories large files"
+ print("Separate directories large files")
with prof.CountTime():
runit(createbigfile, True)
#
# SPDX-License-Identifier: AGPL-3.0
+from __future__ import absolute_import
+from future.utils import viewitems
+from builtins import str
+from builtins import range
import arvados
import arvados_fuse as fuse
import llfuse
logger = logging.getLogger('arvados.arv-mount')
-from performance_profiler import profiled
+from .performance_profiler import profiled
def fuse_createCollectionWithMultipleBlocks(mounttmp, streams=1, files_per_stream=1, data='x'):
class Test(unittest.TestCase):
for j in range(0, files_per_stream):
files[os.path.join(self.mounttmp, collection, 'file'+str(j)+'.txt')] = data
- for k, v in files.items():
+ for k, v in viewItems(files):
with open(os.path.join(self.mounttmp, collection, k)) as f:
self.assertEqual(v, f.read())