From: Andrew Lewis Date: Tue, 9 Aug 2016 13:12:46 +0000 (+0100) Subject: [Test] Add custom rspamd log follower for non-standard tests X-Git-Tag: 1.3.3~42^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=67ee0d9274e0d27d6c0e118de11862c8258597b9;p=rspamd.git [Test] Add custom rspamd log follower for non-standard tests --- diff --git a/test/functional/cases/140_proxy.robot b/test/functional/cases/140_proxy.robot index 6ad308692..a82c687e4 100644 --- a/test/functional/cases/140_proxy.robot +++ b/test/functional/cases/140_proxy.robot @@ -12,10 +12,8 @@ ${MESSAGE} ${TESTDIR}/messages/spam_message.eml *** Test Cases *** Scan Message ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_PROXY} -p ${MESSAGE} - ${PROXY_LOGPOS} = Log Logs ${PROXY_TMPDIR}/rspamd.log ${PROXY_LOGPOS} - Set Suite Variable ${PROXY_LOGPOS} - ${SLAVE_LOGPOS} = Log Logs ${SLAVE_TMPDIR}/rspamd.log ${SLAVE_LOGPOS} - Set Suite Variable ${SLAVE_LOGPOS} + Custom Follow Rspamd Log ${PROXY_TMPDIR}/rspamd.log ${PROXY_LOGPOS} PROXY_LOGPOS Suite + Custom Follow Rspamd Log ${SLAVE_TMPDIR}/rspamd.log ${SLAVE_LOGPOS} SLAVE_LOGPOS Suite Run Keyword If ${result.rc} != 0 Log ${result.stderr} Should Contain ${result.stdout} SIMPLE_TEST Should Be Equal As Integers ${result.rc} 0 diff --git a/test/functional/lib/rspamd.robot b/test/functional/lib/rspamd.robot index 02df036f3..a4769f4a5 100644 --- a/test/functional/lib/rspamd.robot +++ b/test/functional/lib/rspamd.robot @@ -38,6 +38,13 @@ Check Rspamc Match String Run Keyword If ${inverse} == False Should Contain ${subject} ${str} ... ELSE Should Not Contain ${subject} ${str} +Custom Follow Rspamd Log + [Arguments] ${logfile} ${logpos} ${logpos_var} ${scope} + ${logpos} = Log Logs ${logfile} ${logpos} + Run Keyword If '${scope}' == 'Test' Set Test Variable ${${logpos_var}} ${logpos} + ... ELSE IF '${scope}' == 'Suite' Set Suite Variable ${${logpos_var}} ${logpos} + ... ELSE Fail 'scope must be Test or Suite' + Follow Rspamd Log ${RSPAMD_LOGPOS} = Log Logs ${TMPDIR}/rspamd.log ${RSPAMD_LOGPOS} Run Keyword If '${RSPAMD_SCOPE}' == 'Test' Set Test Variable ${RSPAMD_LOGPOS}