consolidated into one script

This commit is contained in:
Bernardo Damele 2013-01-26 16:11:09 +00:00
parent 2a9fe62c3f
commit 234e4c9f69
2 changed files with 13 additions and 30 deletions

View File

@ -4,6 +4,7 @@
# See the file 'doc/COPYING' for copying permission # See the file 'doc/COPYING' for copying permission
import codecs import codecs
import inspect
import os import os
import re import re
import smtplib import smtplib
@ -14,7 +15,7 @@ import time
from email.mime.multipart import MIMEMultipart from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText from email.mime.text import MIMEText
sys.path.append("../../") sys.path.append(os.path.normpath("%s/../../" % os.path.dirname(inspect.getfile(inspect.currentframe()))))
from lib.core.revision import getRevisionNumber from lib.core.revision import getRevisionNumber
@ -64,7 +65,7 @@ def main():
test_counts = [] test_counts = []
attachments = {} attachments = {}
command_line = "cd %s && python sqlmap.py --live-test" % SQLMAP_HOME command_line = "python /opt/sqlmap/sqlmap.py --live-test" % SQLMAP_HOME
proc = subprocess.Popen(command_line, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc = subprocess.Popen(command_line, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
proc.wait() proc.wait()
@ -138,4 +139,13 @@ def main():
send_email(msg) send_email(msg)
if __name__ == "__main__": if __name__ == "__main__":
main() log_fd = open("/tmp/regressiontest.txt", "ab")
log_fd.write("Regression test started at %s\n" % TIME)
try:
main()
except Exception, e:
log_fd.write("An exception has occurred:\n%s" % str(traceback.format_exc()))
log_fd.write("\nRegression test finished at %s\n\n" % TIME)
log_fd.close()

View File

@ -1,27 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
# See the file 'doc/COPYING' for copying permission
SQLMAP_HOME="/opt/sqlmap"
REGRESSION_SCRIPT="${SQLMAP_HOME}/extra/shutils"
FROM="regressiontest@sqlmap.org"
TO="bernardo.damele@gmail.com, miroslav.stampar@gmail.com"
SUBJECT="Automated regression test failed on $(date)"
cd $SQLMAP_HOME
git pull
rm -f output 2>/dev/null
cd $REGRESSION_SCRIPT
echo "Regression test started at $(date)" 1>/tmp/regressiontest.log 2>&1
python regressiontest.py 1>>/tmp/regressiontest.log 2>&1
if [ $? -ne 0 ]
then
echo "Regression test finished at $(date)" 1>>/tmp/regressiontest.log 2>&1
cat /tmp/regressiontest.log | mailx -s "${SUBJECT}" -aFrom:${FROM} ${TO}
else
echo "Regression test finished at $(date)" 1>>/tmp/regressiontest.log 2>&1
fi