1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
#! /usr/bin/env python
# -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
#
# Copyright (C) 2010 Patrick Crews
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
""" dbqp.py
DataBase Quality Platform - system for executing various
testing systems and the helper code
Currently only executing drizzle-test-run tests
But we can compose various combinations of servers, system,
and test definitions to produce various results
"""
# imports
import os
import sys
import lib.test_run_options as test_run_options
from lib.test_mode import handle_mode
from lib.server_mgmt.server_management import serverManager
from lib.sys_mgmt.system_management import systemManager
from lib.test_mgmt.execution_management import executionManager
# functions
# main
variables = test_run_options.variables
system_manager = None
server_manager = None
test_manager = None
test_executor = None
execution_manager = None
try:
# Some system-level work is constant regardless
# of the test to be run
system_manager = systemManager(variables)
# Create our server_manager
server_manager = serverManager(system_manager, variables)
# Get our mode-specific test_manager and test_executor
(test_manager,test_executor) = handle_mode(variables, system_manager)
# Gather our tests for execution
test_manager.gather_tests()
# Initialize test execution manager
execution_manager = executionManager(server_manager, system_manager
, test_manager, test_executor
, variables)
# Execute our tests!
execution_manager.execute_tests()
except Exception, e:
print Exception, e
except KeyboardInterrupt:
print "\n\nDetected <Ctrl>+c, shutting down and cleaning up..."
finally:
# TODO - make a more robust cleanup
# At the moment, runaway servers are our biggest concern
if server_manager and not variables['startandexit']:
server_manager.cleanup()
if not variables['startandexit']:
if test_manager:
fail_count = test_manager.has_failing_tests()
sys.exit(test_manager.has_failing_tests())
else:
# return 1 as we likely have a problem if we don't have a
# test_manager
sys.exit(1)
|