blob: 0141461c3c99dc137a2b8bd3953170849feff293 [file] [log] [blame]
Joey Armstrong44fa7d82022-11-01 17:46:04 -04001# -*- python -*-
2# -----------------------------------------------------------------------
3# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16# -----------------------------------------------------------------------
17
18##-------------------##
19##---] IMPORTS [---##
20##-------------------##
21import __main__
22import os
23import sys
24
25## -----------------------------------------------------------------------
26## -----------------------------------------------------------------------
27def show_examples():
28 '''Display examples of command usage'''
29
30 cmd = os.path.basename(__main__.__file__)
31
32 print('''
33%% %s
34 Run all tests (default)
35
36%% %s --type regression
37 Run only regression tests.
38
39%% %s --type smoke
40 Run a quick battery of tests.
41
42%% %s --type suite --test unit --attr olt --attr onu
43 Run module tests for olt and onu.
44
45%% %s --type regression --attr gpon
46 Run regression tests for gpon logic.
47''' % (cmd, cmd, cmd, cmd, cmd))
48# print( (cmd) * 5) # syntax ?!?
49
50## -----------------------------------------------------------------------
51## -----------------------------------------------------------------------
52def usage():
53 """Display command arguments and usage
54
55 :param err: Error to display due to invalid arg parsing.
56 :type err: String
57
58 :param arg: --help* command line argument digested by argparse.py
59 :type arg: String
60
61 :raises ValueError
62
63 ...versionadded: 1.1
64 """
65
66 cmd = os.path.basename(__main__.__file__)
67 print("USAGE: %s" % cmd)
68 show_examples()
69 sys.exit(0)
70
71# EOF