[SCM] debian-live/autotesting branch, master, updated. 6e24925459f8e3da98d43d5a4683f4e963ac99e8
Brendan M. Sleight (none)
bms at brum.
Sun Mar 28 12:32:54 UTC 2010
The following commit has been merged in the master branch:
commit 6e24925459f8e3da98d43d5a4683f4e963ac99e8
Author: Brendan M. Sleight <bms at brum.(none)>
Date: Sun Mar 28 13:31:33 2010 +0100
Add more tests
diff --git a/Makefile b/Makefile
index 7841d91..915e387 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+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
+
all: install
install: autotesting
@@ -10,9 +12,11 @@ autotesting:
cp ./README $(DESTDIR)/usr/share/autotesting/README
mkdir -p $(DESTDIR)/usr/share/autotesting/tests
cp -r ./tests/* $(DESTDIR)/usr/share/autotesting/tests/
- xmlstarlet tr ./tests-source/transform-to-test-list.xml ./tests-source/debian-live-all.xml >$(DESTDIR)/usr/share/autotesting/tests/debian-live-all.xml
- xmlstarlet tr ./tests-source/transform-to-test-list.xml ./tests-source/debian-live-i386-iso.xml >$(DESTDIR)/usr/share/autotesting/tests/debian-live-i386-iso.xml
- xmlstarlet tr ./tests-source/transform-to-test-list.xml ./tests-source/debian-live-i386-iso-xfce.xml >$(DESTDIR)/usr/share/autotesting/tests/debian-live-i386-iso-xfce.xml
+ # 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" ; \
+ done
+
clean:
remove:
diff --git a/README b/README
index b42d210..d4e799e 100644
--- a/README
+++ b/README
@@ -11,7 +11,9 @@ EXAMPLE TESTS.XML
<autotesting>
<tests>
<test>
- <download>http://127.0.0.1/autotesting/debian-live-501-i386-xfce-desktop.iso</download>
+ <download>
+ <url>http://127.0.0.1/autotesting/debian-live-501-i386-xfce-desktop.iso</url>
+ </download>
<title>Debian Live (xfce)</title>
<description>Debian Live. Daily build of squeeze xfce iso.</description>
<background>http://git.debian.org/?p=debian-live/homepage.git;a=blob_plain;f=images/debian-live.png</background>
@@ -90,10 +92,4 @@ The output video file stored in the output directories (see <root> and <local>).
The output file names stored in the output directories (see <root> and <local>) of a final screenshot of qemu and a montage of frames from the video. These can give a good idea of how successful the test was rather than viewing the whole video.
-REQUIRED APPLICATIONS
-=====================
-
-I will be trying to package autotesting - however for reference this following applications are required:-
-
-python, python-amara, wget, Xvfb, xloadimage, qemu, recordmydesktop, ffmpeg, imagemagick, gmessage
-
+Some example test may be found in /usr/share/autotesting/tests/
diff --git a/README.setup b/README.setup
index 869163c..2f3e442 100644
--- a/README.setup
+++ b/README.setup
@@ -20,7 +20,7 @@ I selected, en_GB ISO-8859-1, en_GB.ISO-8859-15 ISO-8859-15, en_GB.UTF-8 UTF-8 a
Install Dependencies
====================
Commands:-
- apt-get install python python-amara wget xvfb xloadimage qemu recordmydesktop ffmpeg imagemagick gmessage
+ apt-get install python python-amara wget xvfb xloadimage qemu recordmydesktop ffmpeg imagemagick gmessage openbios-ppc
Locally Build Autotesting.deb
diff --git a/autotesting.py b/autotesting.py
index c9bc8f7..b7070d2 100644
--- a/autotesting.py
+++ b/autotesting.py
@@ -32,7 +32,7 @@ def log(message):
print "[" + str(now) + "] " + str(message)
sys.stdout.flush()
-def cronCheak(frequency):
+def cronCheak(frequency, debug):
"""Check if the frequency (e.g. daily, weekly, mounthly is due to
be run at this time
returns boolean.
@@ -45,7 +45,10 @@ def cronCheak(frequency):
return True
elif frequency == "Monthly" or frequency == "monthly":
if now.day == 1:
- return True
+ return True
+ elif debug == True:
+ log("*** Debug mode - run regardless of frequency ***")
+ return True
return False
def dateBasedOnFrequency(frequency, keep):
@@ -66,21 +69,24 @@ def parseTest(xml):
tests = amara.parse(xml)
return tests.autotesting.tests
-def wget(url):
+def wget(url, limit):
""" Use wget to download a file
return fileObject"""
+ # --limit-rate=4M
log("Downloading " + url)
tmpFile = tempfile.NamedTemporaryFile(prefix="autotesting_wget_")
L = ['wget', '-nv', str(url), '-O', tmpFile.name]
+ if limit == True:
+ L.append('--limit-rate=2M')
# Maybe do something with the retcode in the future.
retcode = subprocess.call(L)
return tmpFile
-def getDownloads(download, backgroundURL):
+def getDownloads(download, backgroundURL, limit):
""" Create two temp files and download the main download and
the background
return tempfile, tempfile"""
- background = wget(str(backgroundURL))
+ background = wget(str(backgroundURL), limit)
try:
# datetime.timedelta(days=55)
daysOfset = int(str(download.daysofset))
@@ -88,9 +94,35 @@ def getDownloads(download, backgroundURL):
downloadURL=str(download.url) + dateUrlPart.strftime(str(download.dateformat)) + str(download.dateformatend)
except:
downloadURL=str(download.url)
- download = wget(str(downloadURL))
+ download = wget(str(downloadURL), limit)
return download, downloadURL, background
+def testCheckSum(download, downloadURL, md5sum):
+ """ Check md5sum locally against remote list of md5sum stored.
+ """
+ mdFile = wget(str(md5sum), False)
+ data = [line.split() for line in open(mdFile.name,'r')]
+ downloadFilename = downloadURL.split('/')[-1]
+ required = False
+ for line in data:
+ if line[1] == downloadFilename:
+ log("MDSUM required: " + str(line))
+ required = line
+ if required:
+ p = subprocess.Popen("md5sum " + download.name, shell = True, stdout=subprocess.PIPE)
+ localMD = p.stdout.readline().split()
+ p.wait()
+ log("MDSUM required: " + str(localMD))
+ if localMD[0] == required[0]:
+ log("MDSUM matched")
+ return True
+ else:
+ log("MDSUM not matched")
+ return False
+ else:
+ log("MDSUM not found for filename")
+ return False
+
def authorityFile():
""" Return a file containing "localhost"
"""
@@ -143,9 +175,9 @@ def openingTitles(display, test, downloadURL):
log("Showing Opening Titles")
time.sleep(2)
xmessage(display, str(test.title), "Autotesting of: " + str(test.title), "3", "monospace 14")
- xmessage(display, str(test.title), str(test.description), "3", "monospace 6")
xmessage(display, str(test.title), "Created at " + str(datetime.datetime.now()), "2", "monospace 10")
- xmessage(display, str(test.title), "Downloaded using this url: " + str(downloadURL), "2", "monospace 10")
+ xmessage(display, str(test.title), str(test.description), "3", "monospace 6")
+ xmessage(display, str(test.title), "Downloaded using this url: " + str(downloadURL), "2", "monospace 6")
def runningQemu(display, test, qemuDownload):
""" Start qemu running, with a local telnet port at 55555 listening acting as the qemu monitor
@@ -268,6 +300,10 @@ def main():
parser = OptionParser(usage, version="%prog ")
parser.add_option("-t", "--tests", dest="tests",
help="complete the autotesting definined in the xml template")
+ parser.add_option("-d", "--debug", action="store_true", dest="debug",
+ 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")
(options, args) = parser.parse_args()
if not options.tests :
parser.error("Must pass a list of tests to complete.")
@@ -276,26 +312,35 @@ def main():
display = displayNumber()
tests = parseTest(options.tests)
for test in tests.test:
- if cronCheak(str(test.frequency)):
+ if cronCheak(str(test.frequency), options.debug):
log("Starting Autotesting of: " + str(test.title))
- (download, downloadURL, background) = getDownloads(test.download, str(test.background))
- xvfb = startXvfb(display, str(test.qemu.xscreen), background.name)
- (recordMyDesktop, video) = startRecordMyDesktop(display)
- openingTitles(display, test, downloadURL)
+ (download, downloadURL, background) = getDownloads(test.download, str(test.background), options.limit)
try:
- qemu = runningQemu(display, test, download.name)
- finalImage = captureScreenshot(display)
- kill(qemu, "Killing qemu")
+ md5sum = str(test.download.md5sum)
+ checkSum = testCheckSum(download, downloadURL, md5sum)
except:
- xmessage(display, str(test.title), "Qemu failed to run correctly!", "5", "monospace 14")
- finalImage = captureScreenshot(display)
- log("Qemu failed")
- kill(recordMyDesktop, "Killing recordmysdesktop")
- waitUntilEncodingFinished(recordMyDesktop)
- kill(xvfb, "Killing Xvfb")
- # Put video, montage in right place remvoe old versions etc.
- montage = createMontage(video, test)
- fileOutputs(test, video, finalImage, montage)
+ log("No md5sum found - assuming file downloaded ok")
+ checkSum = True
+ if checkSum == True:
+ xvfb = startXvfb(display, str(test.qemu.xscreen), background.name)
+ (recordMyDesktop, video) = startRecordMyDesktop(display)
+ openingTitles(display, test, downloadURL)
+ try:
+ qemu = runningQemu(display, test, download.name)
+ finalImage = captureScreenshot(display)
+ kill(qemu, "Killing qemu")
+ except:
+ xmessage(display, str(test.title), "Qemu failed to run correctly!", "5", "monospace 14")
+ finalImage = captureScreenshot(display)
+ log("Qemu failed")
+ kill(recordMyDesktop, "Killing recordmysdesktop")
+ waitUntilEncodingFinished(recordMyDesktop)
+ kill(xvfb, "Killing Xvfb")
+ # Put video, montage in right place remvoe old versions etc.
+ montage = createMontage(video, test)
+ fileOutputs(test, video, finalImage, montage)
+ else:
+ log("Checksum (md5sum) failed - test skipped")
log("Finished Autotesting of: " + str(test.title))
log("*****************************")
else:
diff --git a/tests-source/transform-to-test-list.xml b/tests-source/transform-to-test-list.xml
index b7e0b75..e856a7f 100644
--- a/tests-source/transform-to-test-list.xml
+++ b/tests-source/transform-to-test-list.xml
@@ -9,12 +9,19 @@
<xsl:variable name="binary" select="binary"/>
<xsl:for-each select="/autotesting/source/tests/images/image">
<xsl:variable name="image_name" select="name"/>
+ <xsl:variable name="image_nametwo" select="nametwo"/>
<xsl:variable name="extension" select="extension"/>
<xsl:variable name="options" select="qemu_options"/>
<xsl:for-each select="/autotesting/source/tests/packages/package">
<xsl:variable name="package" select="."/>
<test>
- <download><url><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"/></url></download>
+ <download>
+ <url><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"/></url>
+ <xsl:variable name="md" select="//autotesting/source/md5sum"/>
+ <xsl:if test="string-length($md) > 0" >
+ <md5sum><xsl:value-of select="//autotesting/source/root_url" /><xsl:value-of select="$processor_name"/>/<xsl:value-of select="$image_name"/>/<xsl:value-of select="$md" /></md5sum>
+ </xsl:if>
+ </download>
<xsl:copy-of select="//autotesting/source/title" />
<description><xsl:value-of select="//autotesting/source/description" />
<xsl:value-of select="$processor_name"/>,  <xsl:value-of select="$image_name"/>,  <xsl:value-of select="."/>
@@ -34,7 +41,7 @@
<xsl:copy-of select="//autotesting/source/output/keep" />
<xsl:copy-of select="//autotesting/source/output/root" />
<xsl:copy-of select="//autotesting/source/output/video" />
- <local><xsl:value-of select="//autotesting/source/output/local"/>/<xsl:value-of select="$processor_name"/>/<xsl:value-of select="$image_name"/>/<xsl:value-of select="$package"/>/</local>
+ <local><xsl:value-of select="//autotesting/source/output/local"/>/<xsl:value-of select="$processor_name"/>/<xsl:value-of select="$image_name"/>/<xsl:value-of select="$image_nametwo"/>/<xsl:value-of select="$package"/>/</local>
<xsl:copy-of select="//autotesting/source/output/screenshots" />
</output>
</test>
--
debian-live/autotesting
More information about the debian-live-changes
mailing list