ci-test: Add options to disable integration tests
Enable integration tests by default.
Give the user an option(--no-integration-tests) to disable them.
```
usage: unit-test.py [-h] -w WORKSPACE -p PACKAGE [-t]
[--integration-tests | --no-integration-tests] [-v]
[-r REPEAT] [-b BRANCH] [-n]
...
--integration-tests Enable integration tests [default].
--no-integration-tests
Disable integration tests.
```
This is needed, because some tests are run for a certain period
that increases the test execution time.
Tested on pid-control and host-ipmid proposed integration tests
with/without this option.
Signed-off-by: Ramin Izadpanah <iramin@google.com>
Change-Id: I21656dcdf300d990fef8d387725813e0dd1827e1
diff --git a/scripts/unit-test.py b/scripts/unit-test.py
index d6ca805..e9553b3 100755
--- a/scripts/unit-test.py
+++ b/scripts/unit-test.py
@@ -662,6 +662,7 @@
self._configure_feature('silent-rules', False),
self._configure_feature('examples', build_for_testing),
self._configure_feature('tests', build_for_testing),
+ self._configure_feature('itests', INTEGRATION_TEST),
]
if not TEST_ONLY:
conf_flags.extend([
@@ -713,7 +714,11 @@
def configure(self, build_for_testing):
self.build_for_testing = build_for_testing
- check_call_cmd('cmake', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '.')
+ if INTEGRATION_TEST:
+ check_call_cmd('cmake', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON',
+ '-DITESTS=ON', '.')
+ else:
+ check_call_cmd('cmake', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '.')
def build(self):
check_call_cmd('cmake', '--build', '.', '--', '-j',
@@ -867,6 +872,8 @@
meson_flags.append(self._configure_option(meson_options, 'tests', build_for_testing))
if 'examples' in meson_options:
meson_flags.append(self._configure_option(meson_options, 'examples', build_for_testing))
+ if 'itests' in meson_options:
+ meson_flags.append(self._configure_option(meson_options, 'itests', INTEGRATION_TEST))
if MESON_FLAGS.get(self.package) is not None:
meson_flags.extend(MESON_FLAGS.get(self.package))
try:
@@ -1113,6 +1120,13 @@
parser.add_argument("-t", "--test-only", dest="TEST_ONLY",
action="store_true", required=False, default=False,
help="Only run test cases, no other validation")
+ arg_inttests = parser.add_mutually_exclusive_group()
+ arg_inttests.add_argument("--integration-tests", dest="INTEGRATION_TEST",
+ action="store_true", required=False, default=True,
+ help="Enable integration tests [default].")
+ arg_inttests.add_argument("--no-integration-tests", dest="INTEGRATION_TEST",
+ action="store_false", required=False,
+ help="Disable integration tests.")
parser.add_argument("-v", "--verbose", action="store_true",
help="Print additional package status messages")
parser.add_argument("-r", "--repeat", help="Repeat tests N times",
@@ -1127,6 +1141,7 @@
WORKSPACE = args.WORKSPACE
UNIT_TEST_PKG = args.PACKAGE
TEST_ONLY = args.TEST_ONLY
+ INTEGRATION_TEST = args.INTEGRATION_TEST
BRANCH = args.BRANCH
FORMAT_CODE = args.FORMAT
if args.verbose: