ia64/xen-unstable

changeset 9350:b78cab886a1e

Add an option to xmtest to report results to an alternative results repository.
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 <pl@us.ibm.com>
author pl@us.ibm.com
date Tue Mar 21 01:19:24 2006 +0100 (2006-03-21)
parents d218dd060612
children e36f95b43bf1
files tools/xm-test/lib/XmTestReport/Report.py tools/xm-test/runtest.sh
line diff
     1.1 --- a/tools/xm-test/lib/XmTestReport/Report.py	Tue Mar 21 01:13:14 2006 +0100
     1.2 +++ b/tools/xm-test/lib/XmTestReport/Report.py	Tue Mar 21 01:19:24 2006 +0100
     1.3 @@ -32,11 +32,7 @@ import xml.dom.minidom
     1.4  import httplib
     1.5  import urllib
     1.6  import re
     1.7 -
     1.8 -#REPORT_HOST = "xmtest-dev.dague.org"
     1.9 -REPORT_HOST = "xmtest.dague.org"
    1.10 -REPORT_URL  = "/cgi-bin/report-results";
    1.11 -VIEW_URL = "cgi-bin/display?view=single&testid="
    1.12 +from urlparse import urlparse
    1.13  
    1.14  class XmTestReport:
    1.15  
    1.16 @@ -88,8 +84,11 @@ def encodeForm(fieldList):
    1.17  
    1.18      return 'multipart/form-data; boundary=%s' % boundary, textBody
    1.19  
    1.20 -def postResults(results):
    1.21 -    conn = httplib.HTTPConnection(REPORT_HOST)
    1.22 +def postResults(report_server, results):
    1.23 +    if not re.match('http://', report_server):
    1.24 +	report_server = 'http://'+report_server
    1.25 +    (report_host,report_url) = urlparse(report_server)[1:3]
    1.26 +    conn = httplib.HTTPConnection(report_host)
    1.27  
    1.28      type, body = encodeForm({"log" : results})
    1.29  
    1.30 @@ -100,22 +99,17 @@ def postResults(results):
    1.31      # print "%s\n" % type
    1.32      # print headers
    1.33      
    1.34 -    conn.request("POST", REPORT_URL, body, headers)
    1.35 +    conn.request("POST", report_url, body, headers)
    1.36      
    1.37      resp = conn.getresponse()
    1.38      data = resp.read()
    1.39  
    1.40      if resp.status == 200:
    1.41          print >>sys.stderr, "Your results have been submitted successfully!"
    1.42 -        match = re.match("^id=([0-9]+)$", data.split("\n")[1])
    1.43 -        if match:
    1.44 -            id = match.group(1)
    1.45 -            print >>sys.stderr, "See your report at:"
    1.46 -            print >>sys.stderr, "http://%s/%s%s" % (REPORT_HOST, VIEW_URL, id)
    1.47      else:
    1.48          print >>sys.stderr, "Unable to submit results:"
    1.49 -        print >>sys.stderr, "[http://%s%s] said %i: %s" % (REPORT_HOST,
    1.50 -                                                           REPORT_URL,
    1.51 +        print >>sys.stderr, "[http://%s%s] said %i: %s" % (report_host,
    1.52 +                                                           report_url,
    1.53                                                             resp.status,
    1.54                                                             resp.reason)
    1.55          print >>sys.stderr, data
    1.56 @@ -133,7 +127,9 @@ if __name__ == "__main__":
    1.57      dump = False
    1.58      files = []
    1.59  
    1.60 -    for a in sys.argv[1:]:
    1.61 +    report_server = sys.argv[1]
    1.62 +
    1.63 +    for a in sys.argv[2:]:
    1.64          if a == "-d":
    1.65              submit = False
    1.66              dump = True
    1.67 @@ -156,5 +152,5 @@ if __name__ == "__main__":
    1.68          print xmlout
    1.69  
    1.70      if submit:
    1.71 -        postResults(xmlout)
    1.72 +        postResults(report_server, xmlout)
    1.73      
     2.1 --- a/tools/xm-test/runtest.sh	Tue Mar 21 01:13:14 2006 +0100
     2.2 +++ b/tools/xm-test/runtest.sh	Tue Mar 21 01:19:24 2006 +0100
     2.3 @@ -13,6 +13,7 @@ usage() {
     2.4      echo "  -b          : do not ask any questions (batch mode)"
     2.5      echo "  -g          : run a group test set"
     2.6      echo "  -e <email>  : set email address for report"
     2.7 +    echo "  -r <url>    : url of test results repository to use"
     2.8      echo "  -s <report> : just submit report <report>"
     2.9      echo "  -h | --help : show this help"
    2.10  }
    2.11 @@ -22,7 +23,7 @@ submit_report() {
    2.12  
    2.13      reportfile=$1
    2.14  
    2.15 -    ./lib/XmTestReport/Report.py $reportfile
    2.16 +    ./lib/XmTestReport/Report.py $reportserver $reportfile
    2.17  }
    2.18  
    2.19  # Generate XML result report from output file
    2.20 @@ -189,6 +190,7 @@ EOF
    2.21  # Defaults
    2.22  MAXFAIL=10
    2.23  report=yes
    2.24 +reportserver=${xmtest_repo:-'http://xmtest.dague.org/cgi-bin/report-results'}
    2.25  batch=no
    2.26  run=yes
    2.27  GROUPENTERED=default
    2.28 @@ -218,6 +220,10 @@ while [ $# -gt 0 ]
    2.29               exit 1
    2.30            fi
    2.31  	  ;;
    2.32 +      -r)
    2.33 +	  shift
    2.34 +	  reportserver=$1
    2.35 +	  ;;
    2.36        -s)
    2.37  	  run=no
    2.38  	  ;;