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