Joey Armstrong | 44fa7d8 | 2022-11-01 17:46:04 -0400 | [diff] [blame] | 1 | # -*- 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 | ##-------------------## |
| 21 | import __main__ |
| 22 | import os |
| 23 | import sys |
| 24 | |
| 25 | ## ----------------------------------------------------------------------- |
| 26 | ## ----------------------------------------------------------------------- |
| 27 | def 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 | ## ----------------------------------------------------------------------- |
| 52 | def 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 |