osmith submitted this change.
testenv: run: add --bisect argument
Add an argument that lets testenv.py exit with != 0 when at least one
test has failed, so it can be used with "git bisect".
Change-Id: I941064c1c704560e0f7351c82e810481cd72b6da
---
M _testenv/testenv/__init__.py
M _testenv/testenv/testsuite.py
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/_testenv/testenv/__init__.py b/_testenv/testenv/__init__.py
index 015ef24..07880cc 100644
--- a/_testenv/testenv/__init__.py
+++ b/_testenv/testenv/__init__.py
@@ -95,7 +95,14 @@
help="use binary packages from this Osmocom OBS project instead (e.g. osmocom:nightly)",
)
- group = sub_run.add_argument_group("loop options", "Run the testsuite / a single test multiple times.")
+ group = sub_run.add_argument_group("exit options", "When and how testenv should exit when done.")
+ group = group.add_mutually_exclusive_group()
+ group.add_argument(
+ "-B",
+ "--bisect",
+ action="store_true",
+ help="exit with != 0 if at least one test failed (use with git bisect)",
+ )
group.add_argument(
"-u",
"--until-nok",
diff --git a/_testenv/testenv/testsuite.py b/_testenv/testenv/testsuite.py
index 1cd077b..149e47f 100644
--- a/_testenv/testenv/testsuite.py
+++ b/_testenv/testenv/testsuite.py
@@ -177,6 +177,9 @@
merge_log_files(cfg)
format_log_files(cfg)
+ if testenv.args.bisect and not check_testsuite_successful():
+ raise testenv.NoTraceException("Testsuite failed!")
+
def get_current_test():
path = os.path.join(testenv.testdir.testdir, "testsuite/.current_test")
To view, visit change 40040. To unsubscribe, or for help writing mail filters, visit settings.