Home | History | Annotate | Download | only in suite_scheduler
      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 
      6 import logging
      7 import os
      8 
      9 import common
     10 
     11 
     12 _WHITELISTED_SUITES = (
     13     'arc-cts',
     14     'arc-cts-perbuild',
     15     'arc-cts-dev',
     16     'arc-cts-beta',
     17     'arc-cts-stable',
     18     'arc-cts-beta-fri',
     19     'arc-cts-beta-mon',
     20     'arc-cts-beta-sat',
     21     'arc-cts-beta-sun',
     22     'arc-cts-beta-thu',
     23     'arc-cts-beta-tue',
     24     'arc-cts-beta-wed',
     25     'arc-cts-dev-fri',
     26     'arc-cts-dev-mon',
     27     'arc-cts-dev-sat',
     28     'arc-cts-dev-sun',
     29     'arc-cts-dev-thu',
     30     'arc-cts-dev-tue',
     31     'arc-cts-dev-wed',
     32     'arc-cts-qual',
     33     'arc-gts',
     34     'arc-gts-perbuild',
     35     'arc-gts-qual',
     36     'arc-gts-tot',
     37     'arc-nightly',
     38     'arc-weekly',
     39     'crosbolt_arc_perf',
     40     'crosbolt_arc_perf_nightly',
     41     'crosbolt_arc_perf_perbuild',
     42 )
     43 
     44 def CheckControlFileExistence(tasks):
     45     """
     46     Make sure that for any task that schedules a suite, that
     47     test_suites/control.<suite> exists. this prevents people from accidentally
     48     adding a suite to suite_scheduler.ini but not adding an actual suite
     49     control file, thus resulting in their suite not running and the lab team
     50     getting lots of email
     51 
     52     @param tasks The list of tasks to check.
     53     @return 0 if no missing control files are found
     54             1 if there are at least one missing control files
     55     """
     56     corrections = False
     57 
     58     for task in tasks:
     59         suite_path = os.path.join(common.autotest_dir,
     60                                   'test_suites', 'control.'+task.suite)
     61         if task.suite in _WHITELISTED_SUITES:
     62             continue
     63         if not os.path.exists(suite_path):
     64             corrections = True
     65             logging.warning("No suite control file for %s", task.suite)
     66 
     67     return 1 if corrections else 0
     68