diff options
Diffstat (limited to 'bitbake/lib/toaster/contrib/tts/config.py')
| -rw-r--r-- | bitbake/lib/toaster/contrib/tts/config.py | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/contrib/tts/config.py b/bitbake/lib/toaster/contrib/tts/config.py new file mode 100644 index 0000000000..a4ea8cf5fa --- /dev/null +++ b/bitbake/lib/toaster/contrib/tts/config.py | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | #!/usr/bin/python | ||
| 2 | |||
| 3 | # ex:ts=4:sw=4:sts=4:et | ||
| 4 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
| 5 | # | ||
| 6 | # Copyright (C) 2015 Alexandru Damian for Intel Corp. | ||
| 7 | # | ||
| 8 | # This program is free software; you can redistribute it and/or modify | ||
| 9 | # it under the terms of the GNU General Public License version 2 as | ||
| 10 | # published by the Free Software Foundation. | ||
| 11 | # | ||
| 12 | # This program is distributed in the hope that it will be useful, | ||
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | # GNU General Public License for more details. | ||
| 16 | # | ||
| 17 | # You should have received a copy of the GNU General Public License along | ||
| 18 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
| 19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | |||
| 21 | # This is the configuration/single module for tts | ||
| 22 | # everything that would be a global variable goes here | ||
| 23 | |||
| 24 | import os, sys, logging | ||
| 25 | |||
| 26 | LOGDIR = "log" | ||
| 27 | SETTINGS_FILE = os.path.join(os.path.dirname(__file__), "settings.json") | ||
| 28 | TEST_DIR_NAME = "tts_testdir" | ||
| 29 | |||
| 30 | OWN_PID = os.getpid() | ||
| 31 | |||
| 32 | OWN_EMAIL_ADDRESS = "Toaster Testing Framework <alexandru.damian@intel.com>" | ||
| 33 | REPORT_EMAIL_ADDRESS = "alexandru.damian@intel.com" | ||
| 34 | |||
| 35 | # make sure we have the basic logging infrastructure | ||
| 36 | logger = logging.getLogger("toastertest") | ||
| 37 | __console = logging.StreamHandler(sys.stdout) | ||
| 38 | __console.setFormatter(logging.Formatter("%(asctime)s %(levelname)s: %(message)s")) | ||
| 39 | logger.addHandler(__console) | ||
| 40 | logger.setLevel(logging.DEBUG) | ||
| 41 | |||
| 42 | |||
| 43 | # singleton file names | ||
| 44 | LOCKFILE="/tmp/ttf.lock" | ||
| 45 | BACKLOGFILE=os.path.join(os.path.dirname(__file__), "backlog.txt") | ||
| 46 | |||
| 47 | # task states | ||
| 48 | def enum(*sequential, **named): | ||
| 49 | enums = dict(zip(sequential, range(len(sequential))), **named) | ||
| 50 | reverse = dict((value, key) for key, value in enums.iteritems()) | ||
| 51 | enums['reverse_mapping'] = reverse | ||
| 52 | return type('Enum', (), enums) | ||
| 53 | |||
| 54 | |||
| 55 | class TASKS: | ||
| 56 | PENDING = "PENDING" | ||
| 57 | INPROGRESS = "INPROGRESS" | ||
| 58 | DONE = "DONE" | ||
| 59 | |||
| 60 | @staticmethod | ||
| 61 | def next_task(task): | ||
| 62 | if task == TASKS.PENDING: | ||
| 63 | return TASKS.INPROGRESS | ||
| 64 | if task == TASKS.INPROGRESS: | ||
| 65 | return TASKS.DONE | ||
| 66 | raise Exception("Invalid next task state for %s" % task) | ||
| 67 | |||
| 68 | # TTS specific | ||
| 69 | CONTRIB_REPO = "git@git.yoctoproject.org:poky-contrib" | ||
| 70 | |||
