From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Larson Subject: [PATCH][XM-TEST] Repost - Allow reporting results to a different results repository Date: Thu, 16 Mar 2006 11:45:02 -0600 Message-ID: <200603161145.05937.pl@us.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1118734460==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org --===============1118734460== Content-Type: multipart/signed; boundary="nextPart1377931.XBC4BvFHPX"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart1377931.XBC4BvFHPX Content-Type: multipart/mixed; boundary="Boundary-01=_eQaGEjCyOk8Omus" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_eQaGEjCyOk8Omus Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Add an option to xmtest to report results to an alternative results=20 repository. The default is preserved but can be overridden by either passi= ng=20 it with -r to runtest.sh or by setting the xmtest_repo environment variable. Signed-off-by: Paul Larson --Boundary-01=_eQaGEjCyOk8Omus Content-Type: text/x-diff; charset="us-ascii"; name="alt-xmtest-repo.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="alt-xmtest-repo.patch" # HG changeset patch # User pl@us.ibm.com # Node ID 9abed75ccaf94ad84cb2e968b941e61e1efe3661 # Parent c445d4a0dd76b4859d058368ffab7c65f732acab Add an option to xmtest to report results to an alternative results reposit= ory. The default is preserved but can be overridden by either passing it with -r= to runtest.sh or by setting the xmtest_repo environment variable. Signed-off-by: Paul Larson diff -r c445d4a0dd76 -r 9abed75ccaf9 tools/xm-test/lib/XmTestReport/Report.= py =2D-- a/tools/xm-test/lib/XmTestReport/Report.py Tue Mar 14 18:33:45 2006 +++ b/tools/xm-test/lib/XmTestReport/Report.py Tue Mar 14 20:51:08 2006 @@ -32,11 +32,7 @@ import httplib import urllib import re =2D =2D#REPORT_HOST =3D "xmtest-dev.dague.org" =2DREPORT_HOST =3D "xmtest.dague.org" =2DREPORT_URL =3D "/cgi-bin/report-results"; =2DVIEW_URL =3D "cgi-bin/display?view=3Dsingle&testid=3D" +from urlparse import urlparse =20 class XmTestReport: =20 @@ -88,8 +84,11 @@ =20 return 'multipart/form-data; boundary=3D%s' % boundary, textBody =20 =2Ddef postResults(results): =2D conn =3D httplib.HTTPConnection(REPORT_HOST) +def postResults(report_server, results): + if not re.match('http://', report_server): + report_server =3D 'http://'+report_server + (report_host,report_url) =3D urlparse(report_server)[1:3] + conn =3D httplib.HTTPConnection(report_host) =20 type, body =3D encodeForm({"log" : results}) =20 @@ -100,22 +99,17 @@ # print "%s\n" % type # print headers =20 =2D conn.request("POST", REPORT_URL, body, headers) + conn.request("POST", report_url, body, headers) =20 resp =3D conn.getresponse() data =3D resp.read() =20 if resp.status =3D=3D 200: print >>sys.stderr, "Your results have been submitted successfully= !" =2D match =3D re.match("^id=3D([0-9]+)$", data.split("\n")[1]) =2D if match: =2D id =3D match.group(1) =2D print >>sys.stderr, "See your report at:" =2D print >>sys.stderr, "http://%s/%s%s" % (REPORT_HOST, VIEW_UR= L, id) else: print >>sys.stderr, "Unable to submit results:" =2D print >>sys.stderr, "[http://%s%s] said %i: %s" % (REPORT_HOST, =2D REPORT_URL, + print >>sys.stderr, "[http://%s%s] said %i: %s" % (report_host, + report_url, resp.status, resp.reason) print >>sys.stderr, data @@ -133,7 +127,9 @@ dump =3D False files =3D [] =20 =2D for a in sys.argv[1:]: + report_server =3D sys.argv[1] + + for a in sys.argv[2:]: if a =3D=3D "-d": submit =3D False dump =3D True @@ -156,5 +152,5 @@ print xmlout =20 if submit: =2D postResults(xmlout) + postResults(report_server, xmlout) =20 diff -r c445d4a0dd76 -r 9abed75ccaf9 tools/xm-test/runtest.sh =2D-- a/tools/xm-test/runtest.sh Tue Mar 14 18:33:45 2006 +++ b/tools/xm-test/runtest.sh Tue Mar 14 20:51:08 2006 @@ -13,6 +13,7 @@ echo " -b : do not ask any questions (batch mode)" echo " -g : run a group test set" echo " -e : set email address for report" + echo " -r : url of test results repository to use" echo " -s : just submit report " echo " -h | --help : show this help" } @@ -22,7 +23,7 @@ =20 reportfile=3D$1 =20 =2D ./lib/XmTestReport/Report.py $reportfile + ./lib/XmTestReport/Report.py $reportserver $reportfile } =20 # Generate XML result report from output file @@ -189,6 +190,7 @@ # Defaults MAXFAIL=3D10 report=3Dyes +reportserver=3D${xmtest_repo:-'http://xmtest.dague.org/cgi-bin/report-resu= lts'} batch=3Dno run=3Dyes GROUPENTERED=3Ddefault @@ -217,6 +219,10 @@ echo "No file for group $GROUPENTERED" exit 1 fi + ;; + -r) + shift + reportserver=3D$1 ;; -s) run=3Dno --Boundary-01=_eQaGEjCyOk8Omus-- --nextPart1377931.XBC4BvFHPX Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBEGaQhBwrpIrndMlIRApCDAJ9I/Yf4aMumKNtWZJRsgtJgCXviTQCfYFrK wYsblybYNv2uq1IMW1U9wK4= =AQRG -----END PGP SIGNATURE----- --nextPart1377931.XBC4BvFHPX-- --===============1118734460== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1118734460==--