summaryrefslogtreecommitdiffstats
path: root/tests/utils/create-files.py
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2019-06-06 12:54:04 +0530
committerHari Gowtham <hgowtham@redhat.com>2019-06-28 16:37:08 +0530
commit5355f5a18146183a8e27872ebee501acad7b5eb0 (patch)
tree71b7c939d04f5b8470e76cb38e5e48f1b4a06b70 /tests/utils/create-files.py
parent515866cd49aadf52c9949f8745fd2ba1ea9c99c3 (diff)
tests/utils: Fix py2/py3 util python scripts
Following files are fixed. tests/bugs/distribute/overlap.py tests/utils/changelogparser.py tests/utils/create-files.py tests/utils/gfid-access.py tests/utils/libcxattr.py Have marked glupy as bad test. Backport of: > Change-Id: I3db857cc19e19163d368d913eaec1269fbc37140 > BUG: 1193929 > Signed-off-by: Kotresh HR <khiremat@redhat.com> Change-Id: I3db857cc19e19163d368d913eaec1269fbc37140 Updates: bz#1629877 Signed-off-by: Kotresh HR <khiremat@redhat.com>
Diffstat (limited to 'tests/utils/create-files.py')
-rwxr-xr-xtests/utils/create-files.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/utils/create-files.py b/tests/utils/create-files.py
index b2a19610d63..04736e9c73b 100755
--- a/tests/utils/create-files.py
+++ b/tests/utils/create-files.py
@@ -19,6 +19,11 @@ import argparse
datsiz = 0
timr = 0
+def get_ascii_upper_alpha_digits():
+ if sys.version_info > (3,0):
+ return string.ascii_uppercase+string.digits
+ else:
+ return string.uppercase+string.digits
def setLogger(filename):
global logger
@@ -111,7 +116,7 @@ def create_tar_file(fil, size, mins, maxs, rand):
def get_filename(flen):
size = flen
- char = string.uppercase+string.digits
+ char = get_ascii_upper_alpha_digits()
st = ''.join(random.choice(char) for i in range(size))
ti = str((hex(int(str(time.time()).split('.')[0])))[2:])
return ti+"%%"+st
@@ -175,7 +180,7 @@ def tar_files(files, file_count, inter, size, mins, maxs,
def setxattr_files(files, randname, dir_path):
- char = string.uppercase+string.digits
+ char = get_ascii_upper_alpha_digits()
if not randname:
for k in range(files):
v = ''.join(random.choice(char) for i in range(10))