aboutsummaryrefslogtreecommitdiff
path: root/scripts/check-for-type-punning-warnings.py
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2011-10-07 18:20:43 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2011-10-07 18:20:43 +0000
commit391435862586223e3e90adb3f4cd52c9b848cffd (patch)
tree7cab3251ab73f6ef5376d3dc83d3ecf55a87d648 /scripts/check-for-type-punning-warnings.py
parent968c356f50ea0b66ac5b265070184db3cdce0790 (diff)
script to parse build logs for type-punning warnings and email about them
svn path=/trunk/; revision=15536
Diffstat (limited to 'scripts/check-for-type-punning-warnings.py')
-rwxr-xr-xscripts/check-for-type-punning-warnings.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/scripts/check-for-type-punning-warnings.py b/scripts/check-for-type-punning-warnings.py
new file mode 100755
index 00000000..84637500
--- /dev/null
+++ b/scripts/check-for-type-punning-warnings.py
@@ -0,0 +1,56 @@
+#!/usr/bin/python
+
+import smtplib
+import glob
+import datetime
+
+date = datetime.datetime.now().strftime("%Y-%m-%d")
+outputfilename = 'type-punning.log'
+
+logoutput = []
+
+for log in glob.glob('/var/www/auto-build/' + date + '/logs/20*.txt'):
+ f = open(log, 'r')
+ logoutput.append('======================================================================\n')
+ logoutput.append(log + '\n')
+ logoutput.append('======================================================================\n')
+ for line in f:
+ if line.find('warning: dereferencing type-punned pointer will break strict-aliasing rules') > -1:
+ logoutput.append(line.replace('/home/pd/auto-build/', '')
+ .replace('C:/MinGW/msys/1.0', '')
+ .replace('/Users/pd/auto-build/', ''))
+ f.close()
+
+lf = open('/tmp/'+outputfilename, 'w')
+for line in logoutput:
+ lf.write(line)
+lf.close()
+
+# make the email report
+fromaddr = 'pd@pdlab.idmi.poly.edu'
+toaddr = 'hans@at.or.at'
+mailoutput = []
+mailoutput.append('From: ' + fromaddr + '\n')
+mailoutput.append('To: ' + toaddr + '\n')
+mailoutput.append('Subject: type-punning warnings ' + date + '\n\n\n')
+mailoutput.append('______________________________________________________________________\n\n')
+mailoutput.append('Complete log:\n')
+mailoutput.append('http://autobuild.puredata.info/auto-build/' + date + '/'
+ + outputfilename + '\n')
+
+
+# upload the log file to the autobuild website
+rsyncfile = 'rsync://128.238.56.50/upload/' + date + '/logs/' + outputfilename
+try:
+ p = subprocess.Popen(['rsync', '-ax', '/tmp/'+outputfilename, rsyncfile],
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT).wait()
+except:
+ mailoutput.append('rsync upload of the log failed!\n')
+# mailoutput.append(''.join(p.stdout.readlines()))
+
+
+
+mailoutput.append('______________________________________________________________________\n\n')
+server = smtplib.SMTP('in1.smtp.messagingengine.com')
+server.sendmail(fromaddr, toaddr, ''.join(mailoutput + logoutput))
+server.quit()