osmith has uploaded this change for review.

View 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(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/40/40040/1
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 a6929f0..d7e4b6c 100644
--- a/_testenv/testenv/testsuite.py
+++ b/_testenv/testenv/testsuite.py
@@ -229,6 +229,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: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I941064c1c704560e0f7351c82e810481cd72b6da
Gerrit-Change-Number: 40040
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>