[OE-core] [PATCH v4 2/2] oe-selftest: Add syntax version tracking to oe-selftest
Humberto Ibarra
humberto.ibarra.lopez at intel.com
Thu Sep 1 18:56:40 UTC 2016
Add a version field and option to argparse so the sntax version can be tracked
[YOCTO #8938]
Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez at intel.com>
---
scripts/oe-selftest | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/scripts/oe-selftest b/scripts/oe-selftest
index e0ef0c1..ef996b6 100755
--- a/scripts/oe-selftest
+++ b/scripts/oe-selftest
@@ -48,6 +48,9 @@ import oeqa.utils.ftools as ftools
from oeqa.utils.commands import runCmd, get_bb_var, get_test_layer
from oeqa.selftest.base import oeSelfTest, get_available_machines
+# command syntax version
+__version__ = "2.0"
+
try:
import xmlrunner
from xmlrunner.result import _XMLTestResult as TestResult
@@ -499,8 +502,8 @@ def main():
description = "Script that runs unit tests against bitbake and other Yocto related tools. The goal is to validate tools functionality and metadata integrity. Refer to https://wiki.yoctoproject.org/wiki/Oe-selftest for more information."
parser = argparse_oe.ArgumentParser(description=description)
+ parser.add_argument('--version', action='store_true', help = 'print the oe-selftest version and exit.')
subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>')
- subparsers.required = True
class IncludeAction(argparse.Action):
#def __init__(self, option_strings, dest, nargs=None, **kwargs):
@@ -549,6 +552,17 @@ def main():
args = parser.parse_args()
+ if args.version:
+ print("Oe-selftest %s" % __version__)
+
+ if args._subparser_name is None:
+ if args.version:
+ return 0
+ else:
+ print("oe-selftest: error: the following arguments are required: <subcommand>")
+ parser.print_help()
+ return 2
+
if args._subparser_name == 'list':
args.list_arg = args.list_arg or 'tests'
--
2.4.11
More information about the Openembedded-core
mailing list