blob: 37896478b68530607d5b420b2c2d9c8a9c22fad8 [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',
Ilja H. Friedelad6d8792016-11-28 21:53:44 -080014 'arc-cts-dev',
15 'arc-cts-beta',
16 'arc-cts-stable',
David Haddockfa0b4252016-05-17 17:18:06 -070017 'arc-gts',
David Haddock5b2a0f02016-08-09 12:35:35 -070018 'arc-gts-tot',
Aviv Keshet08561452016-03-16 10:08:47 -070019 'arc-nightly',
Ilja H. Friedel160b00c2016-05-12 19:40:13 -070020 'arc-weekly',
Aviv Keshet08561452016-03-16 10:08:47 -070021 'crosbolt_arc_perf',
22 'crosbolt_arc_perf_nightly',
xixuan9b153422017-02-06 15:38:40 -080023 'crosbolt_arc_perf_perbuild',
Aviv Keshet08561452016-03-16 10:08:47 -070024)
David Haddockd5faa102016-03-11 14:33:36 -080025
Ilja H. Friedelad6d8792016-11-28 21:53:44 -080026def CheckControlFileExistence(tasks):
Alex Miller3ccd77d2013-08-08 01:39:20 -070027 """
28 Make sure that for any task that schedules a suite, that
29 test_suites/control.<suite> exists. this prevents people from accidentally
30 adding a suite to suite_scheduler.ini but not adding an actual suite
31 control file, thus resulting in their suite not running and the lab team
32 getting lots of email
33
34 @param tasks The list of tasks to check.
35 @return 0 if no missing control files are found
36 1 if there are at least one missing control files
37 """
38 corrections = False
39
40 for task in tasks:
41 suite_path = os.path.join(common.autotest_dir,
42 'test_suites', 'control.'+task.suite)
David Haddockd5faa102016-03-11 14:33:36 -080043 if task.suite in _WHITELISTED_SUITES:
Aviv Keshet0d23dd02016-03-08 15:27:09 -080044 continue
Alex Miller3ccd77d2013-08-08 01:39:20 -070045 if not os.path.exists(suite_path):
46 corrections = True
Ilja H. Friedel04be2bd2014-05-07 21:29:59 -070047 logging.warning("No suite control file for %s", task.suite)
Alex Miller3ccd77d2013-08-08 01:39:20 -070048
49 return 1 if corrections else 0