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 def CheckControlFileExistance(tasks):
     13     """
     14     Make sure that for any task that schedules a suite, that
     15     test_suites/control.<suite> exists. this prevents people from accidentally
     16     adding a suite to suite_scheduler.ini but not adding an actual suite
     17     control file, thus resulting in their suite not running and the lab team
     18     getting lots of email
     19 
     20     @param tasks The list of tasks to check.
     21     @return 0 if no missing control files are found
     22             1 if there are at least one missing control files
     23     """
     24     corrections = False
     25 
     26     for task in tasks:
     27         suite_path = os.path.join(common.autotest_dir,
     28                                   'test_suites', 'control.'+task.suite)
     29         if not os.path.exists(suite_path):
     30             corrections = True
     31             logging.warning("No suite control file for %s", task.suite)
     32 
     33     return 1 if corrections else 0
     34