CVS update by matsl xemacs-builds/matsl/package_smoketest, checkBuild.sh ...

xemacs-cvs at xemacs.org xemacs-cvs at xemacs.org
Mon Dec 18 17:39:33 EST 2006


  User: matsl   
  Date: 06/12/18 23:39:33

  Modified:    xemacs-builds/matsl/package_smoketest MANIFEST buildall.pl
                        checkBuild.sh crontab
  Added:       xemacs-builds/matsl/package_smoketest report-urls
                        showlogs.py xemacs-smoketest.py
Log:
Updated to current status 2006-12.

Revision  Changes    Path
1.2       +5 -1      XEmacs/xemacs-builds/matsl/package_smoketest/MANIFEST

Index: MANIFEST
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs-builds/matsl/package_smoketest/MANIFEST,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- MANIFEST	2004/10/06 23:24:26	1.1
+++ MANIFEST	2006/12/18 22:39:27	1.2
@@ -1,8 +1,12 @@
 --- SCRIPTS ---
 buildall.pl             - Controls the build process. The top script.
-xemacs-smoketest.sh     - Performs all the builds.
+xemacs-smoketest.py     - Performs all the builds.
 showlogs.pl             - Generates the webpage.
 checkBuild.sh           - Simple minded guard for killing hung xemacs processes.
+report-urls		- produce html for the table head links
 
 --- EXECUTION ---
 crontab                 - Crontab entries for running the smoketest.
+
+--- OLD - NOT USED ---
+xemacs-smoketest.sh     - Performs all the builds. Replaced by xemacs-smoketest.py.



1.2       +17 -9     XEmacs/xemacs-builds/matsl/package_smoketest/buildall.pl

Index: buildall.pl
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs-builds/matsl/package_smoketest/buildall.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- buildall.pl	2004/10/06 23:24:25	1.1
+++ buildall.pl	2006/12/18 22:39:28	1.2
@@ -1,20 +1,27 @@
 #!/usr/bin/perl
 
-# $Id: buildall.pl,v 1.1 2004/10/06 23:24:25 matsl Exp $
-
 # use this time for all time stamps so that they remain the same all over
 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time);
 
 use Fcntl ':flock';
 
+# Ignore files that we don't want to start a rebuild just because they
+# were changed. Could be because they are textfiles only or that they
+# are generated and can't be trusted for real changes.
+$ignoreEntries = "(INSTALL|README|CHANGES|ChangeLog)";
+
 sub getentries {
     my @entries;
-    open(FIND, "find $dirs -name Entries|");
+    open(FIND, "find $dirs -name Entries | grep -v '/unsupported/' |");
 
     while (<FIND>) {
         chomp;
         open(SINGLE, "<$_");
         while(<SINGLE>) {
+	    if ($_ =~ m|^/$ignoreEntries/|) {
+		# print "Ignore entry: $_\n";
+		next;
+	    }
             push @entries, $_;
         }
         close(SINGLE);
@@ -23,6 +30,7 @@ sub getentries {
     return @entries;
 }
 
+# Deprecated: $ignoreEntries replaces this below.
 # Pattern for finding stuff that can be changed. Is generated but also
 # checked in. We ignore those for now.
 $generated = "INSTALL|README|CHANGES";
@@ -88,19 +96,19 @@ chdir $pwd;
 
 if ($difference) {
     print LOG $date, ": We should be building this. Do it!\n";
-    system "./xemacs-smoketest.sh";
+    system "./xemacs-smoketest.py";
 } else {
     print LOG $date, ": We need not build this. Nothing new.\n";
 }
 
 # clean old stuff
-system "find build/logs -name '*.log' -mtime +8 -exec rm '{}' ';'";
-system "find build/logs -name '*.tail' -mtime +8 -exec rm '{}' ';'";
-system "find build/logs -name '*_macro_err_*.txt' -mtime +8 -exec rm '{}' ';'";
-system "find build/logs -name '*.tgz' -mtime +8 -exec rm '{}' ';'";
+system "find build/logs -name '*.log' -mtime +30 -exec rm '{}' ';'";
+system "find build/logs -name '*.tail' -mtime +30 -exec rm '{}' ';'";
+system "find build/logs -name '*_macro_err_*.txt' -mtime +30 -exec rm '{}' ';'";
+system "find build/logs -name '*.tgz' -mtime +30 -exec rm '{}' ';'";
 
 # Make index page
-system "./showlogs.pl > build/logs/index.html";
+system "./showlogs.py > build/logs/index.html";
 
 # Make mail
 system "./showlogs.pl 1 > build/logs/nologs.html";



1.2       +1 -3      XEmacs/xemacs-builds/matsl/package_smoketest/checkBuild.sh

Index: checkBuild.sh
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs-builds/matsl/package_smoketest/checkBuild.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- checkBuild.sh	2004/10/06 23:24:25	1.1
+++ checkBuild.sh	2006/12/18 22:39:28	1.2
@@ -1,7 +1,5 @@
 #!/bin/sh
 
-# $Id: checkBuild.sh,v 1.1 2004/10/06 23:24:25 matsl Exp $
-
 oldpidfile=$HOME/.xemacs_smoketest_pid
 
 newpid=`pgrep -u matsl xemacs-21`
@@ -17,7 +15,7 @@ oldpid=`cat $oldpidfile`
 if [ "$oldpid" == "$newpid" ]
 then
     echo "`date`: Same process ($oldpid). Try to kill it"
-    kill $oldpid
+    kill -9 $oldpid
     echo "no process" > $oldpidfile
 else
     echo "`date`: New process ($newpid). Continue."



1.2       +1 -1      XEmacs/xemacs-builds/matsl/package_smoketest/crontab

Index: crontab
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs-builds/matsl/package_smoketest/crontab,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- crontab	2004/10/06 23:24:25	1.1
+++ crontab	2006/12/18 22:39:28	1.2
@@ -1,2 +1,2 @@
-0 * * * * cd $HOME/work/smoketest; ./buildall.pl >$HOME/.buildlog 2>&1
+0 * * * * cd $HOME/work/smoketest; nice ./buildall.pl >$HOME/.buildlog 2>&1
 0-59/5 * * * * cd $HOME/work/smoketest; ./checkBuild.sh >>$HOME/.checkBuild.log 2>&1



1.1                  XEmacs/xemacs-builds/matsl/package_smoketest/report-urls

Index: report-urls
===================================================================
#!/usr/bin/python

urls = {
	'21.4-mule' : 'http://calypso.tux.org/pipermail/xemacs-buildreports/2006-November/000012.html',
	'21.5-mule' : 'http://calypso.tux.org/pipermail/xemacs-buildreports/2006-November/000010.html',
	'21.1-mule' : 'http://list-archive.xemacs.org/xemacs-build-reports/200411/msg00030.html',
	'21.4-nomule' :'http://calypso.tux.org/pipermail/xemacs-buildreports/2006-November/000011.html',
	'21.5-nomule' : '',
	'21.1-nomule' : 'http://list-archive.xemacs.org/xemacs-build-reports/200411/msg00031.html'
	}

import sys

print "<table border=2 width=\"100%\"><tr><th>Builds</th>"
print "<th><a href=" + urls['21.4-mule'] + ">21.4 mule</a></th>"
print "<th><a href=" + urls['21.5-mule'] + ">21.5 mule</a></th>"
# print "<th><a href=" + urls['21.1-mule'] + ">21.1 mule</a></th>"
print "<th><a href=" + urls['21.4-nomule'] + ">21.4 NO mule</a></th>"
print "<th><a href=" + urls['21.5-nomule'] + ">21.5 NO mule</a></th>"
# print "<th><a href=" + urls['21.1-nomule'] + ">21.1 NO mule</a></th>\n"
print "\n"




1.1                  XEmacs/xemacs-builds/matsl/package_smoketest/showlogs.py

Index: showlogs.py
===================================================================
#!/usr/bin/env python

# Generate The XEmacs Package Smoketest Report

import sys
import os
import re
import time

# Output
IP = None

# Find log status in file.
def logstatus(log):
    p = os.popen("tail -n 1 " + log)
    m = re.match(p.readline()[:-1], 'Status = 0')
    p.close()
    return m != None

# Get status info for all builds on a row
def getRowInfo(dir, logname):
    result = []
    
    m = re.match('(.*)_(.*)_(.*)\.log\.tail', logname)
    if not m:
        return result
    
    date = m.group(1)
    buildtype = m.group(2)
    buildarch = m.group(3)

    # There are only three builds ... but we show 4 as a reminder
    for bnum, buildarch in ((1, "21.4-mule"), (2, "21.5-mule"), (3, "21.4-nomule"), (4, "21.5-nomule")):
 	log = date +  "_" +  buildtype + "_" + buildarch + ".log"
        logpath = os.path.join(dir, log)
 	macros = date + "_macro_err_" + buildarch + ".txt"

        if not os.path.exists(logpath):
            result += [(False, None, None, buildarch)]
        else:
            result += [(logstatus(logpath), log, macros, buildarch)]

    return (date, result)

# Generate each build row ...
def log2html(row):
    if len(row) == 0:
        return
    
    date, info = row
    print >> IP, '<tr align="center">'
    print >> IP, '<td align="center">' + date + '</td>'

    for (status, log, macros, buildarch) in info:
        if log == None:
            print >> IP, '<td class="buildfail" align="center">No build</td>'
            continue
        td = ''
        if status:
            td = '<td class="buildok">ok<br>'
        else:
            td = '<td class="buildfail">FAIL<br>'
        print >> IP, td + '<a href=' + log + '>Full</a> | <a href="' + log + '.tail">Tail</a> | <a href="' + macros + '">Macros</a></td>'
    print >> IP, '</tr>'

# Generate RSS
def generateRSS(rows, RSS):

    print >> RSS, """<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>The XEmacs Package Smoketest</title>
    <link>http://labb.contactor.se/~matsl/smoketest/logs/</link>
    <description>The XEmacs Package Smoketest</description>"""

    for date, rowinfo in rows:
        for (status, log, macros, buildarch) in rowinfo:
            if log == None:
                continue
            print >> RSS, "    <item>"
            print >> RSS, "      <title>" + date + ' ' + buildarch,
            if status:
                print >> RSS, "Success",
            else:
                print >> RSS, "FAILURE",
            print >> RSS, """</title>
      <link>http://labb.contactor.se/~matsl/smoketest/logs/</link>
    </item>"""
    print >> RSS, """  </channel>
</rss>
"""

# Get first build
logfiles = []
for l in os.listdir('build/logs'):
    if re.match("^.*21.4-mule\.log\.tail$", l):
        logfiles.append(l)
logfiles.sort()
logfiles.reverse()

# Generate pages ...
print >> IP, """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">

<html>
  <head>
    <link rel="STYLESHEET" type="text/css" href="style.css">
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <meta name="author" content="Mats Lidell">
    <title>XEmacs Packages Smoketest</title>
    <link rel="alternate" type="application/rss+xml" 
          href="feed.rss" title="RSS feed for My Page">
  </head>
  <body>
    <p>
      <a href="http://www.xemacs.org"> <img src="xemacs-smoke.jpg" alt="XEmacs -- Fire and smoke"></a>
    </p>
    <h1>XEmacs Package Smoketest</h1>

    <!-- Produced by:  \$Id: showlogs.py,v 1.1 2006/12/18 22:39:28 matsl Exp $ -->
"""
    
# Call python function for doing this.
os.system("./report-urls")

# Generate table one row at a time ...
rows=[]
for l in logfiles:
    rows.append(getRowInfo("build/logs", l))
for r in rows:
    log2html(r)
    
print >> IP, """</table>
<p><a href=build-logs>Build history</a></p>
"""

# Add on news ...
for l in open("news").readlines():
    print >> IP, l,

print >> IP, "<p>Updated: " + time.asctime() + "</p>"
print >> IP, "</body>\n</html>"

generateRSS(rows[:2], open('build/logs/feed.rss', 'w'))



1.1                  XEmacs/xemacs-builds/matsl/package_smoketest/xemacs-smoketest.py

Index: xemacs-smoketest.py
===================================================================
#!/usr/bin/env python  
# -*- coding: iso-8859-1 -*-

## packages-smoketest.sh -- Script for smoketesting XEmacs package builds.

## $Id: xemacs-smoketest.py,v 1.1 2006/12/18 22:39:29 matsl Exp $

## This file is part of XEmacs

## XEmacs is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.

## XEmacs is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA

import sys, os
from time import gmtime, strftime

WORKROOT=os.getcwd()
DATE = strftime("%Y-%m-%d-%H:%M", gmtime())

# Directories
BUILD_DIR=os.path.expandvars('$HOME/work/smoketest/build')
LOG_DIR=os.path.join(BUILD_DIR, 'logs')

# Programs
MAKE='make'

# Need some X-programs in PATH
os.environ['PATH'] += ':/usr/bin/X11'

# The XEmacs executables with which the smoketests are run.
BINARIES = { 
	'21.4-mule' : { 'mule' : 1, 'bin' : 'bin/xemacs-21.4.19' },
	'21.4-nomule' : { 'mule' : 0, 'bin' : 'nomule/bin/xemacs-21.4.19' },
	'21.5-mule' : { 'mule' : 1, 'bin' : 'bin/xemacs-21.5-b27' },

# disabled
#	'21.5-nomule' : { 'mule' : 0, 'bin' : 'nomule/bin/xemacs-21.5-b27' },

    }
		
TOPLEVEL_TARGETS = 'autoloads all install'
# TOPLEVEL_TARGETS = 'autoloads'

class log:
    def __init__(self, name):
        self.n = name
    def run(self, cmd):
        return os.system(cmd + ' >> ' + self.n + ' 2>&1')
    def append(self, str):
        f = open(self.n, 'a')
        print >> f, str
        f.close()
    def name(self):
        return self.n
        
def printProgramVersions(log, xemacs):
    log.run(xemacs + ' -vanilla -version')
    log.run('uname -a')
    log.run('makeinfo --version | head -1')
    log.run('tex --version | head -1')
    log.run('dvips --version | head -1')
    log.run('msgfmt --version | head -1')

def build(program, targets):
    xemacs=os.path.join(WORKROOT, BINARIES[program]['bin'])
    mule=BINARIES[program]['mule']

    # return 0                            # While debugging other stuff ..

    # BUILD_WITHOUT_MULE flag
    if mule:
        buildWithoutMule = ''
    else:
        buildWithoutMule = 't'

    ## This flag isn't used in the builds yet!?
    is21_5 = 'NO'    
##     # XEMACS_21_5 flag
##     if 1:
##         is21_5 = 'YES'
##     else:
##         is21_5 = 'NO'

    l = log('%s/%s_buildAll_%s.log' % (LOG_DIR, DATE, program))
    runString = '%s XEMACS_BINARY=%s XEMACS_21_5=%s BUILD_WITHOUT_MULE=%s ' % (MAKE, xemacs, is21_5, buildWithoutMule)
#    runString = '%s XEMACS_BINARY=%s XEMACS_21_5=%s BUILD_WITHOUT_MULE=%s ' % ('echo', xemacs, is21_5, buildWithoutMule) 

    # Cleaning up before running
    print '    Cleaning up ...'
    os.system(runString + 'extraclean >/dev/null 2>&1');

    # Main log
    l.append('------ Packages build smoketest -- all from top level')
    printProgramVersions(l, xemacs)
    l.append('------ make ' + targets)
    # l.append('------ About to execute: ' + runString)
    result = l.run(runString + targets)
    l.append('------ End of build -- all from top level')
    l.append('Status = ' + str(result))

    # Tail log
    os.system('tail -256 ' + l.name()  + ' > ' + l.name() + '.tail')

    # Check macros log
    os.system('find . -type f -name \*.el | xargs awk -f gen-macro-list.awk > macro.list')
    os.system('awk -f find-macro-err.awk < ' + l.name() + ' > ' + os.path.join(LOG_DIR, DATE + '_macro_err_' + program + '.txt'))

    if result == 0:
        print 'Looks good'
    else:
        print 'Problems. See', l.name(), 'for details'
        
    # Save sumo-package
    # os.system('cd ..; tar -zcf logs/xemacs-sumo-${DATE}-$N.tgz xemacs-packages mule-packages')
    
    # Remove installed packages
    os.system('rm -rf ../xemacs-packages ../mule-packages')

    return result

def mail(subject, filename, recepient):
    result = os.system('metasend -b -s "' + subject + '" -F "The XEmacs Package Smoketest <matsl at xemacs.org>" -f ' + filename +  ' -m "text/plain;charset=iso-8859-1" -e quoted-printable -t ' + recepient)

    print "Send mail with subject '%s', contents in filename '%s' to '%s'" % (subject, filename, recepient)

##     o = open(filename)
##     for line in o.readlines():
##         print line[:-1]
##     o.close()
##     return 1

    return result

# The list of where to send it ...
recipients = ['matsl at contactor.se', 'xemacs-buildreports at xemacs.org']

def mailReport(b):
    """Report about the build through a mail"""

    success = 0
    for e,r in b:
        if r <> 0:
            success = 1
            break;

    tmpmail = 'mailresult.temp'
    f = open(tmpmail, "w")
    sub = ''
    if success == 0:
        sub = '[Success] '
    else:
        sub = '[Failure] '
    sub += 'The Package Smoketest'

    f.write("""These are the results from the XEmacs Package Smoketest:

"""
)
    for e,r in b:
        f.write(' '*5 + e.ljust(15) + '-- ')
        if r:
            f.write('errors')
        else:
            f.write('ok')
        f.write('\n')
    f.write("""
     Remember that the 21.5 nomule build is disabled at the moment.
     
For details check "http://labb.contactor.se/~matsl/smoketest/logs"
-- 
This is generated by the XEmacs Package Smoketest.
"""
)
    f.close()

    for p in recipients:
        result = mail(sub, tmpmail, p)
        if result != 0:
            print "Couldn't send mail. os.system return code = " + `result`
        else:
            print sys.argv[0] + ": Mail sent to " + p

def main():
    print 'XEmacs packages smoketest started ('+ DATE + ').'
    os.chdir(BUILD_DIR + '/packages')

    builds = []
    for e in BINARIES:
        print 'Running smoketest for executable:', e
        result = build(e, TOPLEVEL_TARGETS)
        builds.append((e, result))
    
    mailReport(builds)
    
main()





More information about the XEmacs-CVS mailing list