Merge lp:~danilo/linaro-license-protection/cleanups into lp:~linaro-automation/linaro-license-protection/trunk
- cleanups
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Данило Шеган |
Approved revision: | 82 |
Merged at revision: | 76 |
Proposed branch: | lp:~danilo/linaro-license-protection/cleanups |
Merge into: | lp:~linaro-automation/linaro-license-protection/trunk |
Diff against target: |
1011 lines (+262/-198) 11 files modified
.bzrignore (+1/-0) .testr.conf (+1/-1) README (+49/-24) scripts/do_if_old.py (+2/-0) scripts/publish_to_snapshots.py (+58/-50) testplans/releases.txt (+1/-1) testplans/snapshots.txt (+1/-1) tests/__init__.py (+3/-7) tests/test_click_through_license.py (+11/-6) tests/test_php_unit.py (+4/-1) tests/test_publish_to_snapshots.py (+131/-107) |
To merge this branch: | bzr merge lp:~danilo/linaro-license-protection/cleanups |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Deepti B. Kalakeri (community) | Approve | ||
Review via email: mp+106249@code.launchpad.net |
Commit message
Description of the change
Move testing/ to tests/, clean up code to pass pep8/pyflakes and improve the README.
Deepti B. Kalakeri (deeptik) wrote : | # |
Данило Шеган (danilo) wrote : | # |
Deepti, what Python version is on natty (I assume 2.6)?
As for indentation, I believe this reads much better, since the lines tend to be long.
Georgy Redkozubov (gesha) wrote : | # |
> I am not able to run the tests successfully and it fails with the following
> error:
>
> AttributeError: 'module' object has no attribute 'test_php_unit'
>
> This is same with the latest linaro-
> Also, I tried the testplan testing instructions given in the README, but it
> fails with the same error.
>
> PS: I tested this on Natty, so might be specific to my case.
It works on Precise, all tests passed.
Deepti B. Kalakeri (deeptik) wrote : | # |
On Fri, May 18, 2012 at 1:25 PM, Данило Шеган <email address hidden> wrote:
> Deepti, what Python version is on natty (I assume 2.6)?
>
No its python 2.7. Are we suppose to verify this only on precise or the
test needs to be backward compatible as well ?
>
> As for indentation, I believe this reads much better, since the lines tend
> to be long.
>
ok, if you say so, everything else looks ok. +1
> --
>
> https:/
> Your team Linaro Infrastructure is requested to review the proposed merge
> of lp:~danilo/linaro-license-protection/cleanups into
> lp:linaro-license-protection.
>
--
Thanks and Regards,
Deepti
Stevan Radaković (stevanr) wrote : | # |
On 05/18/2012 09:56 AM, Georgy Redkozubov wrote:
>> I am not able to run the tests successfully and it fails with the following
>> error:
>>
>> AttributeError: 'module' object has no attribute 'test_php_unit'
>>
>> This is same with the latest linaro-
>> Also, I tried the testplan testing instructions given in the README, but it
>> fails with the same error.
>>
>> PS: I tested this on Natty, so might be specific to my case.
> It works on Precise, all tests passed.
What gesha said. I run precise as well.
Данило Шеган (danilo) wrote : | # |
I've tried it on Lucid as well (with Python 2.6), and there are a few problems:
- more dependencies are needed (will update the README)
- testtools and testrepository that come with it are too old
- unittest requires modules to be imported in tests/__init__.py, which is not required with the version coming with Python 2.7.
Since we are not using distribution-
Данило Шеган (danilo) wrote : | # |
Deepti, for indentation, see the http://
More recent testtools and testrepository depend on Python 2.7, so I'll up that dependency in our docs as well.
- 82. By Данило Шеган
-
Update the dependencies to require Python 2.7.
Deepti B. Kalakeri (deeptik) wrote : | # |
On Fri, May 18, 2012 at 1:58 PM, Данило Шеган <email address hidden> wrote:
> Deepti, for indentation, see the
> http://
> according to PEP-8).
>
> More recent testtools and testrepository depend on Python 2.7, so I'll up
> that dependency in our docs as well.
>
Sounds good.
> --
>
> https:/
> Your team Linaro Infrastructure is requested to review the proposed merge
> of lp:~danilo/linaro-license-protection/cleanups into
> lp:linaro-license-protection.
>
--
Thanks and Regards,
Deepti
Deepti B. Kalakeri (deeptik) wrote : | # |
+1 Approved.
Thanks!!!
Deepti
Preview Diff
1 | === added file '.bzrignore' |
2 | --- .bzrignore 1970-01-01 00:00:00 +0000 |
3 | +++ .bzrignore 2012-05-18 08:34:31 +0000 |
4 | @@ -0,0 +1,1 @@ |
5 | +.testrepository |
6 | |
7 | === modified file '.testr.conf' |
8 | --- .testr.conf 2012-01-12 14:07:05 +0000 |
9 | +++ .testr.conf 2012-05-18 08:34:31 +0000 |
10 | @@ -1,3 +1,3 @@ |
11 | [DEFAULT] |
12 | test_command=python -m subunit.run $IDLIST |
13 | -test_id_list_default=testing.test_suite |
14 | +test_id_list_default=tests.test_suite |
15 | |
16 | === modified file 'README' |
17 | --- README 2012-05-17 12:37:39 +0000 |
18 | +++ README 2012-05-18 08:34:31 +0000 |
19 | @@ -1,26 +1,47 @@ |
20 | Linaro downloads license protection |
21 | =================================== |
22 | |
23 | -Linaro builds sometimes contain "binary blobs"—pieces of binary-only code which enable extra features like accelerated graphics or multimedia. These pieces are distributed under a separate license, and downloading images or collections containing them requires some sort of license protection. |
24 | - |
25 | -This code provides such license protection on the hosting web server: other parts of infrastructure need to properly integrate with it (see eg. android-build.linaro.org section). At the moment, it's implemented as a click-through license acceptance on the Apache side. |
26 | - |
27 | -To ensure and prove this keeps working, we are also using automated tests with this code. |
28 | +Linaro builds sometimes contain "binary blobs"—pieces of binary-only code |
29 | +which enable extra features like accelerated graphics or multimedia. |
30 | +These pieces are distributed under a separate license, and downloading |
31 | +images or collections containing them requires some sort of license |
32 | +protection. |
33 | + |
34 | +This code provides such license protection on the hosting web server: |
35 | +other parts of infrastructure need to properly integrate with it (see |
36 | +eg. android-build.linaro.org section). At the moment, it's implemented as |
37 | +a click-through license acceptance on the Apache side. |
38 | + |
39 | +To ensure and prove this keeps working, we are also using automated tests |
40 | +with this code. |
41 | |
42 | |
43 | Setup |
44 | ----- |
45 | |
46 | -This tree is the base for snapshots.linaro.org and releases.linaro.org www roots as served by Apache. It makes heavy use of mod_rewrite from within the .htaccess file. |
47 | +This tree is the base for snapshots.linaro.org and releases.linaro.org www |
48 | +roots as served by Apache. It makes heavy use of mod_rewrite from within |
49 | +the .htaccess file. |
50 | |
51 | -Currently, all directories/files containing either 'origen' or 'snowball' in the URL path are protected with appropriate license (Samsung or ST-E) click-through. |
52 | +Currently, all directories/files containing either 'origen' or 'snowball' |
53 | +in the URL path are protected with appropriate license (Samsung or ST-E) |
54 | +click-through. |
55 | |
56 | Dependencies |
57 | ............ |
58 | |
59 | libapache2-mod-php5 |
60 | |
61 | -Testing: phpunit, testrepository, python-html2text |
62 | +Testing: |
63 | + phpunit, python 2.7, testrepository (>=0.0.6), python-html2text, |
64 | + python-subunit, python-beautifulsoup |
65 | + |
66 | +Recent (as of 2012-05-08) Ubuntu/Debian releases have a broken phpunit |
67 | +package and thus require installation of phpunit through PEAR: |
68 | + |
69 | + $ sudo apt-get install php-pear |
70 | + $ sudo pear config-set auto_discover 1 |
71 | + $ sudo pear install pear.phpunit.de/PHPUnit |
72 | |
73 | |
74 | Technical details |
75 | @@ -32,7 +53,9 @@ |
76 | Root directory for releases.linaro.org includes .htaccess and licenses/*. |
77 | It has mod_rewrite enabled. |
78 | |
79 | -It allows a few hard-coded hosts to bypass the click-through protection, by their IPs: |
80 | +It allows a few hard-coded hosts to bypass the click-through protection, |
81 | +by their IPs: |
82 | + |
83 | * android-build.linaro.org (50.17.250.69) |
84 | * validation.linaro.org (213.123.120.124) |
85 | |
86 | @@ -57,7 +80,8 @@ |
87 | limited to executing only a single command through |
88 | /etc/ssh/user-authorized-keys/android-build-linaro-trigger |
89 | |
90 | - command="/home/android-build-linaro-trigger/scripts/trigger-android-build-linaro.sh ${SSH_ORIGINAL_COMMAND#* }" |
91 | + command="/home/android-build-linaro-trigger/scripts |
92 | + /trigger-android-build-linaro.sh ${SSH_ORIGINAL_COMMAND#* }" |
93 | |
94 | (this passes the arguments received from the remote end as well) |
95 | |
96 | @@ -72,7 +96,8 @@ |
97 | android-build.linaro.org |
98 | ........................ |
99 | |
100 | -Runs Jenkins and uses SFTP plugin to access the above two users. Private keys live in |
101 | +Runs Jenkins and uses SFTP plugin to access the above two users. Private |
102 | +keys live in |
103 | |
104 | /home/ubuntu/snapshots-sync/snapshots-sync — android-build-linaro |
105 | /home/ubuntu/snapshots-sync/snapshots-filemove — android-build-linaro-trigger |
106 | @@ -90,24 +115,24 @@ |
107 | $ testr init |
108 | $ testr run |
109 | |
110 | -To run the production test plans (NOTE: They will take a bit more time to run) |
111 | -execute the following: |
112 | +Test plans |
113 | +.......... |
114 | + |
115 | +To run the test plans from testplans/ subdirectory against |
116 | +snapshots.linaro.org and releases.linaro.org, execute the following: |
117 | |
118 | $ testr init |
119 | $ testr run testplans.test_suite |
120 | |
121 | +These tests require an internet connection. |
122 | |
123 | Tests for PHP license-matching logic |
124 | .................................... |
125 | |
126 | -There's currently only one unit test file, LicenseHelperTest.php under testing directory. You first need to install the phpunit package from ubuntu repos: |
127 | - $ sudo apt-get install php-unit |
128 | - |
129 | - |
130 | -Recent (as of 2012-05-08) Ubuntu/Debian releases have a broken phpunit package and thus require installation in a different manner: |
131 | - $ sudo apt-get install php-pear |
132 | - $ sudo pear config-set auto_discover 1 |
133 | - $ sudo pear install pear.phpunit.de/PHPUnit |
134 | - |
135 | -PHPUnit tests execution is already included in the python integration tests, but if you wish to run unit tests separately, do the following: |
136 | - $ phpunit testing/LicenseHelperTest |
137 | +Unit tests for the license-matching logic written in PHP are automatically |
138 | +ran as part of the full test suite (testr run). However, for a more |
139 | +detailed output, you may need to run phpunit directly. |
140 | + |
141 | +To run the tests separately, do the following: |
142 | + |
143 | + $ phpunit tests/LicenseHelperTest |
144 | |
145 | === modified file 'scripts/do_if_old.py' |
146 | --- scripts/do_if_old.py 2012-01-11 17:31:40 +0000 |
147 | +++ scripts/do_if_old.py 2012-05-18 08:34:31 +0000 |
148 | @@ -5,6 +5,7 @@ |
149 | import time |
150 | import sys |
151 | |
152 | + |
153 | def search_and_run(root_dir, command, trigger_age_string): |
154 | """Run command on old directories |
155 | |
156 | @@ -44,6 +45,7 @@ |
157 | if (time.time() - mod_time) > trigger_age_seconds: |
158 | os.system(command + " " + path) |
159 | |
160 | + |
161 | if __name__ == '__main__': |
162 | """Run command on directories that are older than trigger-age.""" |
163 | |
164 | |
165 | === modified file 'scripts/publish_to_snapshots.py' |
166 | --- scripts/publish_to_snapshots.py 2012-05-04 17:44:47 +0000 |
167 | +++ scripts/publish_to_snapshots.py 2012-05-18 08:34:31 +0000 |
168 | @@ -9,20 +9,22 @@ |
169 | parser = argparse.ArgumentParser() |
170 | parser.add_argument("-t", "--job-type", dest="job_type", |
171 | help="Specify the job type (Ex: android/kernel-hwpack)") |
172 | -parser.add_argument("-j", "--job-name", dest="job_name", |
173 | - help="Specify the job name which resulted the archive to "\ |
174 | - "be stored. Ex: ${JOB_NAME} should be specified for "\ |
175 | - "android/ubuntu-{hwpacks,images,sysroots}/binaries and for"\ |
176 | - "kernel-hwpack ${KERNEL_JOB_NAME}") |
177 | -parser.add_argument("-n", "--build-num", dest="build_num", type=int, |
178 | - help="Specify the job build number for android/"\ |
179 | - "ubuntu-{hwpacks,images,sysroots}/binaries") |
180 | +parser.add_argument( |
181 | + "-j", "--job-name", dest="job_name", |
182 | + help=("Specify the job name which resulted the archive to " |
183 | + "be stored. Ex: ${JOB_NAME} should be specified for " |
184 | + "android/ubuntu-{hwpacks,images,sysroots}/binaries and for" |
185 | + "kernel-hwpack ${KERNEL_JOB_NAME}")) |
186 | +parser.add_argument( |
187 | + "-n", "--build-num", dest="build_num", type=int, |
188 | + help=("Specify the job build number for android/" |
189 | + "ubuntu-{hwpacks,images,sysroots}/binaries")) |
190 | parser.add_argument("-m", "--manifest", dest="manifest", action='store_true', |
191 | help="Optional parameter to generate MANIFEST file") |
192 | |
193 | uploads_path = '/srv/snapshots.linaro.org/uploads/' |
194 | target_path = '/srv/snapshots.linaro.org/www/' |
195 | -PASS = 0 |
196 | +PASS = 0 |
197 | FAIL = 1 |
198 | acceptable_job_types = [ |
199 | 'android', |
200 | @@ -35,14 +37,16 @@ |
201 | 'binaries' |
202 | ] |
203 | |
204 | + |
205 | class SnapshotsPublisher(object): |
206 | |
207 | def validate_args(self, args): |
208 | - # Validate that all the required information |
209 | + # Validate that all the required information |
210 | # is passed on the command line |
211 | - if (args.job_type == None or args.job_name == None or \ |
212 | - args.build_num == None): |
213 | - parser.error("\nYou must specify job-type, job-name and build-num") |
214 | + if (args.job_type == None or args.job_name == None or |
215 | + args.build_num == None): |
216 | + parser.error( |
217 | + "\nYou must specify job-type, job-name and build-num") |
218 | return FAIL |
219 | |
220 | if (args.job_type not in acceptable_job_types): |
221 | @@ -52,16 +56,17 @@ |
222 | def jobname_to_target_subdir(self, args, jobname): |
223 | ret_val = None |
224 | if args.job_type == "android": |
225 | - ret_val = jobname.split("_") |
226 | + ret_val = jobname.split("_") |
227 | elif args.job_type == "kernel-hwpack": |
228 | ret_val = jobname.split('_')[0].replace(".", "_") |
229 | - elif args.job_type == "ubuntu-hwpacks" or \ |
230 | - args.job_type == "ubuntu-images" or\ |
231 | - args.job_type == "ubuntu-restricted" or\ |
232 | - args.job_type == "ubuntu-sysroots": |
233 | + elif (args.job_type == "ubuntu-hwpacks" or |
234 | + args.job_type == "ubuntu-images" or |
235 | + args.job_type == "ubuntu-restricted" or |
236 | + args.job_type == "ubuntu-sysroots"): |
237 | ret_val = jobname.split('-', 2) |
238 | elif args.job_type == "prebuilt": |
239 | - ret_val = '' #just need non-null since its isn't needed |
240 | + # Return value must not be None when we want to ignore it. |
241 | + ret_val = '' |
242 | elif args.job_type == "binaries": |
243 | ret_val = jobname.split('-', 2) |
244 | return ret_val |
245 | @@ -73,31 +78,32 @@ |
246 | if args.job_type == "android": |
247 | build_path = '/'.join([args.job_type, args.job_name, |
248 | str(args.build_num)]) |
249 | - build_dir_path = os.path.join(uploads_path, build_path) |
250 | + build_dir_path = os.path.join(uploads_path, build_path) |
251 | user_name = ret_val[0] |
252 | job_name = '_'.join(ret_val[1:]) |
253 | - target_dir = '/'.join([args.job_type, "~%s" % user_name, |
254 | + target_dir = '/'.join([args.job_type, "~%s" % user_name, |
255 | job_name, str(args.build_num)]) |
256 | target_dir_path = os.path.join(target_path, target_dir) |
257 | elif args.job_type == "kernel-hwpack": |
258 | kernel_tree = ret_val |
259 | - build_path = '/'.join([args.job_type, args.job_name, |
260 | + build_path = '/'.join([args.job_type, args.job_name, |
261 | str(args.build_num)]) |
262 | build_dir_path = os.path.join(uploads_path, build_path) |
263 | - target_dir = '/'.join([args.job_type, kernel_tree, |
264 | + target_dir = '/'.join([args.job_type, kernel_tree, |
265 | args.job_name]) |
266 | target_dir_path = os.path.join(target_path, target_dir) |
267 | - elif args.job_type == "ubuntu-hwpacks" or \ |
268 | - args.job_type == "ubuntu-images" or\ |
269 | - args.job_type == "ubuntu-restricted" or\ |
270 | - args.job_type == "ubuntu-sysroots": |
271 | + elif (args.job_type == "ubuntu-hwpacks" or |
272 | + args.job_type == "ubuntu-images" or |
273 | + args.job_type == "ubuntu-restricted" or |
274 | + args.job_type == "ubuntu-sysroots"): |
275 | dist_name = ret_val[0] |
276 | hwpack_image = args.job_type.split("-")[1] |
277 | board_rootfs_name = ret_val[2] |
278 | - build_dir_path = os.path.join(uploads_path, args.job_name, |
279 | + build_dir_path = os.path.join(uploads_path, args.job_name, |
280 | str(args.build_num)) |
281 | - target_dir = '/'.join([dist_name, hwpack_image, |
282 | - board_rootfs_name, str(args.build_num)]) |
283 | + target_dir = '/'.join( |
284 | + [dist_name, hwpack_image, board_rootfs_name, |
285 | + str(args.build_num)]) |
286 | target_dir_path = os.path.join(target_path, target_dir) |
287 | elif args.job_type == "prebuilt": |
288 | build_path = '%s/%d' % (args.job_name, args.build_num) |
289 | @@ -113,11 +119,9 @@ |
290 | timestamp = f.read().strip() |
291 | f.close() |
292 | os.remove(ts_file) |
293 | - target_dir_path = os.path.join(target_path, |
294 | - 'android', |
295 | - args.job_type, |
296 | - ret_val[0], |
297 | - timestamp) |
298 | + target_dir_path = os.path.join( |
299 | + target_path, 'android', args.job_type, ret_val[0], |
300 | + timestamp) |
301 | else: |
302 | return None, None |
303 | |
304 | @@ -157,7 +161,7 @@ |
305 | return FAIL |
306 | |
307 | def create_manifest_file(self, target_dir): |
308 | - orig_dir=os.getcwd() |
309 | + orig_dir = os.getcwd() |
310 | os.chdir(target_dir) |
311 | fn = os.path.join(target_dir, "MANIFEST") |
312 | lines = [] |
313 | @@ -165,7 +169,8 @@ |
314 | try: |
315 | for path, subdirs, files in os.walk("."): |
316 | for name in files: |
317 | - lines.append(os.path.join(path, name).split("./")[1] + "\n") |
318 | + lines.append( |
319 | + os.path.join(path, name).split("./")[1] + "\n") |
320 | |
321 | if len(lines) != 0: |
322 | fd = open(fn, "w+") |
323 | @@ -174,7 +179,7 @@ |
324 | fd.write(line) |
325 | fd.close() |
326 | else: |
327 | - raise Exception("Uploads directory was empty, "\ |
328 | + raise Exception("Uploads directory was empty, " |
329 | "nothing got moved to destination") |
330 | |
331 | os.chdir(orig_dir) |
332 | @@ -218,11 +223,11 @@ |
333 | |
334 | self.move_dir_content(build_dir_path, target_dir_path) |
335 | |
336 | - if args.job_type == "android" or\ |
337 | - args.job_type == "ubuntu-hwpacks" or\ |
338 | - args.job_type == "ubuntu-images" or\ |
339 | - args.job_type == "ubuntu-restricted" or\ |
340 | - args.job_type == "ubuntu-sysroots": |
341 | + if (args.job_type == "android" or |
342 | + args.job_type == "ubuntu-hwpacks" or |
343 | + args.job_type == "ubuntu-images" or |
344 | + args.job_type == "ubuntu-restricted" or |
345 | + args.job_type == "ubuntu-sysroots"): |
346 | ret = self.create_symlink(args, target_dir_path) |
347 | if ret != PASS: |
348 | return ret |
349 | @@ -233,30 +238,33 @@ |
350 | print "Failed to create manifest file" |
351 | return ret |
352 | |
353 | - print "Moved the files from '",build_dir_path, "' to '",\ |
354 | - target_dir_path, "'" |
355 | + print ( |
356 | + "Moved the files from '%s' to '%s'" % ( |
357 | + build_dir_path, target_dir_path)) |
358 | return PASS |
359 | |
360 | except OSError, details: |
361 | - print "Failed to create the target path", target_dir_path, \ |
362 | - ":", details |
363 | + print ( |
364 | + "Failed to create the target path %s: %s" % ( |
365 | + target_dir_path, details)) |
366 | return FAIL |
367 | |
368 | except shutil.Error: |
369 | print "Failed to move files destination path", target_dir_path |
370 | return FAIL |
371 | |
372 | + |
373 | def main(): |
374 | publisher = SnapshotsPublisher() |
375 | args = parser.parse_args() |
376 | publisher.validate_args(args) |
377 | try: |
378 | - build_dir_path, target_dir_path = publisher.validate_paths(args, uploads_path, |
379 | - target_path) |
380 | + build_dir_path, target_dir_path = publisher.validate_paths( |
381 | + args, uploads_path, target_path) |
382 | if build_dir_path == None or target_dir_path == None: |
383 | print "Problem with build/target path, move failed" |
384 | return FAIL |
385 | - ret = publisher.move_artifacts(args, build_dir_path, target_dir_path) |
386 | + ret = publisher.move_artifacts(args, build_dir_path, target_dir_path) |
387 | if ret != PASS: |
388 | print "Move Failed" |
389 | return FAIL |
390 | |
391 | === modified file 'testplans/releases.txt' |
392 | --- testplans/releases.txt 2012-05-16 16:46:12 +0000 |
393 | +++ testplans/releases.txt 2012-05-18 08:34:31 +0000 |
394 | @@ -6,7 +6,7 @@ |
395 | |
396 | Import class we will use for this test and init browser object. |
397 | |
398 | - >>> from testing.doctest_production_browser import DoctestProductionBrowser |
399 | + >>> from tests.doctest_production_browser import DoctestProductionBrowser |
400 | >>> browser = DoctestProductionBrowser("http://releases.linaro.org/") |
401 | |
402 | Visiting homepage and check for title. |
403 | |
404 | === modified file 'testplans/snapshots.txt' |
405 | --- testplans/snapshots.txt 2012-05-16 16:30:19 +0000 |
406 | +++ testplans/snapshots.txt 2012-05-18 08:34:31 +0000 |
407 | @@ -6,7 +6,7 @@ |
408 | |
409 | Import class we will use for this test and init browser object. |
410 | |
411 | - >>> from testing.doctest_production_browser import DoctestProductionBrowser |
412 | + >>> from tests.doctest_production_browser import DoctestProductionBrowser |
413 | >>> browser = DoctestProductionBrowser("http://snapshots.linaro.org/") |
414 | |
415 | Visiting homepage and check for title. |
416 | |
417 | === renamed directory 'testing' => 'tests' |
418 | === modified file 'tests/__init__.py' |
419 | --- testing/__init__.py 2012-05-17 12:37:39 +0000 |
420 | +++ tests/__init__.py 2012-05-18 08:34:31 +0000 |
421 | @@ -1,15 +1,11 @@ |
422 | -import os |
423 | import unittest |
424 | |
425 | -from testing.test_click_through_license import * |
426 | -from testing.test_publish_to_snapshots import * |
427 | - |
428 | |
429 | def test_suite(): |
430 | module_names = [ |
431 | - 'testing.test_click_through_license.TestLicense', |
432 | - 'testing.test_publish_to_snapshots.TestSnapshotsPublisher', |
433 | - 'testing.test_php_unit.PhpUnitTest', |
434 | + 'tests.test_click_through_license.TestLicense', |
435 | + 'tests.test_publish_to_snapshots.TestSnapshotsPublisher', |
436 | + 'tests.test_php_unit.PhpUnitTest', |
437 | ] |
438 | loader = unittest.TestLoader() |
439 | suite = loader.loadTestsFromNames(module_names) |
440 | |
441 | === modified file 'tests/test_click_through_license.py' |
442 | --- testing/test_click_through_license.py 2012-05-11 12:07:43 +0000 |
443 | +++ tests/test_click_through_license.py 2012-05-18 08:34:31 +0000 |
444 | @@ -14,7 +14,7 @@ |
445 | fetcher = LicenseProtectedFileFetcher() |
446 | cwd = os.getcwd() |
447 | docroot = cwd |
448 | -srvroot = os.path.abspath(os.path.join(*([cwd] + ['testing']))) |
449 | +srvroot = os.path.abspath(os.path.join(*([cwd] + ['tests']))) |
450 | local_rewrite = 'RewriteCond %{REMOTE_ADDR} 127.0.0.1 [OR]' |
451 | |
452 | host = 'http://127.0.0.1' |
453 | @@ -23,12 +23,15 @@ |
454 | ste_license_path = '/licenses/ste.html' |
455 | linaro_license_path = '/licenses/linaro.html' |
456 | samsung_test_file = '/android/~linaro-android/staging-origen/test.txt' |
457 | -ste_test_file = '/android/~linaro-android/staging-snowball/173/target/product/snowball/test.txt' |
458 | +ste_test_file = ('/android/~linaro-android/staging-snowball' |
459 | + '/173/target/product/snowball/test.txt') |
460 | ste_open_test_file = '/android/~linaro-android/staging-snowball/173/test.txt' |
461 | never_available = '/android/~linaro-android/staging-imx53/test.txt' |
462 | linaro_test_file = '/android/~linaro-android/staging-panda/test.txt' |
463 | -not_protected_test_file = '/android/~linaro-android/staging-vexpress-a9/test.txt' |
464 | -not_found_test_file = '/android/~linaro-android/staging-vexpress-a9/notfound.txt' |
465 | +not_protected_test_file = ('/android/~linaro-android/staging-vexpress-a9' |
466 | + '/test.txt') |
467 | +not_found_test_file = ('/android/~linaro-android/staging-vexpress-a9' |
468 | + '/notfound.txt') |
469 | per_file_samsung_test_file = '/android/images/origen-blob.txt' |
470 | per_file_ste_test_file = '/android/images/snowball-blob.txt' |
471 | per_file_not_protected_test_file = '/android/images/MANIFEST' |
472 | @@ -267,13 +270,15 @@ |
473 | def test_per_file_license_accepted_samsung(self): |
474 | search = "This is protected with click-through Samsung license." |
475 | os.rename("%s/cookies.samsung" % docroot, "%s/cookies.txt" % docroot) |
476 | - testfile = fetcher.get(host + per_file_samsung_test_file, ignore_license=True) |
477 | + testfile = fetcher.get(host + per_file_samsung_test_file, |
478 | + ignore_license=True) |
479 | self.assertThat(testfile, Contains(search)) |
480 | |
481 | def test_per_file_license_accepted_ste(self): |
482 | search = "This is protected with click-through ST-E license." |
483 | os.rename("%s/cookies.ste" % docroot, "%s/cookies.txt" % docroot) |
484 | - testfile = fetcher.get(host + per_file_ste_test_file, ignore_license=True) |
485 | + testfile = fetcher.get(host + per_file_ste_test_file, |
486 | + ignore_license=True) |
487 | self.assertThat(testfile, Contains(search)) |
488 | |
489 | def test_per_file_non_protected_dirs(self): |
490 | |
491 | === modified file 'tests/test_php_unit.py' |
492 | --- testing/test_php_unit.py 2012-05-14 10:39:08 +0000 |
493 | +++ tests/test_php_unit.py 2012-05-18 08:34:31 +0000 |
494 | @@ -7,6 +7,9 @@ |
495 | from testtools.matchers import Equals |
496 | from testtools.matchers import AllMatch |
497 | |
498 | +from tests.test_click_through_license import CommandNotFoundException |
499 | + |
500 | + |
501 | class PhpUnitTest(TestCase): |
502 | '''Tests for executing the PHP Unit tests''' |
503 | |
504 | @@ -14,7 +17,7 @@ |
505 | super(PhpUnitTest, self).setUp() |
506 | self.xml_path = tempfile.mkstemp()[1] |
507 | if subprocess.Popen(['phpunit', '--log-junit', |
508 | - self.xml_path, 'testing/LicenseHelperTest'], |
509 | + self.xml_path, 'tests/LicenseHelperTest'], |
510 | stdout=open('/dev/null', 'w'), |
511 | stderr=subprocess.STDOUT).wait(): |
512 | raise CommandNotFoundException("phpunit command not found. Please " |
513 | |
514 | === modified file 'tests/test_publish_to_snapshots.py' |
515 | --- testing/test_publish_to_snapshots.py 2012-05-02 18:34:30 +0000 |
516 | +++ tests/test_publish_to_snapshots.py 2012-05-18 08:34:31 +0000 |
517 | @@ -9,22 +9,25 @@ |
518 | from testtools import TestCase |
519 | from scripts.publish_to_snapshots import SnapshotsPublisher |
520 | |
521 | + |
522 | class TestSnapshotsPublisher(TestCase): |
523 | - '''Tests for publishing files to the snapshots.l.o www are.''' |
524 | + '''Tests for publishing files to the snapshots.l.o www area.''' |
525 | |
526 | uploads_path = "uploads/" |
527 | target_path = "www/" |
528 | orig_dir = os.getcwd() |
529 | |
530 | def setUp(self): |
531 | - self.parser = argparse.ArgumentParser() |
532 | + self.parser = argparse.ArgumentParser() |
533 | self.parser.add_argument("-t", "--job-type", dest="job_type") |
534 | self.parser.add_argument("-j", "--job-name", dest="job_name") |
535 | - self.parser.add_argument("-n", "--build-num", dest="build_num", type=int) |
536 | - self.parser.add_argument("-m", "--manifest", dest="manifest", action='store_true') |
537 | + self.parser.add_argument("-n", "--build-num", dest="build_num", |
538 | + type=int) |
539 | + self.parser.add_argument("-m", "--manifest", dest="manifest", |
540 | + action='store_true') |
541 | if not os.path.isdir(self.uploads_path): |
542 | os.mkdir(self.uploads_path) |
543 | - |
544 | + |
545 | if not os.path.isdir(self.target_path): |
546 | os.mkdir(self.target_path) |
547 | super(TestSnapshotsPublisher, self).setUp() |
548 | @@ -40,38 +43,38 @@ |
549 | |
550 | def test_validate_args_valid_job_values(self): |
551 | self.publisher = SnapshotsPublisher() |
552 | - param = self.parser.parse_args(['-t', 'android', '-j', 'dummy_job_name', |
553 | - '-n', '1']) |
554 | + param = self.parser.parse_args( |
555 | + ['-t', 'android', '-j', 'dummy_job_name', '-n', '1']) |
556 | self.publisher.validate_args(param) |
557 | - param = self.parser.parse_args(['-t', 'kernel-hwpack', '-j', 'dummy_job_name', |
558 | - '-n', '1']) |
559 | + param = self.parser.parse_args( |
560 | + ['-t', 'kernel-hwpack', '-j', 'dummy_job_name', '-n', '1']) |
561 | self.publisher.validate_args(param) |
562 | |
563 | - param = self.parser.parse_args(['-t', 'prebuilt', '-j', 'dummy_job_name', |
564 | - '-n', '1']) |
565 | - self.publisher.validate_args(param) |
566 | - param = self.parser.parse_args(['-t', 'ubuntu-hwpacks', '-j', 'dummy_job_name', |
567 | - '-n', '1']) |
568 | - self.publisher.validate_args(param) |
569 | - param = self.parser.parse_args(['-t', 'ubuntu-images', '-j', 'dummy_job_name', |
570 | - '-n', '1']) |
571 | - self.publisher.validate_args(param) |
572 | - param = self.parser.parse_args(['-t', 'ubuntu-restricted', '-j', 'dummy_job_name', |
573 | - '-n', '1']) |
574 | - self.publisher.validate_args(param) |
575 | - param = self.parser.parse_args(['-t', 'ubuntu-sysroots', '-j', 'dummy_job_name', |
576 | - '-n', '1']) |
577 | - self.publisher.validate_args(param) |
578 | - param = self.parser.parse_args(['-t', 'binaries', '-j', 'dummy_job_name', |
579 | - '-n', '1']) |
580 | + param = self.parser.parse_args( |
581 | + ['-t', 'prebuilt', '-j', 'dummy_job_name', '-n', '1']) |
582 | + self.publisher.validate_args(param) |
583 | + param = self.parser.parse_args( |
584 | + ['-t', 'ubuntu-hwpacks', '-j', 'dummy_job_name', '-n', '1']) |
585 | + self.publisher.validate_args(param) |
586 | + param = self.parser.parse_args( |
587 | + ['-t', 'ubuntu-images', '-j', 'dummy_job_name', '-n', '1']) |
588 | + self.publisher.validate_args(param) |
589 | + param = self.parser.parse_args( |
590 | + ['-t', 'ubuntu-restricted', '-j', 'dummy_job_name', '-n', '1']) |
591 | + self.publisher.validate_args(param) |
592 | + param = self.parser.parse_args( |
593 | + ['-t', 'ubuntu-sysroots', '-j', 'dummy_job_name', '-n', '1']) |
594 | + self.publisher.validate_args(param) |
595 | + param = self.parser.parse_args( |
596 | + ['-t', 'binaries', '-j', 'dummy_job_name', '-n', '1']) |
597 | self.publisher.validate_args(param) |
598 | |
599 | def test_validate_args_invalid_job_type(self): |
600 | orig_stderr = sys.stderr |
601 | stderr = sys.stderr = StringIO() |
602 | self.publisher = SnapshotsPublisher() |
603 | - param = self.parser.parse_args(['-t', 'invalid_job_type', '-j', 'dummy_job_name', |
604 | - '-n', '1']) |
605 | + param = self.parser.parse_args( |
606 | + ['-t', 'invalid_job_type', '-j', 'dummy_job_name', '-n', '1']) |
607 | try: |
608 | self.publisher.validate_args(param) |
609 | except SystemExit, err: |
610 | @@ -82,7 +85,6 @@ |
611 | stderr.seek(0) |
612 | self.assertIn("Invalid job type", stderr.read()) |
613 | |
614 | - |
615 | def test_validate_args_run_invalid_argument(self): |
616 | orig_stderr = sys.stderr |
617 | stderr = sys.stderr = StringIO() |
618 | @@ -111,7 +113,7 @@ |
619 | sys.stderr = orig_stderr |
620 | |
621 | stderr.seek(0) |
622 | - self.assertIn("argument -n/--build-num: invalid int value: 'N'", |
623 | + self.assertIn("argument -n/--build-num: invalid int value: 'N'", |
624 | stderr.read()) |
625 | |
626 | def test_validate_args_run_none_values(self): |
627 | @@ -119,7 +121,8 @@ |
628 | stderr = sys.stderr = StringIO() |
629 | self.publisher = SnapshotsPublisher() |
630 | try: |
631 | - param = self.parser.parse_args(['-t', None , '-j', None , '-n' , 0]) |
632 | + param = self.parser.parse_args( |
633 | + ['-t', None, '-j', None, '-n', 0]) |
634 | self.publisher.validate_args(param) |
635 | except SystemExit, err: |
636 | self.assertEqual(err.code, 2, "None values are not acceptable") |
637 | @@ -127,20 +130,21 @@ |
638 | sys.stderr = orig_stderr |
639 | |
640 | stderr.seek(0) |
641 | - self.assertIn("You must specify job-type, job-name and build-num", |
642 | + self.assertIn("You must specify job-type, job-name and build-num", |
643 | stderr.read()) |
644 | |
645 | def test_validate_paths_invalid_uploads_path(self): |
646 | orig_stdout = sys.stdout |
647 | stdout = sys.stdout = StringIO() |
648 | self.publisher = SnapshotsPublisher() |
649 | - param = self.parser.parse_args(['-t', 'android', '-j', 'dummy_job_name', |
650 | - '-n', '1']) |
651 | + param = self.parser.parse_args( |
652 | + ['-t', 'android', '-j', 'dummy_job_name', '-n', '1']) |
653 | |
654 | self.publisher.validate_args(param) |
655 | uploads_path = "./dummy_uploads_path" |
656 | try: |
657 | - self.publisher.validate_paths(param, uploads_path, self.target_path) |
658 | + self.publisher.validate_paths(param, uploads_path, |
659 | + self.target_path) |
660 | finally: |
661 | sys.stdout = orig_stdout |
662 | |
663 | @@ -151,16 +155,18 @@ |
664 | orig_stdout = sys.stdout |
665 | stdout = sys.stdout = StringIO() |
666 | self.publisher = SnapshotsPublisher() |
667 | - param = self.parser.parse_args(['-t', 'android', '-j', 'dummy_job_name', |
668 | - '-n', '1']) |
669 | + param = self.parser.parse_args( |
670 | + ['-t', 'android', '-j', 'dummy_job_name', '-n', '1']) |
671 | |
672 | self.publisher.validate_args(param) |
673 | - build_path = os.path.join(self.uploads_path, param.job_type, param.job_name, |
674 | - str(param.build_num)) |
675 | + build_path = os.path.join( |
676 | + self.uploads_path, param.job_type, param.job_name, |
677 | + str(param.build_num)) |
678 | os.makedirs(build_path) |
679 | self.target_path = "./dummy_target_path" |
680 | try: |
681 | - self.publisher.validate_paths(param, self.uploads_path, self.target_path) |
682 | + self.publisher.validate_paths(param, self.uploads_path, |
683 | + self.target_path) |
684 | finally: |
685 | sys.stdout = orig_stdout |
686 | |
687 | @@ -171,19 +177,21 @@ |
688 | orig_stdout = sys.stdout |
689 | stdout = sys.stdout = StringIO() |
690 | self.publisher = SnapshotsPublisher() |
691 | - param = self.parser.parse_args(['-t', 'kernel-hwpack', '-j', 'dummy_job_name', |
692 | - '-n', '1']) |
693 | + param = self.parser.parse_args( |
694 | + ['-t', 'kernel-hwpack', '-j', 'dummy_job_name', '-n', '1']) |
695 | self.publisher.validate_args(param) |
696 | - build_path = os.path.join(self.uploads_path, param.job_type, param.job_name, |
697 | - str(param.build_num)) |
698 | + build_path = os.path.join( |
699 | + self.uploads_path, param.job_type, param.job_name, |
700 | + str(param.build_num)) |
701 | os.makedirs(build_path) |
702 | tempfile.mkstemp(dir=build_path) |
703 | try: |
704 | - uploads_dir_path, target_dir_path = self.publisher.validate_paths(param, |
705 | - self.uploads_path, self.target_path) |
706 | + uploads_dir_path, target_dir_path = self.publisher.validate_paths( |
707 | + param, self.uploads_path, self.target_path) |
708 | uploads_dir_path = os.path.join(self.orig_dir, uploads_dir_path) |
709 | target_dir_path = os.path.join(self.orig_dir, target_dir_path) |
710 | - self.publisher.move_artifacts(param, uploads_dir_path, target_dir_path) |
711 | + self.publisher.move_artifacts(param, uploads_dir_path, |
712 | + target_dir_path) |
713 | finally: |
714 | sys.stdout = orig_stdout |
715 | pass |
716 | @@ -195,19 +203,21 @@ |
717 | orig_stdout = sys.stdout |
718 | stdout = sys.stdout = StringIO() |
719 | self.publisher = SnapshotsPublisher() |
720 | - param = self.parser.parse_args(['-t', 'android', '-j', 'dummy_job_name', |
721 | - '-n', '1']) |
722 | + param = self.parser.parse_args( |
723 | + ['-t', 'android', '-j', 'dummy_job_name', '-n', '1']) |
724 | self.publisher.validate_args(param) |
725 | - build_dir = '/'.join([param.job_type, param.job_name, str(param.build_num)]) |
726 | + build_dir = '/'.join( |
727 | + [param.job_type, param.job_name, str(param.build_num)]) |
728 | build_path = os.path.join(self.uploads_path, build_dir) |
729 | os.makedirs(build_path) |
730 | tempfile.mkstemp(dir=build_path) |
731 | try: |
732 | - uploads_dir_path, target_dir_path = self.publisher.validate_paths(param, |
733 | - self.uploads_path, self.target_path) |
734 | + uploads_dir_path, target_dir_path = self.publisher.validate_paths( |
735 | + param, self.uploads_path, self.target_path) |
736 | uploads_dir_path = os.path.join(self.orig_dir, uploads_dir_path) |
737 | target_dir_path = os.path.join(self.orig_dir, target_dir_path) |
738 | - self.publisher.move_artifacts(param, uploads_dir_path, target_dir_path) |
739 | + self.publisher.move_artifacts(param, uploads_dir_path, |
740 | + target_dir_path) |
741 | finally: |
742 | sys.stdout = orig_stdout |
743 | pass |
744 | @@ -219,19 +229,20 @@ |
745 | orig_stdout = sys.stdout |
746 | stdout = sys.stdout = StringIO() |
747 | self.publisher = SnapshotsPublisher() |
748 | - param = self.parser.parse_args(['-t', 'prebuilt', '-j', 'dummy_job_name', |
749 | - '-n', '1']) |
750 | + param = self.parser.parse_args( |
751 | + ['-t', 'prebuilt', '-j', 'dummy_job_name', '-n', '1']) |
752 | self.publisher.validate_args(param) |
753 | build_dir = '/'.join([param.job_name, str(param.build_num)]) |
754 | - build_path = os.path.join(self.uploads_path, build_dir,'oneiric') |
755 | + build_path = os.path.join(self.uploads_path, build_dir, 'oneiric') |
756 | os.makedirs(build_path) |
757 | tempfile.mkstemp(dir=build_path) |
758 | try: |
759 | - uploads_dir_path, target_dir_path = self.publisher.validate_paths(param, |
760 | - self.uploads_path, self.target_path) |
761 | + uploads_dir_path, target_dir_path = self.publisher.validate_paths( |
762 | + param, self.uploads_path, self.target_path) |
763 | uploads_dir_path = os.path.join(self.orig_dir, uploads_dir_path) |
764 | target_dir_path = os.path.join(self.orig_dir, target_dir_path) |
765 | - self.publisher.move_artifacts(param, uploads_dir_path, target_dir_path) |
766 | + self.publisher.move_artifacts(param, uploads_dir_path, |
767 | + target_dir_path) |
768 | finally: |
769 | sys.stdout = orig_stdout |
770 | pass |
771 | @@ -243,7 +254,7 @@ |
772 | orig_stdout = sys.stdout |
773 | stdout = sys.stdout = StringIO() |
774 | self.publisher = SnapshotsPublisher() |
775 | - param = self.parser.parse_args(['-t', 'ubuntu-hwpacks', '-j', |
776 | + param = self.parser.parse_args(['-t', 'ubuntu-hwpacks', '-j', |
777 | 'precise-armhf-lt-panda', '-n', '1']) |
778 | self.publisher.validate_args(param) |
779 | build_dir = '/'.join([param.job_name, str(param.build_num)]) |
780 | @@ -251,11 +262,12 @@ |
781 | os.makedirs(build_path) |
782 | tempfile.mkstemp(dir=build_path) |
783 | try: |
784 | - uploads_dir_path, target_dir_path = self.publisher.validate_paths(param, |
785 | - self.uploads_path, self.target_path) |
786 | + uploads_dir_path, target_dir_path = self.publisher.validate_paths( |
787 | + param, self.uploads_path, self.target_path) |
788 | uploads_dir_path = os.path.join(self.orig_dir, uploads_dir_path) |
789 | target_dir_path = os.path.join(self.orig_dir, target_dir_path) |
790 | - self.publisher.move_artifacts(param, uploads_dir_path, target_dir_path) |
791 | + self.publisher.move_artifacts(param, uploads_dir_path, |
792 | + target_dir_path) |
793 | finally: |
794 | sys.stdout = orig_stdout |
795 | pass |
796 | @@ -267,19 +279,21 @@ |
797 | orig_stdout = sys.stdout |
798 | stdout = sys.stdout = StringIO() |
799 | self.publisher = SnapshotsPublisher() |
800 | - param = self.parser.parse_args(['-t', 'ubuntu-images', '-j', |
801 | - 'precise-armhf-ubuntu-desktop', '-n', '1']) |
802 | + param = self.parser.parse_args( |
803 | + ['-t', 'ubuntu-images', '-j', 'precise-armhf-ubuntu-desktop', |
804 | + '-n', '1']) |
805 | self.publisher.validate_args(param) |
806 | build_dir = '/'.join([param.job_name, str(param.build_num)]) |
807 | build_path = os.path.join(self.uploads_path, build_dir) |
808 | os.makedirs(build_path) |
809 | tempfile.mkstemp(dir=build_path) |
810 | try: |
811 | - uploads_dir_path, target_dir_path = self.publisher.validate_paths(param, |
812 | - self.uploads_path, self.target_path) |
813 | + uploads_dir_path, target_dir_path = self.publisher.validate_paths( |
814 | + param, self.uploads_path, self.target_path) |
815 | uploads_dir_path = os.path.join(self.orig_dir, uploads_dir_path) |
816 | target_dir_path = os.path.join(self.orig_dir, target_dir_path) |
817 | - self.publisher.move_artifacts(param, uploads_dir_path, target_dir_path) |
818 | + self.publisher.move_artifacts(param, uploads_dir_path, |
819 | + target_dir_path) |
820 | finally: |
821 | sys.stdout = orig_stdout |
822 | pass |
823 | @@ -291,20 +305,21 @@ |
824 | orig_stdout = sys.stdout |
825 | stdout = sys.stdout = StringIO() |
826 | self.publisher = SnapshotsPublisher() |
827 | - param = self.parser.parse_args(['-t', 'ubuntu-restricted', '-j', |
828 | - 'precise-armhf-integrated-big.little-fastmodels', |
829 | - '-n', '1']) |
830 | + param = self.parser.parse_args( |
831 | + ['-t', 'ubuntu-restricted', '-j', |
832 | + 'precise-armhf-integrated-big.little-fastmodels', '-n', '1']) |
833 | self.publisher.validate_args(param) |
834 | build_dir = '/'.join([param.job_name, str(param.build_num)]) |
835 | build_path = os.path.join(self.uploads_path, build_dir) |
836 | os.makedirs(build_path) |
837 | tempfile.mkstemp(dir=build_path) |
838 | try: |
839 | - uploads_dir_path, target_dir_path = self.publisher.validate_paths(param, |
840 | - self.uploads_path, self.target_path) |
841 | + uploads_dir_path, target_dir_path = self.publisher.validate_paths( |
842 | + param, self.uploads_path, self.target_path) |
843 | uploads_dir_path = os.path.join(self.orig_dir, uploads_dir_path) |
844 | target_dir_path = os.path.join(self.orig_dir, target_dir_path) |
845 | - self.publisher.move_artifacts(param, uploads_dir_path, target_dir_path) |
846 | + self.publisher.move_artifacts(param, uploads_dir_path, |
847 | + target_dir_path) |
848 | finally: |
849 | sys.stdout = orig_stdout |
850 | pass |
851 | @@ -316,19 +331,21 @@ |
852 | orig_stdout = sys.stdout |
853 | stdout = sys.stdout = StringIO() |
854 | self.publisher = SnapshotsPublisher() |
855 | - param = self.parser.parse_args(['-t', 'ubuntu-sysroots', '-j', |
856 | - 'precise-armhf-ubuntu-desktop-dev', '-n', '1']) |
857 | + param = self.parser.parse_args( |
858 | + ['-t', 'ubuntu-sysroots', '-j', |
859 | + 'precise-armhf-ubuntu-desktop-dev', '-n', '1']) |
860 | self.publisher.validate_args(param) |
861 | build_dir = '/'.join([param.job_name, str(param.build_num)]) |
862 | build_path = os.path.join(self.uploads_path, build_dir) |
863 | os.makedirs(build_path) |
864 | tempfile.mkstemp(dir=build_path) |
865 | try: |
866 | - uploads_dir_path, target_dir_path = self.publisher.validate_paths(param, |
867 | - self.uploads_path, self.target_path) |
868 | + uploads_dir_path, target_dir_path = self.publisher.validate_paths( |
869 | + param, self.uploads_path, self.target_path) |
870 | uploads_dir_path = os.path.join(self.orig_dir, uploads_dir_path) |
871 | target_dir_path = os.path.join(self.orig_dir, target_dir_path) |
872 | - self.publisher.move_artifacts(param, uploads_dir_path, target_dir_path) |
873 | + self.publisher.move_artifacts(param, uploads_dir_path, |
874 | + target_dir_path) |
875 | finally: |
876 | sys.stdout = orig_stdout |
877 | pass |
878 | @@ -353,12 +370,12 @@ |
879 | f.write('20120416') |
880 | f.close() |
881 | try: |
882 | - uploads_dir_path, target_dir_path = self.publisher.validate_paths(param, |
883 | - self.uploads_path, |
884 | - self.target_path) |
885 | + uploads_dir_path, target_dir_path = self.publisher.validate_paths( |
886 | + param, self.uploads_path, self.target_path) |
887 | uploads_dir_path = os.path.join(self.orig_dir, uploads_dir_path) |
888 | target_dir_path = os.path.join(self.orig_dir, target_dir_path) |
889 | - self.publisher.move_artifacts(param, uploads_dir_path, target_dir_path) |
890 | + self.publisher.move_artifacts(param, uploads_dir_path, |
891 | + target_dir_path) |
892 | finally: |
893 | sys.stdout = orig_stdout |
894 | pass |
895 | @@ -366,23 +383,25 @@ |
896 | stdout.seek(0) |
897 | self.assertIn("Moved the files from", stdout.read()) |
898 | |
899 | - def test_move_artifacts_android_successful_move(self): |
900 | + def test_move_artifacts_android_successful_move2(self): |
901 | orig_stdout = sys.stdout |
902 | stdout = sys.stdout = StringIO() |
903 | self.publisher = SnapshotsPublisher() |
904 | - param = self.parser.parse_args(['-t', 'android', '-j', 'dummy_job_name', |
905 | - '-n', '1']) |
906 | + param = self.parser.parse_args( |
907 | + ['-t', 'android', '-j', 'dummy_job_name', '-n', '1']) |
908 | self.publisher.validate_args(param) |
909 | - build_dir = '/'.join([param.job_type, param.job_name, str(param.build_num)]) |
910 | + build_dir = '/'.join( |
911 | + [param.job_type, param.job_name, str(param.build_num)]) |
912 | build_path = os.path.join(self.uploads_path, build_dir) |
913 | os.makedirs(build_path) |
914 | tempfile.mkstemp(dir=build_path) |
915 | try: |
916 | - uploads_dir_path, target_dir_path = self.publisher.validate_paths(param, |
917 | - self.uploads_path, self.target_path) |
918 | + uploads_dir_path, target_dir_path = self.publisher.validate_paths( |
919 | + param, self.uploads_path, self.target_path) |
920 | uploads_dir_path = os.path.join(self.orig_dir, uploads_dir_path) |
921 | target_dir_path = os.path.join(self.orig_dir, target_dir_path) |
922 | - self.publisher.move_artifacts(param, uploads_dir_path, target_dir_path) |
923 | + self.publisher.move_artifacts(param, uploads_dir_path, |
924 | + target_dir_path) |
925 | finally: |
926 | sys.stdout = orig_stdout |
927 | pass |
928 | @@ -394,52 +413,57 @@ |
929 | orig_stdout = sys.stdout |
930 | stdout = sys.stdout = StringIO() |
931 | self.publisher = SnapshotsPublisher() |
932 | - param = self.parser.parse_args(['-t', 'android', '-j', 'dummy_job_name', |
933 | - '-n', '1']) |
934 | + param = self.parser.parse_args( |
935 | + ['-t', 'android', '-j', 'dummy_job_name', '-n', '1']) |
936 | self.publisher.validate_args(param) |
937 | - build_dir = '/'.join([param.job_type, param.job_name, str(param.build_num)]) |
938 | + build_dir = '/'.join( |
939 | + [param.job_type, param.job_name, str(param.build_num)]) |
940 | build_path = os.path.join(self.uploads_path, build_dir) |
941 | os.makedirs(build_path) |
942 | tempfile.mkstemp(dir=build_path) |
943 | try: |
944 | - uploads_dir_path, target_dir_path = self.publisher.validate_paths(param, |
945 | - self.uploads_path, self.target_path) |
946 | + uploads_dir_path, target_dir_path = self.publisher.validate_paths( |
947 | + param, self.uploads_path, self.target_path) |
948 | uploads_dir_path = os.path.join(self.orig_dir, uploads_dir_path) |
949 | target_dir_path = os.path.join(self.orig_dir, target_dir_path) |
950 | - self.publisher.move_artifacts(param, uploads_dir_path, target_dir_path) |
951 | + self.publisher.move_artifacts(param, uploads_dir_path, |
952 | + target_dir_path) |
953 | finally: |
954 | sys.stdout = orig_stdout |
955 | pass |
956 | |
957 | stdout.seek(0) |
958 | - msg = "The latest build is now linked to " + target_dir_path |
959 | + msg = "The latest build is now linked to " + target_dir_path |
960 | self.assertIn(msg, stdout.read()) |
961 | |
962 | def test_create_manifest_file_option(self): |
963 | orig_stdout = sys.stdout |
964 | stdout = sys.stdout = StringIO() |
965 | self.publisher = SnapshotsPublisher() |
966 | - param = self.parser.parse_args(['-t', 'android', '-j', 'dummy_job_name', |
967 | - '-n', '1', '-m']) |
968 | + param = self.parser.parse_args( |
969 | + ['-t', 'android', '-j', 'dummy_job_name', '-n', '1', '-m']) |
970 | self.publisher.validate_args(param) |
971 | - build_dir = '/'.join([param.job_type, param.job_name, str(param.build_num)]) |
972 | + build_dir = '/'.join( |
973 | + [param.job_type, param.job_name, str(param.build_num)]) |
974 | build_path = os.path.join(self.uploads_path, build_dir) |
975 | os.makedirs(build_path) |
976 | tempfile.mkstemp(dir=build_path) |
977 | lines = [] |
978 | try: |
979 | - uploads_dir_path, target_dir_path = self.publisher.validate_paths(param, |
980 | - self.uploads_path, self.target_path) |
981 | + uploads_dir_path, target_dir_path = self.publisher.validate_paths( |
982 | + param, self.uploads_path, self.target_path) |
983 | uploads_dir_path = os.path.join(self.orig_dir, uploads_dir_path) |
984 | target_dir_path = os.path.join(self.orig_dir, target_dir_path) |
985 | os.chdir(uploads_dir_path) |
986 | for path, subdirs, files in os.walk("."): |
987 | for name in files: |
988 | - lines.append(os.path.join(path, name).split("./")[1] + "\n") |
989 | + lines.append( |
990 | + os.path.join(path, name).split("./")[1] + "\n") |
991 | os.chdir(self.orig_dir) |
992 | - self.publisher.move_artifacts(param, uploads_dir_path, target_dir_path) |
993 | + self.publisher.move_artifacts(param, uploads_dir_path, |
994 | + target_dir_path) |
995 | |
996 | - manifest_file=os.path.join(target_dir_path, "MANIFEST") |
997 | + manifest_file = os.path.join(target_dir_path, "MANIFEST") |
998 | dest = open(manifest_file, "r").read() |
999 | |
1000 | if len(lines) != 0: |
1001 | @@ -449,8 +473,8 @@ |
1002 | fd.write(line) |
1003 | fd.close() |
1004 | orig = open(tempfiles[1], "r").read() |
1005 | - |
1006 | - except Exception, details: |
1007 | + |
1008 | + except: |
1009 | pass |
1010 | |
1011 | finally: |
I am not able to run the tests successfully and it fails with the following
error:
AttributeError: 'module' object has no attribute 'test_php_unit'
This is same with the latest linaro- license- protection as well.
Also, I tried the testplan testing instructions given in the README, but it
fails with the same error.
PS: I tested this on Natty, so might be specific to my case.
Between I did not like the alignment in the following lines: publish_ to_snapshots. py' publish_ to_snapshots. py 2012-05-17 19:13:54 +0000 publish_ to_snapshots. py 2012-05-18 07:34:37 +0000
timestamp = f.read().strip()
f.close( )
os.remove( ts_file)
=== modified file 'scripts/
--- scripts/
+++ scripts/
@@ -119,9 +119,9 @@
- target_dir_path = os.path.join(
- target_path, 'android', args.job_type, ret_val[0],
- timestamp)
We could probably change it to join(target_ path, 'android',
+ target_dir_path = os.path.
+ args.job_type, ret_val[0],
+ timestamp)
else:
On Fri, May 18, 2012 at 1:31 AM, Данило Шеган <email address hidden> wrote:
> Данило Шеган has proposed merging infrastructure) /code.launchpad .net/~danilo/ linaro- license- protection/ cleanups/ +merge/ 106249<https:/ /code.launchpad .net/%7Edanilo/ linaro- license- protection/ cleanups/ +merge/ 106249> /code.launchpad .net/~danilo/ linaro- license- protection/ cleanups/ +merge/ 106249<https:/ /code.launchpad .net/%7Edanilo/ linaro- license- protection/ cleanups/ +merge/ 106249> list_default= testing. test_suite list_default= tests.test_ suite ======= ======= ======= =======
> lp:~danilo/linaro-license-protection/cleanups into
> lp:linaro-license-protection.
>
> Requested reviews:
> Linaro Infrastructure (linaro-
>
> For more details, see:
>
> https:/
>
> Move testing/ to tests/, clean up code to pass pep8/pyflakes and improve
> the README.
> --
>
> https:/
> Your team Linaro Infrastructure is requested to review the proposed merge
> of lp:~danilo/linaro-license-protection/cleanups into
> lp:linaro-license-protection.
>
> === added file '.bzrignore'
> --- .bzrignore 1970-01-01 00:00:00 +0000
> +++ .bzrignore 2012-05-17 20:00:28 +0000
> @@ -0,0 +1,1 @@
> +.testrepository
>
> === modified file '.testr.conf'
> --- .testr.conf 2012-01-12 14:07:05 +0000
> +++ .testr.conf 2012-05-17 20:00:28 +0000
> @@ -1,3 +1,3 @@
> [DEFAULT]
> test_command=python -m subunit.run $IDLIST
> -test_id_
> +test_id_
>
> === modified file 'README'
> --- README 2012-05-17 12:37:39 +0000
> +++ README 2012-05-17 20:00:28 +0000
> @@ -1,19 +1,31 @@
> Linaro downloads license protection
> =======
>
> -Linaro builds sometimes contain "binary blobs"—pieces of binary-only code
> which enable extra features like accelerated graphics or multimedia. These
> pieces are distributed under a separate license, and downloading images or
> collections containing them requires some sort of license protection.
> -
> -This code provides such license protection on the hosting web server:
> other parts of infrastructure need to properly integrate with it (see eg.
> android-build...