1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

blackbox tests: method to check specific exit codes

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
Gary Lockyer 2017-08-16 13:52:25 +12:00 committed by Douglas Bagnall
parent e12dbc7307
commit 74ebcf6dfc

View File

@ -318,11 +318,20 @@ class BlackboxTestCase(TestCaseInTempDir):
return line return line
def check_run(self, line): def check_run(self, line):
self.check_exit_code(line, 0)
def check_exit_code(self, line, expected):
line = self._make_cmdline(line) line = self._make_cmdline(line)
p = subprocess.Popen(line, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) p = subprocess.Popen(line,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True)
retcode = p.wait() retcode = p.wait()
if retcode: if retcode != expected:
raise BlackboxProcessError(retcode, line, p.stdout.read(), p.stderr.read()) raise BlackboxProcessError(retcode,
line,
p.stdout.read(),
p.stderr.read())
def check_output(self, line): def check_output(self, line):
line = self._make_cmdline(line) line = self._make_cmdline(line)