osmith submitted this change.

View Change

Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified pespin: Looks good to me, approved
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.

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I941064c1c704560e0f7351c82e810481cd72b6da
Gerrit-Change-Number: 40040
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>