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

« back to all changes in this revision

Viewing changes to jenkins/apconfig.py

  • Committer: Andy Doan
  • Date: 2013-10-21 15:15:37 UTC
  • mfrom: (70.3.9 ptr)
  • Revision ID: andy.doan@canonical.com-20131021151537-blgx90slc3jlnamc
This change differentiates autopilot and UTAH written tests (when MEGA=1 is enabled). In the event of an autopilot test, we'll execute them with the new run-autopilot-tests.sh script (which will only deliver xUnit XML results).

This change includes job options to allow a user to selectively choose packages/ppas/tests to run. The gist of this change allows us to support the Lab Test Execution Service we've been planning.

Downsides: The qa-dashboard doesn't yet know how to parse xUnit XML, so for now this can only be used on our staging servers and not by our daily image testing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
# Ubuntu Testing Automation Harness
 
4
# Copyright 2013 Canonical Ltd.
 
5
 
 
6
# This program is free software: you can redistribute it and/or modify it
 
7
# under the terms of the GNU General Public License version 3, as published
 
8
# by the Free Software Foundation.
 
9
 
 
10
# This program is distributed in the hope that it will be useful, but
 
11
# WITHOUT ANY WARRANTY; without even the implied warranties of
 
12
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
13
# PURPOSE.  See the GNU General Public License for more details.
 
14
 
 
15
# You should have received a copy of the GNU General Public License along
 
16
# with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 
 
18
import argparse
 
19
import collections
 
20
 
 
21
TestSuite = collections.namedtuple('TestSuite', ['name', 'app', 'pkgs'])
 
22
 
 
23
 
 
24
def _ap_test(name, app=None, pkgs=None):
 
25
    if not app:
 
26
        # convert share-app-autopilot to share_app
 
27
        app = name.replace('-', '_').replace('_autopilot', '')
 
28
    return TestSuite(name, app, pkgs)
 
29
 
 
30
 
 
31
TESTSUITES = [
 
32
    _ap_test('friends-app-autopilot', pkgs=['friends-app-autopilot']),
 
33
    _ap_test('mediaplayer-app-autopilot', pkgs=['mediaplayer-app-autopilot']),
 
34
    _ap_test('gallery-app-autopilot', pkgs=['gallery-app-autopilot']),
 
35
    _ap_test('webbrowser-app-autopilot', pkgs=['webbrowser-app-autopilot']),
 
36
    _ap_test('unity8-autopilot', 'unity8'),
 
37
    _ap_test('notes-app-autopilot'),
 
38
    _ap_test('camera-app-autopilot', pkgs=['camera-app-autopilot']),
 
39
    _ap_test('dialer-app-autopilot', pkgs=['dialer-app-autopilot']),
 
40
    _ap_test('messaging-app-autopilot', pkgs=['messaging-app-autopilot']),
 
41
    _ap_test('address-book-app-autopilot',
 
42
             pkgs=['address-book-app-autopilot']),
 
43
    _ap_test('calendar-app-autopilot', pkgs=['python-dateutil']),
 
44
    _ap_test('music-app-autopilot', pkgs=['python-mock']),
 
45
    _ap_test('dropping-letters-app-autopilot'),
 
46
    _ap_test('ubuntu-calculator-app-autopilot'),
 
47
    _ap_test('ubuntu-clock-app-autopilot'),
 
48
    _ap_test('ubuntu-filemanager-app-autopilot'),
 
49
    _ap_test('ubuntu-rssreader-app-autopilot'),
 
50
    _ap_test('ubuntu-terminal-app-autopilot'),
 
51
    _ap_test('ubuntu-weather-app-autopilot'),
 
52
    _ap_test('ubuntu-ui-toolkit-autopilot', 'ubuntuuitoolkit',
 
53
             ['ubuntu-ui-toolkit-autopilot']),
 
54
    _ap_test('ubuntu-system-settings-online-accounts-autopilot',
 
55
             'online_accounts_ui',
 
56
             ['ubuntu-system-settings-online-accounts-autopilot']),
 
57
]
 
58
 
 
59
 
 
60
def _handle_packages(args):
 
61
    pkgs = []
 
62
    for suite in TESTSUITES:
 
63
        if not args.app or suite.app in args.app:
 
64
            if suite.pkgs:
 
65
                pkgs.extend(suite.pkgs)
 
66
    print(' '.join(pkgs))
 
67
    return 0
 
68
 
 
69
 
 
70
def _handle_apps(args):
 
71
    apps = [t.app for t in TESTSUITES]
 
72
    print(' '.join(apps))
 
73
 
 
74
 
 
75
def _handle_tests(args):
 
76
    tests = [t.name for t in TESTSUITES]
 
77
    print(' '.join(tests))
 
78
 
 
79
 
 
80
def _get_parser():
 
81
    parser = argparse.ArgumentParser(
 
82
        description='List information on configured autopilot tests for touch')
 
83
    sub = parser.add_subparsers(title='Commands', metavar='')
 
84
 
 
85
    p = sub.add_parser('packages', help='List packages required for apps')
 
86
    p.set_defaults(func=_handle_packages)
 
87
    p.add_argument('-a', '--app', action='append',
 
88
                   help='Autopilot test application. eg share_app')
 
89
 
 
90
    p = sub.add_parser('apps', help='List tests by autopilot application name')
 
91
    p.set_defaults(func=_handle_apps)
 
92
 
 
93
    p = sub.add_parser('tests', help='List tests by CI test name')
 
94
    p.set_defaults(func=_handle_tests)
 
95
 
 
96
    return parser
 
97
 
 
98
 
 
99
def main():
 
100
    args = _get_parser().parse_args()
 
101
    return args.func(args)
 
102
 
 
103
if __name__ == '__main__':
 
104
    exit(main())