blob: a45d0c293df08cc527863cc7ab4ccf06bd8c9c20 [file] [log] [blame]
Alex Miller9979b5a2012-11-01 17:36:12 -07001# 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 Miller9979b5a2012-11-01 17:36:12 -07006import logging
Alex Miller3ccd77d2013-08-08 01:39:20 -07007import os
Alex Miller9979b5a2012-11-01 17:36:12 -07008
9import common
Alex Miller3ccd77d2013-08-08 01:39:20 -070010
11
Aviv Keshet08561452016-03-16 10:08:47 -070012_WHITELISTED_SUITES = (
13 'arc-cts',
14 'arc-nightly',
15 'crosbolt_arc_perf',
16 'crosbolt_arc_perf_nightly',
17)
David Haddockd5faa102016-03-11 14:33:36 -080018
Alex Miller3ccd77d2013-08-08 01:39:20 -070019def CheckControlFileExistance(tasks):
20 """
21 Make sure that for any task that schedules a suite, that
22 test_suites/control.<suite> exists. this prevents people from accidentally
23 adding a suite to suite_scheduler.ini but not adding an actual suite
24 control file, thus resulting in their suite not running and the lab team
25 getting lots of email
26
27 @param tasks The list of tasks to check.
28 @return 0 if no missing control files are found
29 1 if there are at least one missing control files
30 """
31 corrections = False
32
33 for task in tasks:
34 suite_path = os.path.join(common.autotest_dir,
35 'test_suites', 'control.'+task.suite)
David Haddockd5faa102016-03-11 14:33:36 -080036 if task.suite in _WHITELISTED_SUITES:
Aviv Keshet0d23dd02016-03-08 15:27:09 -080037 continue
Alex Miller3ccd77d2013-08-08 01:39:20 -070038 if not os.path.exists(suite_path):
39 corrections = True
Ilja H. Friedel04be2bd2014-05-07 21:29:59 -070040 logging.warning("No suite control file for %s", task.suite)
Alex Miller3ccd77d2013-08-08 01:39:20 -070041
42 return 1 if corrections else 0