@samitouri / QOSamiQemu / commits / 0d1daf4102

iotests: fix check for sudo access in LUKS I/O test

The test did not cope with the possibility that 'sudo' was not installed at all, merely that it was not configured. This broke tests in any CI env which lacks 'sudo'. Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

Daniel P. Berrangé committed Jan 12, 2026 at 18:19 UTC 0d1daf4102a5f435a1390d86108a03a5af081f7b
1 file changed +8 -5
tests/qemu-iotests/149
+8 -5
@@ -95,11 +95,14 @@ def verify_passwordless_sudo():
95
96 args = ["sudo", "-n", "/bin/true"]
97
98 - proc = subprocess.Popen(args,
99 - stdin=subprocess.PIPE,
100 - stdout=subprocess.PIPE,
101 - stderr=subprocess.STDOUT,
102 - universal_newlines=True)
98 + try:
99 + proc = subprocess.Popen(args,
100 + stdin=subprocess.PIPE,
101 + stdout=subprocess.PIPE,
102 + stderr=subprocess.STDOUT,
103 + universal_newlines=True)
104 + except FileNotFoundError as e:
105 + iotests.notrun('requires sudo binary: %s' % e)
106
107 msg = proc.communicate()[0]
108