Alex Miller | 9979b5a | 2012-11-01 17:36:12 -0700 | [diff] [blame] | 1 | # Copyright (c) 2013 The Chromium OS Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | |
Alex Miller | 9979b5a | 2012-11-01 17:36:12 -0700 | [diff] [blame] | 6 | import logging |
Alex Miller | 3ccd77d | 2013-08-08 01:39:20 -0700 | [diff] [blame] | 7 | import os |
Alex Miller | 9979b5a | 2012-11-01 17:36:12 -0700 | [diff] [blame] | 8 | |
| 9 | import common |
Alex Miller | 3ccd77d | 2013-08-08 01:39:20 -0700 | [diff] [blame] | 10 | |
| 11 | |
Aviv Keshet | 0856145 | 2016-03-16 10:08:47 -0700 | [diff] [blame] | 12 | _WHITELISTED_SUITES = ( |
| 13 | 'arc-cts', |
Ilja H. Friedel | 057b84b | 2016-05-17 15:38:24 -0700 | [diff] [blame] | 14 | 'arc-cts-06h', |
| 15 | 'arc-cts-12h', |
| 16 | 'arc-cts-18h', |
| 17 | 'arc-cts-24h', |
Aviv Keshet | 0856145 | 2016-03-16 10:08:47 -0700 | [diff] [blame] | 18 | 'arc-nightly', |
Ilja H. Friedel | 160b00c | 2016-05-12 19:40:13 -0700 | [diff] [blame] | 19 | 'arc-weekly', |
Aviv Keshet | 0856145 | 2016-03-16 10:08:47 -0700 | [diff] [blame] | 20 | 'crosbolt_arc_perf', |
| 21 | 'crosbolt_arc_perf_nightly', |
| 22 | ) |
David Haddock | d5faa10 | 2016-03-11 14:33:36 -0800 | [diff] [blame] | 23 | |
Alex Miller | 3ccd77d | 2013-08-08 01:39:20 -0700 | [diff] [blame] | 24 | def CheckControlFileExistance(tasks): |
| 25 | """ |
| 26 | Make sure that for any task that schedules a suite, that |
| 27 | test_suites/control.<suite> exists. this prevents people from accidentally |
| 28 | adding a suite to suite_scheduler.ini but not adding an actual suite |
| 29 | control file, thus resulting in their suite not running and the lab team |
| 30 | getting lots of email |
| 31 | |
| 32 | @param tasks The list of tasks to check. |
| 33 | @return 0 if no missing control files are found |
| 34 | 1 if there are at least one missing control files |
| 35 | """ |
| 36 | corrections = False |
| 37 | |
| 38 | for task in tasks: |
| 39 | suite_path = os.path.join(common.autotest_dir, |
| 40 | 'test_suites', 'control.'+task.suite) |
David Haddock | d5faa10 | 2016-03-11 14:33:36 -0800 | [diff] [blame] | 41 | if task.suite in _WHITELISTED_SUITES: |
Aviv Keshet | 0d23dd0 | 2016-03-08 15:27:09 -0800 | [diff] [blame] | 42 | continue |
Alex Miller | 3ccd77d | 2013-08-08 01:39:20 -0700 | [diff] [blame] | 43 | if not os.path.exists(suite_path): |
| 44 | corrections = True |
Ilja H. Friedel | 04be2bd | 2014-05-07 21:29:59 -0700 | [diff] [blame] | 45 | logging.warning("No suite control file for %s", task.suite) |
Alex Miller | 3ccd77d | 2013-08-08 01:39:20 -0700 | [diff] [blame] | 46 | |
| 47 | return 1 if corrections else 0 |