From d6db83fe88d5fd8e6509a92e09d6d83a238b3b51 Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Mon, 11 Feb 2013 18:07:15 +0000 Subject: [PATCH] Send an email also when regression test is successful --- extra/shutils/regressiontest.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/extra/shutils/regressiontest.py b/extra/shutils/regressiontest.py index 199478210..5ea6f03fd 100644 --- a/extra/shutils/regressiontest.py +++ b/extra/shutils/regressiontest.py @@ -30,7 +30,7 @@ SMTP_TIMEOUT = 30 FROM = "regressiontest@sqlmap.org" #TO = "dev@sqlmap.org" TO = ["bernardo.damele@gmail.com", "miroslav.stampar@gmail.com"] -SUBJECT = "Regression test on %s using revision %s" % (START_TIME, REVISION) +SUBJECT = "regression test started on %s using revision %s" % (START_TIME, REVISION) def prepare_email(content): global FROM @@ -132,9 +132,11 @@ def main(): content += "#######################################################################\n\n" + end_string = "Regression test finished at %s" % time.strftime("%H:%M:%S %d-%m-%Y", time.gmtime()) + if content: - content += "Regression test finished at %s" % time.strftime("%H:%M:%S %d-%m-%Y", time.gmtime()) - SUBJECT += " (%s)" % ", ".join("#%d" % count for count in test_counts) + content += end_string + SUBJECT = "Failed %s (%s)" % (SUBJECT, ", ".join("#%d" % count for count in test_counts)) msg = prepare_email(content) @@ -144,6 +146,10 @@ def main(): msg.attach(attachment) send_email(msg) + else: + SUBJECT += "Successful %s" % SUBJECT + msg = prepare_email("All test cases were successful\n\n%s" % end_string) + send_email(msg) if __name__ == "__main__": log_fd = open("/tmp/sqlmapregressiontest.log", "wb")