OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # | 2 # |
3 # Copyright 2008 Google Inc. All Rights Reserved. | 3 # Copyright 2008 Google Inc. All Rights Reserved. |
4 """ | 4 """ |
5 This utility allows for easy updating, removing and importing | 5 This utility allows for easy updating, removing and importing |
6 of tests into the autotest_web afe_autotests table. | 6 of tests into the autotest_web afe_autotests table. |
7 | 7 |
8 Example of updating client side tests: | 8 Example of updating client side tests: |
9 ./test_importer.py -t /usr/local/autotest/client/tests | 9 ./test_importer.py -t /usr/local/autotest/client/tests |
10 | 10 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 test_new_test[-1]) | 235 test_new_test[-1]) |
236 new_test.name = control_name.replace('control.', '') | 236 new_test.name = control_name.replace('control.', '') |
237 | 237 |
238 # Experimental Check | 238 # Experimental Check |
239 if not add_experimental and new_test.experimental: | 239 if not add_experimental and new_test.experimental: |
240 continue | 240 continue |
241 | 241 |
242 _log_or_execute(repr(new_test), new_test.save) | 242 _log_or_execute(repr(new_test), new_test.save) |
243 add_label_dependencies(new_test) | 243 add_label_dependencies(new_test) |
244 | 244 |
| 245 # save TestParameter |
| 246 for para_name in data.test_parameters: |
| 247 test_parameter = models.TestParameter.objects.get_or_create( |
| 248 test=new_test, name=para_name)[0] |
| 249 test_parameter.save() |
| 250 |
245 | 251 |
246 def _set_attributes_clean(test, data): | 252 def _set_attributes_clean(test, data): |
247 """ | 253 """ |
248 First pass sets the attributes of the Test object from file system. | 254 First pass sets the attributes of the Test object from file system. |
249 | 255 |
250 @param test: a test object to be populated for the database. | 256 @param test: a test object to be populated for the database. |
251 @param data: object with test data from the file system. | 257 @param data: object with test data from the file system. |
252 """ | 258 """ |
253 test_type = { 'client' : 1, | 259 test_type = { 'client' : 1, |
254 'server' : 2, } | 260 'server' : 2, } |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 profilers = get_tests_from_fs(options.profile_dir, '.*py$') | 578 profilers = get_tests_from_fs(options.profile_dir, '.*py$') |
573 update_profilers_in_db(profilers, | 579 update_profilers_in_db(profilers, |
574 add_noncompliant=options.add_noncompliant, | 580 add_noncompliant=options.add_noncompliant, |
575 description='NA') | 581 description='NA') |
576 if options.clean_tests: | 582 if options.clean_tests: |
577 db_clean_broken(options.autotest_dir) | 583 db_clean_broken(options.autotest_dir) |
578 | 584 |
579 | 585 |
580 if __name__ == "__main__": | 586 if __name__ == "__main__": |
581 main(sys.argv) | 587 main(sys.argv) |
OLD | NEW |