1
# This file is part of Checkbox.
3
# Copyright 2012, 2013 Canonical Ltd.
5
# Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
7
# Checkbox is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License version 3,
9
# as published by the Free Software Foundation.
12
# Checkbox 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.
17
# You should have received a copy of the GNU General Public License
18
# along with Checkbox. If not, see <http://www.gnu.org/licenses/>.
21
:mod:`checkbox_ng.main` -- command line interface
22
=================================================
28
from plainbox.impl.commands import PlainBoxToolBase
29
from plainbox.impl.commands.check_config import CheckConfigCommand
30
from plainbox.impl.commands.dev import DevCommand
31
from plainbox.impl.commands.script import ScriptCommand
33
from checkbox_ng import __version__ as version
34
from checkbox_ng.commands.certification import CertificationCommand
35
from checkbox_ng.commands.cli import CliCommand
36
from checkbox_ng.commands.sru import SRUCommand
38
from checkbox_ng.commands.service import ServiceCommand
41
from checkbox_ng.config import CertificationConfig, CheckBoxConfig, CDTSConfig
44
logger = logging.getLogger("checkbox.ng.main")
46
checkbox_cli_settings = {
47
'subparser_name': 'checkbox-cli',
48
'subparser_help': 'application for system testing',
49
'default_whitelist': 'default',
50
'default_providers': ['2013.com.canonical:checkbox'],
52
Welcome to System Testing!
53
Checkbox provides tests to confirm that your system is working properly. \
54
Once you are finished running the tests, you can view a summary report for \
56
Warning: Some tests could cause your system to freeze or become \
57
unresponsive. Please save all your work and close all other running \
58
applications before beginning the testing process."""
62
'subparser_name': 'driver-test-suite-cli',
63
'subparser_help': 'driver test suite application',
64
'default_whitelist': 'ihv-firmware',
65
'default_providers': ['2013.com.canonical:canonical-driver-test-suite'],
67
Welcome to the Canonical Driver Test Suite.
68
This program contains automated and manual tests to help you discover issues \
69
that will arise when running your device drivers on Ubuntu.
70
This application will step the user through these tests in a predetermined \
71
order and automatically collect both system information as well as test \
72
results. It will also prompt the user for input when manual testing is \
74
The run time for the tests is determined by which tests you decide to \
75
execute. The user will have the opportunity to customize the test run to \
76
accommodate the driver and the amount of time available for testing.
77
If you have any questions during or after completing your test run, please \
78
do not hesitate to contact your Canonical account representative.
79
To begin, simply press the Continue button below and follow the onscreen \
84
'subparser_name': 'certification-server',
85
'subparser_help': 'application for server certification',
86
'default_whitelist': 'server-cert',
87
'default_providers': ['2013.com.canonical:certification-server'],
89
Welcome to System Certification!
90
This application will gather information from your system. Then you will be \
91
asked manual tests to confirm that the system is working properly. Finally, \
92
you will be asked for the Secure ID of the computer to submit the \
93
information to the certification.canonical.com database.
94
To learn how to create or locate the Secure ID, please see here:
95
https://certification.canonical.com/"""
99
class CheckBoxNGTool(PlainBoxToolBase):
102
def get_exec_name(cls):
106
def get_exec_version(cls):
107
return "{}.{}.{}".format(*version[:3])
110
def get_config_cls(cls):
111
return CheckBoxConfig
113
def add_subcommands(self, subparsers):
115
self._provider_list, self._config).register_parser(subparsers)
117
self._config).register_parser(subparsers)
119
self._provider_list, self._config).register_parser(subparsers)
121
self._provider_list, self._config).register_parser(subparsers)
123
self._provider_list, self._config, checkbox_cli_settings
124
).register_parser(subparsers)
126
self._provider_list, self._config, cdts_cli_settings
127
).register_parser(subparsers)
128
CertificationCommand(
129
self._provider_list, self._config, cert_cli_settings
130
).register_parser(subparsers)
132
ServiceCommand(self._provider_list, self._config).register_parser(
138
class CertificationNGTool(CheckBoxNGTool):
141
def get_config_cls(cls):
142
return CertificationConfig
145
class CDTSTool(CheckBoxNGTool):
148
def get_config_cls(cls):
154
checkbox command line utility
156
raise SystemExit(CheckBoxNGTool().main(argv))
159
def checkbox_cli(argv=None):
161
CheckBox command line utility
168
CheckBoxNGTool().main(['checkbox-cli'] + args))
171
def cdts_cli(argv=None):
173
certification-server command line utility
180
CDTSTool().main(['driver-test-suite-cli'] + args))
183
def cert_server(argv=None):
185
certification-server command line utility
192
CertificationNGTool().main(['certification-server'] + args))