Merge lp:~doanac/ubuntu-test-cases/bug1284226 into lp:ubuntu-test-cases/touch

Proposed by Andy Doan
Status: Merged
Merged at revision: 191
Proposed branch: lp:~doanac/ubuntu-test-cases/bug1284226
Merge into: lp:ubuntu-test-cases/touch
Diff against target: 161 lines (+61/-21)
4 files modified
scripts/combine_results (+38/-16)
scripts/dashboard.py (+3/-0)
scripts/provision.sh (+1/-1)
scripts/run-autopilot-tests.sh (+19/-4)
To merge this branch: bzr merge lp:~doanac/ubuntu-test-cases/bug1284226
Reviewer Review Type Date Requested Status
Paul Larson Approve
Review via email: mp+208232@code.launchpad.net

Description of the change

moves test dependency installation out of provision.sh and into each test.

as a result, we now have 2 new results per test-suite (setup/teardown).

To post a comment you must log in.
Revision history for this message
Paul Larson (pwlars) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/combine_results'
2--- scripts/combine_results 2013-10-24 18:17:03 +0000
3+++ scripts/combine_results 2014-02-25 21:16:44 +0000
4@@ -13,10 +13,25 @@
5 from xml.etree import ElementTree
6
7
8+PRE_COMBINE = [
9+ ('settle_before', 'settle_before'),
10+ ('setup_setup', 'setup'),
11+]
12+
13+POST_COMBINE = [
14+ ('settle_after', 'settle_after'),
15+ ('setup_teardown', 'teardown'),
16+]
17+
18+
19 def _build_node(classname, name, rcfile, stdout):
20 e = ElementTree.Element('testcase')
21 e.attrib['classname'] = classname
22- e.attrib['name'] = 'settle_%s' % name
23+ e.attrib['name'] = name
24+
25+ if not os.path.exists(rcfile):
26+ return None, False
27+
28 rc = int(open(rcfile).read())
29 if rc != 0:
30 f = ElementTree.Element('failure')
31@@ -60,26 +75,33 @@
32 ap_file = os.path.join(resdir, 'test_results.xml')
33 tree = _get_results(ap_file)
34 ap_results = tree.getroot()
35+ added_results = 0
36
37 errors = int(ap_results.attrib['errors'])
38
39 classname = _get_classname(ap_results)
40
41- rc = os.path.join(resdir, 'settle_before.rc')
42- log = os.path.join(resdir, 'settle_before.log')
43- node, failed = _build_node(classname, 'before', rc, log)
44- ap_results.insert(0, node)
45- if failed:
46- errors += 1
47-
48- rc = os.path.join(resdir, 'settle_after.rc')
49- log = os.path.join(resdir, 'settle_after.log')
50- node, failed = _build_node(classname, 'after', rc, log)
51- ap_results.append(node)
52- if failed:
53- errors += 1
54-
55- num = int(ap_results.attrib['tests']) + 2
56+ for basename, label in PRE_COMBINE:
57+ rc = os.path.join(resdir, basename + '.rc')
58+ log = os.path.join(resdir, basename + '.log')
59+ node, failed = _build_node(classname, label, rc, log)
60+ if node is not None:
61+ ap_results.insert(0, node)
62+ if failed:
63+ errors += 1
64+ added_results += 1
65+
66+ for basename, label in POST_COMBINE:
67+ rc = os.path.join(resdir, basename + '.rc')
68+ log = os.path.join(resdir, basename + '.log')
69+ node, failed = _build_node(classname, label, rc, log)
70+ if node is not None:
71+ ap_results.append(node)
72+ if failed:
73+ errors += 1
74+ added_results += 1
75+
76+ num = int(ap_results.attrib['tests']) + added_results
77 ap_results.attrib['tests'] = str(num)
78 ap_results.attrib['errors'] = str(errors)
79
80
81=== modified file 'scripts/dashboard.py'
82--- scripts/dashboard.py 2014-02-05 00:44:09 +0000
83+++ scripts/dashboard.py 2014-02-25 21:16:44 +0000
84@@ -283,6 +283,9 @@
85 try:
86 val = args.func(api, args)
87 if val:
88+ if '/?' in val:
89+ log.debug('stripping api-key from response')
90+ val = val.split('/?')[0] + '/'
91 print(val)
92 except HTTPException as e:
93 print('ERROR: %s' % e)
94
95=== modified file 'scripts/provision.sh'
96--- scripts/provision.sh 2014-02-10 17:14:14 +0000
97+++ scripts/provision.sh 2014-02-25 21:16:44 +0000
98@@ -125,7 +125,7 @@
99
100 if [ -n "$CUSTOMIZE" ] ; then
101 log "CUSTOMIZING IMAGE"
102- phablet-config writable-image $CUSTOMIZE
103+ phablet-config writable-image
104 # Make sure whoopsie-upload-all can work (bug #1245524)
105 adb shell "sed -i '/Waiting for whoopsie/ a\ subprocess.call([\"restart\", \"whoopsie\"])' /usr/share/apport/whoopsie-upload-all"
106 fi
107
108=== modified file 'scripts/run-autopilot-tests.sh'
109--- scripts/run-autopilot-tests.sh 2014-02-05 00:44:09 +0000
110+++ scripts/run-autopilot-tests.sh 2014-02-25 21:16:44 +0000
111@@ -31,6 +31,21 @@
112 echo ERROR: $* >> ${RESDIR}/runner-errors.txt
113 }
114
115+setup_test() {
116+ app=$1
117+ label=$2
118+ odir=$3
119+ {
120+ pkgs=$(${BASEDIR}/jenkins/testconfig.py packages -a $app)
121+ if [ "$label" = "setup" ] ; then
122+ adb-shell sudo apt-get install -yq --force-yes $pkgs
123+ else
124+ adb-shell sudo apt-get remove -y $pkgs
125+ fi
126+ echo $? > ${odir}/setup_${label}.rc
127+ } 2>&1 | tee ${odir}/setup_${label}.log
128+}
129+
130 system_settle() {
131 [ -z $NOSETTLE ] || return 0
132
133@@ -48,10 +63,6 @@
134 timeout $timeout $settle -c5 -d6 -p 97.5 -l $label || rc=1
135 echo $rc > ${odir}/settle_${label}.rc
136 } 2>&1 | tee ${odir}/settle_${label}.log
137-
138- if [ "$label" = "after" ] ; then
139- ${BASEDIR}/scripts/combine_results ${odir}
140- fi
141 }
142
143 test_app() {
144@@ -65,6 +76,8 @@
145 phablet-config autopilot --dbus-probe enable || \
146 (log_error "'autopilot dbus-probe enable' failed"; return 1)
147
148+ setup_test $app setup $odir
149+
150 NOSHELL=""
151 [ "$app" = "unity8" ] && NOSHELL="-n"
152
153@@ -78,6 +91,8 @@
154 log_error "screen unlock failed, skipping $app"
155 fi
156 system_settle after $odir
157+ setup_test $app teardown $odir
158+ ${BASEDIR}/scripts/combine_results ${odir}
159 }
160
161 reboot_wait() {

Subscribers

People subscribed via source and target branches