[SCM] debian-live/autotesting branch, master, updated. 29094b39229a0695364d4f5159bbbbf4a1481890

Brendan M. Sleight (none) bms at brum.
Thu May 13 19:37:44 UTC 2010


The following commit has been merged in the master branch:
commit 29094b39229a0695364d4f5159bbbbf4a1481890
Author: Brendan M. Sleight <bms at brum.(none)>
Date:   Thu May 13 20:38:44 2010 +0100

    re-vamping the list of tests. Adding tweet option

diff --git a/Makefile b/Makefile
index 915e387..404b62c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-LIST = debian-live-all.xml debian-live-i386-iso.xml debian-live-i386-iso-xfce.xml debian-live-60alpha1-i386-iso-xfce.xml debian-live-60alpha1-all.xml debian-live-60alpha1-ppc-hdd-standard.xml
+LIST = build-60alpha1-i386-iso-hybrid-xfce-daily.xml build-60alpha1-amd64-iso-hybrid-all-monthly.xml build-60alpha1-powerpc-iso-all-monthly.xml build-60alpha1-i386-iso-hybrid-all-monthly.xml 
 
 all: install
 
@@ -14,8 +14,13 @@ autotesting:
 	cp -r ./tests/* $(DESTDIR)/usr/share/autotesting/tests/
 	# Not an expert on Makefile - feel free to improve.
 	for template in $(LIST);do \
-	xmlstarlet tr ./tests-source/transform-to-test-list.xml ./tests-source/"$$template" | xmlstarlet fo -s 2 - >$(DESTDIR)/usr/share/autotesting/tests/"$$template" ; \
+	xmlstarlet tr ./tests-source/build-stage1.xml ./tests-source/"$$template" | xmlstarlet tr ./tests-source/transform-to-test-list.xml | xmlstarlet fo -s 2 -  >$(DESTDIR)/usr/share/autotesting/tests/"$$template" ; \
 	done
+	# Make a full list
+	cp ./tests-source/merge-list.xml ./tests-source/merge-tests.xml $(DESTDIR)/usr/share/autotesting/tests/
+	xmlstarlet tr $(DESTDIR)/usr/share/autotesting/tests/merge-tests.xml $(DESTDIR)/usr/share/autotesting/tests/merge-list.xml >$(DESTDIR)/usr/share/autotesting/tests/full.xml
+	rm $(DESTDIR)/usr/share/autotesting/tests/merge-tests.xml $(DESTDIR)/usr/share/autotesting/tests/merge-list.xml
+
 	
 clean:
 
diff --git a/autotesting.py b/autotesting.py
index b7070d2..e3d084f 100644
--- a/autotesting.py
+++ b/autotesting.py
@@ -19,7 +19,7 @@
 
 
 from optparse import OptionParser
-import amara, datetime, os, shutil, subprocess, sys, telnetlib, tempfile, time, datetime
+import amara, datetime, os, shutil, subprocess, sys, telnetlib, tempfile, time, datetime, urllib, twitter
 
 def displayNumber():
     """Really a global we can change later to something better.
@@ -37,6 +37,9 @@ def cronCheak(frequency, debug):
     be run at this time
     returns boolean.
     """
+    if debug == True:
+        log("*** Debug mode - run regardless of frequency ***")
+        return True
     now = datetime.datetime.now()
     if frequency == "Daily" or frequency == "daily":
         return True
@@ -46,9 +49,6 @@ def cronCheak(frequency, debug):
     elif frequency == "Monthly" or frequency == "monthly":
         if now.day == 1:
             return True
-    elif debug == True:
-        log("*** Debug mode - run regardless of frequency ***")
-        return True
     return False
 
 def dateBasedOnFrequency(frequency, keep):
@@ -69,6 +69,12 @@ def parseTest(xml):
     tests = amara.parse(xml)
     return tests.autotesting.tests
 
+def parseTwitter(xml):
+    """ Get the xml file and load as a object using amara
+    returns amaraObject"""
+    twit = amara.parse(xml)
+    return twit.autotesting.twitter
+
 def wget(url, limit):
     """ Use wget to download a file
     return fileObject"""
@@ -120,9 +126,18 @@ def testCheckSum(download, downloadURL, md5sum):
             log("MDSUM not matched")
             return False
     else:
+        # file maybe one line with non-mathcing filename (morphix.org - thanks Alex!)
+        p = subprocess.Popen("md5sum " + download.name, shell = True, stdout=subprocess.PIPE) 
+        localMD = p.stdout.readline().split()
+        p.wait()
+        for line in data:
+            if line[0] == localMD[0]:
+                log("MDSUM required: " + str(line))
+                log("MDSUM matched" + str(localMD))
+                return True
         log("MDSUM not found for filename")
         return False
-            
+        
 def authorityFile():
     """ Return a file containing "localhost"
     """
@@ -160,8 +175,12 @@ def kill(process, message):
 def startRecordMyDesktop(display):
     log("Starting Record My Desktop")
     video = tempfile.NamedTemporaryFile(prefix="autotesting_video_", suffix=".ogv")
+#    recordmydesktopCommand = ["recordmydesktop",  "--no-cursor", "-display", 
+#                               display ,"--no-sound", "--overwrite", "-o" ,video.name]
+# -v_bitrate
     recordmydesktopCommand = ["recordmydesktop",  "--no-cursor", "-display", 
-                               display ,"--no-sound", "--overwrite", "-o" ,video.name]
+                               display ,"--no-sound", "--overwrite", "-o" ,video.name,
+                               "-v_bitrate", "100000"]
     recordmydesktop = subprocess.Popen(recordmydesktopCommand)
     return recordmydesktop, video 
 
@@ -190,7 +209,11 @@ def runningQemu(display, test, qemuDownload):
     if not qemuBinary.startswith("qemu"):
         log("WARNING! : " + qemuBinary + " does not start with qemu, using qemu instead.")
         qemuBinary = "qemu"
-    qemuCommand = [qemuBinary, "-monitor", monitor, "-full-screen", str(test.qemu.options), str(qemuDownload)]
+    qemuCommand = [qemuBinary, "-monitor", monitor, "-full-screen"]    
+    for o in str(test.qemu.options).split(' '):
+        qemuCommand.append(o)
+    qemuCommand.append(str(qemuDownload))
+    log("Qemu command: " + str(qemuCommand))
     qemu = subprocess.Popen(qemuCommand, env={"DISPLAY": display})
     sendkeysToQemu(test, telnet)
     log("Running qemu for  " + str(test.qemu.time) + " seconds")
@@ -261,6 +284,11 @@ def storeFile(tmpFile, copyLocation, symLocation):
         pass
     os.symlink(copyLocation, symLocation)
 
+def tiny_url(url):
+    apiurl = "http://tinyurl.com/api-create.php?url="
+    tinyurl = urllib.urlopen(apiurl + url).read()
+    return tinyurl
+
 def fileOutputs(test, video, finalImage, montage):
     """ Move files to the correct place (as per XML tags)
     including symlinks to current.
@@ -280,6 +308,13 @@ def fileOutputs(test, video, finalImage, montage):
         os.makedirs(currentDir)
     except:
         pass
+    # Output the xml describing the test
+    singleTestFile = tempfile.NamedTemporaryFile(prefix="autotesting_test_", suffix=".xml")
+    f = open(singleTestFile.name,"w")
+    f.write(test.xml())
+    f.close()
+    storeFile(singleTestFile.name, mainDir + "test.xml", currentDir + "test.xml")
+
     storeFile(video.name, mainDir + str(test.output.video), 
                                    currentDir + str(test.output.video))    
     storeFile(finalImage.name, mainDir + str(test.output.screenshots.final), 
@@ -295,6 +330,16 @@ def fileOutputs(test, video, finalImage, montage):
             shutil.rmtree(fp)
             log("Removing - " + fp)
 
+def postTweet(test, twit):
+    local=str(test.output.local)
+    today=str(datetime.date.today())
+    long_url=str(twit.hosting.url) + "/" + local + "/" + today + "/"
+    tiny=tiny_url(long_url) 
+    tweet =  "Autotesting of: " + str(test.description)[:90] + "... " + str(tiny)
+    api = twitter.Api(username=str(twit.user), password=str(twit.passw) )
+    status = api.PostUpdate(tweet)
+    log("Tweet: " + tweet)
+
 def main():
     usage = "usage: %prog [options] --tests=TESTS.XML \n       %prog --help for all options"
     parser = OptionParser(usage, version="%prog ")
@@ -304,9 +349,15 @@ def main():
                       help="Debug, run all tests regardless of frquency of testing.")
     parser.add_option("-l", "--limit", action="store_true", dest="limit",
                       help="Limit download rates to 4M")
+    parser.add_option("-w", "--twitter", dest="twit",
+                      help="Tweet after each test is completed, accordig to the setting in xml template")
     (options, args) = parser.parse_args() 
     if not options.tests :
         parser.error("Must pass a list of tests to complete.")
+    if options.twit:
+        twit = parseTwitter(options.twit)
+    else:
+        twit = False
         
     # Main loop
     display = displayNumber()
@@ -339,13 +390,18 @@ def main():
                 # Put video, montage in right place remvoe old versions etc.
                 montage = createMontage(video, test)
                 fileOutputs(test, video, finalImage, montage)
+                if twit:
+                    try:
+                        postTweet(test, twit)
+                    except:
+                        log("Tweeting failed")
             else:
                 log("Checksum (md5sum) failed - test skipped")
             log("Finished Autotesting of: " + str(test.title))
-            log("*****************************")
+            log("**********************************")
         else:
             log("Skipping Autotesting of: " + str(test.title) + " as frequency " + str(test.frequency))
-            log("*****************************")
+            log("**********************************")
 
 if __name__ == "__main__":
     main()
diff --git a/tests-source/parts/common-squeeze-build.xml b/tests-source/parts/common-squeeze-build.xml
index f929aa9..4fe4e41 100644
--- a/tests-source/parts/common-squeeze-build.xml
+++ b/tests-source/parts/common-squeeze-build.xml
@@ -11,7 +11,7 @@
       <options>-cdrom</options>
       <pause>10</pause>
       <sendkeys>kp_enter</sendkeys>
-      <time>600</time>
+      <time>900</time>
     </qemu>
     <output>
       <keep>4</keep>
diff --git a/tests-source/parts/images-iso.xml b/tests-source/parts/images-iso.xml
index 1bc6a6b..28657aa 100644
--- a/tests-source/parts/images-iso.xml
+++ b/tests-source/parts/images-iso.xml
@@ -4,7 +4,7 @@
         <image>
           <name>iso</name>
           <extension>.iso</extension>
-          <qemu_options>-cdrom</qemu_options>
+          <qemu_options>-boot order=d -cdrom </qemu_options>
         </image>
       </images>
   </common>
diff --git a/tests-source/transform-to-test-list.xml b/tests-source/transform-to-test-list.xml
index e856a7f..3d13242 100644
--- a/tests-source/transform-to-test-list.xml
+++ b/tests-source/transform-to-test-list.xml
@@ -24,7 +24,7 @@
           </download>
           <xsl:copy-of select="//autotesting/source/title" />
           <description><xsl:value-of select="//autotesting/source/description" /> 
-          <xsl:value-of select="$processor_name"/>, &#160;<xsl:value-of select="$image_name"/>, &#160;<xsl:value-of select="."/>
+          <xsl:value-of select="$processor_name"/>, <xsl:value-of select="$image_name"/>, <xsl:value-of select="."/>
 (<xsl:value-of select="//autotesting/source/root_url" /><xsl:value-of select="$processor_name"/>/<xsl:value-of select="$image_name"/>/<xsl:value-of select="//autotesting/source/filename_start" />-<xsl:value-of select="$processor_name"/>-<xsl:value-of select="$package"/><xsl:value-of select="$extension"/>)
           </description>
           <xsl:copy-of select="//autotesting/source/background" />
diff --git a/tests/morphix-lightgui.xml b/tests/morphix-lightgui.xml
index ef5f866..d241d57 100644
--- a/tests/morphix-lightgui.xml
+++ b/tests/morphix-lightgui.xml
@@ -1,27 +1,28 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
 <autotesting>
   <tests>
     <test>
-      <download>http://distro.ibiblio.org/pub/linux/distributions/morphix/autobuilds/iso/lightgui-basemod-2.6.23-2008-02-10_0018-latest.iso</download>
-      <title>Morphix LightGUI</title>
-      <description>Morphix. Daily build of LightGUI iso.</description>
+      <download>
+        <url>http://distro.ibiblio.org/pub/linux/distributions/morphix/autobuilds/base/basemod-2.6.26-latest.iso</url>
+        <md5sum>http://distro.ibiblio.org/pub/linux/distributions/morphix/autobuilds/base/basemod-2.6.26-latest.iso.md5</md5sum>
+      </download>
+      <title>Morphix Daily Base.iso</title>
+      <description>Morphix Daily autobuild of base.iso (http://distro.ibiblio.org/pub/linux/distributions/morphix/autobuilds/base/basemod-2.6.26-latest.iso)</description>
       <background>http://www.morphix.org/templates/MorphixORG/images/mambo_header.jpg</background>
       <frequency>daily</frequency>
       <qemu>
-        <xscreen>800x600x24</xscreen>
-        <binary>qemu</binary>
+        <xscreen>1024x768x24</xscreen>
+        <binary>qemu-system-i386</binary>
         <options>-cdrom</options>
-        <!-- Time to pause before sending keys presses -->
         <pause>10</pause>
-        <sendkeys>down,down,kp_enter</sendkeys>
-        <!-- Time to run qmeu -->
-        <time>600</time>
+        <sendkeys>kp_enter</sendkeys>
+        <time>400</time>
       </qemu>
       <output>
-        <!-- Number of test sets to keep -->
         <keep>4</keep>
-        <root>/home/bms/autotesting/tests/</root>
-        <local>morphix/lightGUI/</local>
+        <root>/var/www/autotesting/</root>
         <video>autotesting.ogv</video>
+        <local>morphix/basemod-2.6.26-latest/</local>
         <screenshots>
           <final>final-screenshot.png</final>
           <montage>montage-of-video-frames.png</montage>
diff --git a/tests/webconverger-daily.xml b/tests/webconverger-daily.xml
index 567f843..6f8cde1 100644
--- a/tests/webconverger-daily.xml
+++ b/tests/webconverger-daily.xml
@@ -9,9 +9,9 @@
         <dateformatend>.iso</dateformatend>
       </download>
       <title>Webconverger (6.0)</title>
-      <description>Webconverger (6.0)
+      <description>Community daily builds of Webconverger.
 Webconverger is a Live Web kiosk Linux distribution for public places. 
-These are community daily builds of Webconverger, building midnight European time the very latest developments.
+Building midnight European time the very latest developments.
 (http://build.webconverger.org/)
       </description>
       <background>http://webconverger.com/logos/flower600.png</background>

-- 
debian-live/autotesting



More information about the debian-live-changes mailing list