diff options
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/lib/rspamd.py | 20 | ||||
-rw-r--r-- | test/functional/lib/rspamd.robot | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/test/functional/lib/rspamd.py b/test/functional/lib/rspamd.py index 3db57a87e..2010f4127 100644 --- a/test/functional/lib/rspamd.py +++ b/test/functional/lib/rspamd.py @@ -12,6 +12,7 @@ import string import sys import tempfile import time +from robot.libraries.BuiltIn import BuiltIn if sys.version_info > (3,): long = int @@ -33,6 +34,23 @@ def Check_JSON(j): def cleanup_temporary_directory(directory): shutil.rmtree(directory) +def save_run_results(directory, filenames): + current_directory = os.getcwd() + suite_name = BuiltIn().get_variable_value("${SUITE_NAME}") + test_name = BuiltIn().get_variable_value("${TEST NAME}") + if test_name is None: + # this is suite-level tear down + destination_directory = "%s/robot-save/%s" % (current_directory, suite_name) + else: + destination_directory = "%s/robot-save/%s/%s" % (current_directory, suite_name, test_name) + if not os.path.isdir(destination_directory): + os.makedirs(destination_directory) + for file in filenames.split(' '): + source_file = "%s/%s" % (directory, file) + if os.path.isfile(source_file): + shutil.copy(source_file, "%s/%s" % (destination_directory, file)) + shutil.copy(source_file, "%s/robot-save/%s.last" % (current_directory, file)) + def encode_filename(filename): return "".join(['%%%0X' % ord(b) for b in filename]) @@ -58,6 +76,7 @@ def get_rspamd(): return os.environ['RSPAMD_INSTALLROOT'] + "/bin/rspamd" dname = get_top_dir() return dname + "/src/rspamd" + def get_rspamc(): if os.environ.get('RSPAMC'): return os.environ['RSPAMC'] @@ -65,6 +84,7 @@ def get_rspamc(): return os.environ['RSPAMD_INSTALLROOT'] + "/bin/rspamc" dname = get_top_dir() return dname + "/src/client/rspamc" + def get_rspamadm(): if os.environ.get('RSPAMADM'): return os.environ['RSPAMADM'] diff --git a/test/functional/lib/rspamd.robot b/test/functional/lib/rspamd.robot index 7b355f85b..ec2fc5e84 100644 --- a/test/functional/lib/rspamd.robot +++ b/test/functional/lib/rspamd.robot @@ -70,6 +70,7 @@ Generic Teardown [Arguments] @{ports} Run Keyword If '${CONTROLLER_ERRORS}' == 'True' Check Controller Errors Shutdown Process With Children ${RSPAMD_PID} + Save Run Results ${TMPDIR} rspamd.log redis.log rspamd.conf Cleanup Temporary Directory ${TMPDIR} Log Logs |