~pwlars/ubuntu-test-cases/krillin-recovery

« back to all changes in this revision

Viewing changes to scripts/combine_results

  • Committer: Andy Doan
  • Date: 2013-10-21 02:19:35 UTC
  • mto: This revision was merged to the branch mainline in revision 75.
  • Revision ID: andy.doan@canonical.com-20131021021935-9v30ul1w0ff7yy30
fix bugs found in run-autopilot.sh

1: When unlock screen failed the whole script was ended. This makes sure
we just fail that single app test and continue trying other apps.

2: The reboot_wait logic isn't resiliant enough. Before we had "mega"
jobs (ie jenkins.sh) it was okay if a test occassionally failed to
get active networking. However, in this new script that failure can
cause all the remaining tests to not get run. The idea is to create
a reboot-and-wait script that will retry 3 times before giving up.

3: Update the system settle "classname" for junit. The issue I'm
seeing is that the junit results viewer in jenkins isn't correlating
the settle failures with the testsuite it happened in. This makes sure
the 2 are tied together.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
from xml.etree import ElementTree
14
14
 
15
15
 
16
 
def _build_node(name, rcfile, stdout):
 
16
def _build_node(classname, name, rcfile, stdout):
17
17
    e = ElementTree.Element('testcase')
18
 
    e.attrib['classname'] = 'systemsettle'
19
 
    e.attrib['name'] = name
 
18
    e.attrib['classname'] = classname
 
19
    e.attrib['name'] = 'settle_%s' % name
20
20
    rc = int(open(rcfile).read())
21
21
    if rc != 0:
22
22
        f = ElementTree.Element('failure')
49
49
    return tree
50
50
 
51
51
 
 
52
def _get_classname(results):
 
53
    return results[0].attrib.get('classname', '???').split('.')[0]
 
54
 
 
55
 
52
56
def combine(resdir):
53
57
    ap_file = os.path.join(resdir, 'test_results.xml')
54
58
    tree = _get_results(ap_file)
56
60
 
57
61
    errors = int(ap_results.attrib['errors'])
58
62
 
 
63
    classname = _get_classname(ap_results)
 
64
 
59
65
    rc = os.path.join(resdir, 'settle_before.rc')
60
66
    log = os.path.join(resdir, 'settle_before.log')
61
 
    node, failed = _build_node('before', rc, log)
 
67
    node, failed = _build_node(classname, 'before', rc, log)
62
68
    ap_results.insert(0, node)
63
69
    if failed:
64
70
        errors += 1
65
71
 
66
72
    rc = os.path.join(resdir, 'settle_after.rc')
67
73
    log = os.path.join(resdir, 'settle_after.log')
68
 
    node, failed = _build_node('after', rc, log)
 
74
    node, failed = _build_node(classname, 'after', rc, log)
69
75
    ap_results.append(node)
70
76
    if failed:
71
77
        errors += 1