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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 control_name %= (test_new_test[-2], | 234 control_name %= (test_new_test[-2], |
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 | |
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 | 244 |
251 | 245 |
252 def _set_attributes_clean(test, data): | 246 def _set_attributes_clean(test, data): |
253 """ | 247 """ |
254 First pass sets the attributes of the Test object from file system. | 248 First pass sets the attributes of the Test object from file system. |
255 | 249 |
256 @param test: a test object to be populated for the database. | 250 @param test: a test object to be populated for the database. |
257 @param data: object with test data from the file system. | 251 @param data: object with test data from the file system. |
258 """ | 252 """ |
259 test_type = { 'client' : 1, | 253 test_type = { 'client' : 1, |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 profilers = get_tests_from_fs(options.profile_dir, '.*py$') | 572 profilers = get_tests_from_fs(options.profile_dir, '.*py$') |
579 update_profilers_in_db(profilers, | 573 update_profilers_in_db(profilers, |
580 add_noncompliant=options.add_noncompliant, | 574 add_noncompliant=options.add_noncompliant, |
581 description='NA') | 575 description='NA') |
582 if options.clean_tests: | 576 if options.clean_tests: |
583 db_clean_broken(options.autotest_dir) | 577 db_clean_broken(options.autotest_dir) |
584 | 578 |
585 | 579 |
586 if __name__ == "__main__": | 580 if __name__ == "__main__": |
587 main(sys.argv) | 581 main(sys.argv) |
OLD | NEW |