Commit 07a723c0 by Minh Tue Vo Committed by benrobot

fixing file log error

parent bef4e9c5
...@@ -20,22 +20,28 @@ with tarfile.open(output_filename, "w:gz") as tar: ...@@ -20,22 +20,28 @@ with tarfile.open(output_filename, "w:gz") as tar:
tar.close() tar.close()
session_path = os.environ['HOME'] + '/results/' + os.environ['TDDIUM_SESSION_ID'] + '/session/' session_path = os.path.join(
file_dest = session_path + 'reports.tar.gz' os.environ['HOME'],
'results',
os.environ['TDDIUM_SESSION_ID'],
'session')
file_dest = os.path.join(session_path, 'reports.tar.gz')
# if the tar file is not empty, copy it to the proper place # if the tar file is not empty, copy it to the proper place
if count > 0: if count > 0:
print 'copying tar file to:', file_dest
shutil.copyfile(output_filename, file_dest) shutil.copyfile(output_filename, file_dest)
print 'done copying file'
# finding if there is any screenshot or log file # finding if there is any screenshot or log file
print 'attaching failed screenshots and logs (if any)' print 'attaching failed screenshots and logs (if any)'
for (path, dirs, files) in os.walk('test_root/log'): for (path, dirs, files) in os.walk('test_root/log'):
for filename in files: for filename in files:
if filename.find('png') != -1 or filename.find('log') != -1: if filename.find('png') != -1 or filename.find('log') != -1:
filepath = path + filename filepath = os.path.join(path, filename)
print 'copying file:', filepath print 'copying file:', filepath
destpath = session_path + filename destpath = os.path.join(session_path, filename)
print 'destination:', destpath
shutil.copyfile(filepath, destpath) shutil.copyfile(filepath, destpath)
print 'TDDIUM_SESSION_ID:', os.environ['TDDIUM_SESSION_ID'] print 'TDDIUM_SESSION_ID:', os.environ['TDDIUM_SESSION_ID']
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment