osmith has uploaded this change for review.

View Change

testenv: requirements: find programs in /usr/sbin

Fix that testenv complains about a missing setcap program, if it is in
/usr/sbin/setcap and /usr/sbin is not in PATH as it is the case with
Debian. We actually run setcap with sudo when it is needed, and in that
case /usr/sbin gets added to PATH in Debian.

Fix for:
[testenv] Missing program: setcap

Change-Id: Ibbccba013ac38415ef46467f97bef846b848cf39
---
M _testenv/testenv/requirements.py
1 file changed, 6 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/36/38336/1
diff --git a/_testenv/testenv/requirements.py b/_testenv/testenv/requirements.py
index 7badbe9..d65e436 100644
--- a/_testenv/testenv/requirements.py
+++ b/_testenv/testenv/requirements.py
@@ -38,6 +38,12 @@
abort = False
for program in programs:
if not shutil.which(program):
+ if os.path.exists(os.path.join("/usr/sbin", program)):
+ # Debian: some programs such as setcap are in /usr/sbin, which
+ # is not in PATH unless using sudo. Therefore "shutil.which()"
+ # won't find it.
+ continue
+
logging.error(f"Missing program: {program}")

if program == "ttcn3_compiler":

To view, visit change 38336. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ibbccba013ac38415ef46467f97bef846b848cf39
Gerrit-Change-Number: 38336
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>